HTML Attributes
HTML shadowrootmode attribute
Makes an eligible template declaratively create a shadow root on its parent during HTML parsing. open exposes the root through host.shadowRoot; closed does not provide access through that property. Applicable elements include: <template>. Check each element’s value rules.
Formal Syntax & Structure
html syntaxhtml
shadowrootmode="open"Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| shadowrootmode | enumerated: open, closed | Makes an eligible template declaratively create a shadow root on its parent during HTML parsing. open exposes the root through host.shadowRoot; closed does not provide access through that property. |
Working Example
Example Snippethtml
<div> <template shadowrootmode="open"> <p>Shadow content</p> </template></div>