ShadowRoot: innerHTML property

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

Value

A string.

Examples

js

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

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

Specifications

Specification
DOM Parsing and Serialization
# ref-for-dom-innerhtml-innerhtml-2

Browser compatibility

BCD tables only load in the browser