HTML shadowrootserializable Attribute
The shadowrootserializable attribute makes a declarative shadow root serializable, so it is included by methods such as getHTML().
Description
The shadowrootserializable attribute is a boolean attribute of the <template> element. It only has an effect together with shadowrootmode, and sets the serializable property of the declarative shadow root, so it is included when the DOM is serialized with getHTML() and the serializableShadowRoots option.
Declarative Shadow DOM lets a web component's shadow root be written directly in HTML: a <template> element with the shadowrootmode attribute, placed inside the host element, is turned into a shadow root by the HTML parser. This makes it possible to render components on the server, with their encapsulated styles, without waiting for JavaScript.
Syntax
<template shadowrootmode="open" shadowrootserializable>
Values
- shadowrootserializableA boolean attribute; its presence enables the option on the declarative shadow root.
Applies To
Example
Browser Support
The following information will show you the current browser support for the HTML shadowrootserializable attribute. Hover over a browser icon to see the version that first introduced support for this HTML attribute.
Desktop





Tablets & Mobile





