ShadowRoot: getHTML() method
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The getHTML() method of the ShadowRoot interface is used to serialize a shadow root's DOM to an HTML string.
Syntax
js
const html = shadowRoot.getHTML(options)
Parameters
optionsOptional-
An options object with the following optional parameters:
serializableShadowRoots-
A boolean value that specifies whether to include serializable shadow roots. The default value is
false. shadowRoots-
An array of
ShadowRootobjects to serialize. These are included regardless of whether they are marked as serializable. The default value is an empty array.
Return value
A string that represents the HTML serialization of the shadow root.
Exceptions
None.
Specifications
| Specification |
|---|
| HTML Standard # dom-shadowroot-gethtml |
Browser compatibility
| desktop | mobile | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
getHTML | |||||||||||