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

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
innerHTML
53
79
63
No
40
10.1
53
53
63
41
10.3
6.0

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/innerHTML