ShadowRoot: serializable property

The serializable read-only property of the ShadowRoot interface returns true if the shadow root is serializable.

If set, the shadow root may be serialized by calling the Element.getHTML() or ShadowRoot.getHTML() methods with the options.serializableShadowRoots parameter set true.

The serializable property of a shadow root is specified when the shadow root is created, either declaratively by adding the shadowrootserializable attribute on a <template> element (along with an allowed shadowrootmode value), or by setting the options.serializable parameter to true when using Element.attachShadow().

Value

true if the shadow root is serializable; false otherwise.

Examples

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

// ...

// Is it serializable?
let hostElem = shadow.serializable;

Specifications

Specification
DOM
# dom-shadowroot-serializable

Browser compatibility

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
serializable

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support