Declarative shadow DOM
Newly available since 2024-02-20
The shadowrootmode
attribute on <template>
creates a shadow root without the use of JavaScript. It is a declarative alternative to the attachShadow()
method.
Specifications
- HTML (#attr-template-shadowrootmode), from HTML Workstream (WHATWG).
Browser support (view on caniuse.com)
- Chrome 111 Released on 2023-03-07
- Chrome Android 111 Released on 2023-03-07
- Edge 111 Released on 2023-03-13
- Firefox 123 Released on 2024-02-20
- Firefox for Android 123 Released on 2024-02-20
- Safari 16.4 Released on 2023-03-27
- Safari on iOS 16.4 Released on 2023-03-27
Developer signals
- State of HTML 2024: web_components/web_components_features question
- State of HTML 2024: web_components/web_component_features question
- State of HTML 2024: features/all_features question
- State of HTML 2023: web_components/web_components_main_features question
- State of HTML 2023: usage/html_interoperability_features question
- State of HTML 2023: features/all_features question
Usage (according to Chrome Platform Status)
~0.117% of page loads. More data at chromestatus.
Interop
- Included in Interop 2024
Web Platform Tests (WPT)
View the latest WPT test results for this featureView as JSON | Edit this feature | Report an issue | Web-features entry: source, dist