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.
When set to the null
value, that null
value is converted to the empty string (""
), so sr.innerHTML = null
is equivalent to sr.innerHTML = ""
.
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 |
---|
HTML # dom-shadowroot-innerhtml |
Browser compatibility
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
innerHTML | ||||||||||||
Can be set with a TrustedHTML instance |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- User must explicitly enable this feature.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.