ShadowRoot.innerHTML

The innerHTML property of the ShadowRoot interface sets or returns a reference to the DOM tree inside the ShadowRoot.

Syntax

var domString = shadowRoot.innerHTML
shadowRoot.innerHTML = domString

Value

A DOMString.

Examples

let customElem = document.querySelector('my-shadow-dom-element');
let shadow = customElem.shadowRoot;

shadow.innerHTML = '<strong>This element should be more important!</strong>';

Specifications

Specification Status Comment
DOM Parsing and Serialization
The definition of 'ShadowRoot.innerHTML' in that specification.
Working Draft Initial definition

Browser compatibility

BCD tables only load in the browser