Testing

Shadow DOM v1: Browser Support, Modes, Slots

Shadow DOM v1 works in Chrome 53+, Edge 79+, Firefox 63+, Opera 40+, Samsung Internet 6.2+, and Safari 10+. Per-browser support, modes, slots, and known issues.

Author

Prince Dewani

May 6, 2026

Shadow DOM v1 is the W3C DOM standard API that attaches an encapsulated DOM subtree to a host element, isolating its markup, styles, and scripts from the page. It works in Chrome 53+, Edge 79+, Firefox 63+, Opera 40+, Samsung Internet 6.2+, and Safari 10+ on macOS, 11+ on iOS, while Internet Explorer never shipped it.

This guide covers what Shadow DOM v1 is, browsers that support it, its key features, v0 vs v1 differences, support checks, and known issues.

What is Shadow DOM v1?

Shadow DOM v1 is the second-generation Shadow DOM specification, part of the Web Components family in the W3C and WHATWG DOM Standard. A developer calls element.attachShadow({mode: 'open'}) to attach a sealed DOM tree to a host element. The tree has its own markup and CSS that the outer page cannot reach.

Which browsers does Shadow DOM v1 support?

Every major modern browser supports Shadow DOM v1 by default. Internet Explorer is the only one that never did.

Loading browser compatibility data...

Shadow DOM v1 compatibility in Chrome

Chrome supports Shadow DOM v1 from Chrome 53 on Windows, macOS, Linux, ChromeOS, and Android. Chrome 4 to 52 did not support it. Custom Elements v1, the partner spec for Shadow DOM v1, shipped in Chrome 54.

Shadow DOM v1 compatibility in Edge

Microsoft Edge supports Shadow DOM v1 in the Chromium-based Edge from version 79 on. The older EdgeHTML versions (12 to 18) did not support it.

Shadow DOM v1 compatibility in Firefox

Firefox supports Shadow DOM v1 from Firefox 63 on, on Windows, macOS, Linux, and Android. Firefox 58 to 62 had it disabled by default behind the dom.webcomponents.enabled preference. Firefox 2 to 57 did not support it.

Shadow DOM v1 compatibility in Safari

Safari supports Shadow DOM v1 from Safari 10 on macOS, and from Safari 11 on iOS and iPadOS. Safari 3.1 to 9.1 on macOS did not support it. iOS Safari 10 to 10.3 had partial support; iOS 3.2 to 9.3 did not support it.

Shadow DOM v1 compatibility in Opera

Opera supports Shadow DOM v1 from Opera 40 on desktop, which is built on Chromium. Opera 9 to 39 did not support it. Opera Mobile supports Shadow DOM v1 from Opera Mobile 80 on; Opera Mobile 10 to 12.1 did not support it.

Shadow DOM v1 compatibility in Samsung Internet

Samsung Internet supports Shadow DOM v1 from Samsung Internet 6.2 on. Samsung Internet 5 had partial support, and Samsung Internet 4 did not support it.

Shadow DOM v1 compatibility in Android Browser

The legacy stock Android Browser supports Shadow DOM v1 from Android Browser 97 on. Android Browser 2.1 to 4.4.4 did not support it. Chrome for Android and Firefox for Android both support Shadow DOM v1 by default.

Shadow DOM v1 compatibility in Internet Explorer

Internet Explorer never supported Shadow DOM v1 in any version. Pages that need the API in IE 11 have to load a polyfill such as the WebComponents.org webcomponents-bundle, which ships a JavaScript implementation of attachShadow and the slot element.

Note

Note: Shadow DOM v1 styles, slots, and focus behave differently across browsers. Test it on real browsers and OS with TestMu AI. Try TestMu AI free!

What are the key features of Shadow DOM v1?

Shadow DOM v1 ships nine encapsulation features that the v0 draft either did not have or shaped differently. They are the foundation that Lit, Stencil, Salesforce LWC, and many other component frameworks build on.

  • attachShadow with mode: The host calls element.attachShadow({mode: 'open' | 'closed'}). Mode is required, which makes the access policy explicit.
  • Open and closed shadow roots: Open mode exposes the root through host.shadowRoot. Closed mode hides it from external scripts so only the code that attached it keeps the reference.
  • Slot composition: The <slot> element accepts light DOM children from the host and projects them into the shadow tree. Named slots use the slot attribute; the default slot catches the rest.
  • slotchange event: A slot fires slotchange at the end of a microtask when its assigned nodes change, so a component can react to host content updates without a MutationObserver.
  • CSS scoping: Outer page selectors do not cross the shadow boundary, and inner styles do not leak out. The :host, :host(), and ::slotted() pseudo-classes give controlled hooks for styling the host and projected children.
  • CSS custom properties cross the boundary: Custom properties declared on the host are inherited inside the shadow tree, so a parent page can theme a component without piercing its DOM.
  • Constructable stylesheets and adoptedStyleSheets: A shadow root can share a single CSSStyleSheet across many instances through shadowRoot.adoptedStyleSheets, which is faster than re-parsing inline <style> blocks per instance.
  • Retargeted events: Events that bubble out of a shadow tree have their target retargeted to the host, while event.composedPath() still exposes the full path for components that opt in.
  • Declarative Shadow DOM: The <template shadowrootmode> attribute lets servers send shadow trees as HTML, so server-rendered Web Components hydrate without JavaScript. Chrome 90+, Edge 90+, Firefox 123+, and Safari 16.4+ support it.

What is the difference between Shadow DOM v1 and v0?

Shadow DOM v0 was a Chromium-only draft. Shadow DOM v1 is the standard every major browser ships. The two specs share the same idea but differ on the API surface, slot model, and lifecycle. The table below lines up the differences a developer is most likely to hit.

DimensionShadow DOM v0Shadow DOM v1
Spec statusDeprecated, removed from ChromiumStandard, in the W3C and WHATWG DOM Standard
Attach APIelement.createShadowRoot()element.attachShadow({mode})
Mode parameterNot applicableRequired: 'open' or 'closed'
Slot mechanism<content> element with select="" CSS-style queries<slot> element with name attribute
Multiple shadow rootsAllowed, then deprecatedOne root per host element
Slot change eventsNot availableslotchange fires on assigned-node updates
Browser supportChromium only, removedChrome 53+, Edge 79+, Firefox 63+, Safari 10+, Opera 40+
...

How do you check if a browser supports Shadow DOM v1?

Shadow DOM v1 support depends on a single API: Element.attachShadow. Three quick checks cover most production needs.

  • Run a one-line console test: Press F12, open the Console tab, and paste typeof Element.prototype.attachShadow === "function". It returns true if Shadow DOM v1 works.
  • Try a real attach: In the same console, run document.createElement("div").attachShadow({mode: 'open'}). A returned ShadowRoot object confirms the API is live; an exception means the browser does not support it.
  • Detect the slot element: Run "slot" in document.createElement("div"). The slot mechanism is the v1 distribution model; a true result means the browser ships v1, not v0.
  • Probe declarative Shadow DOM separately: Run HTMLTemplateElement.prototype.hasOwnProperty("shadowRootMode"). The v1 API can ship before declarative shadow DOM does, so this catches the common gap on older Firefox.
  • Load a polyfill where needed: If any of the checks return false, load github.com/webcomponents/polyfills with the webcomponents-bundle.js entry. The polyfill stamps a JavaScript-only attachShadow into the prototype.

These checks each run on one browser at a time. To validate Shadow DOM v1 across every browser and OS combination your users have, TestMu AI gives you 3,000+ real browsers and devices to run the same checks on.

...

What are the known issues with Shadow DOM v1?

Shadow DOM v1 is one specification, but the encapsulation rules surface real cross-browser quirks. Here is what to watch for and how to handle each one.

  • Global CSS does not cross the boundary: Bootstrap, Tailwind utility classes, and reset stylesheets in the page head do not apply inside a shadow root. How to handle it: Pass tokens through CSS custom properties on the host, or use shadowRoot.adoptedStyleSheets to share a constructable stylesheet across components.
  • document.querySelector cannot pierce the shadow root: A regular document.querySelector("button") ignores buttons inside any shadow tree. Test frameworks need a piercing API. How to handle it: In my experience this is the single biggest cross-browser pitfall when retrofitting tests onto a Web Components codebase. Selenium 4's getShadowRoot(), Playwright's default selectors, and Cypress's cy.shadow() each pierce differently, so pick one tool per repo.
  • Focus and selection cross the boundary in browser-specific ways: Tab order travels into shadow trees in Chrome and Edge; older Firefox skipped some shadow children for a few releases after Firefox 63. document.activeElement retargets to the host, not the focused node inside. How to handle it: Walk document.activeElement.shadowRoot.activeElement recursively when you need the deepest focus, and test tab order on every target browser.
  • Closed mode is not a security boundary: A closed root hides shadowRoot from outside JavaScript, but the same-realm code can still reach internals through event paths and attached references. How to handle it: Treat closed mode as a developer hint, not a sandbox. The web.dev Shadow DOM v1 guide explicitly recommends open mode.
  • Accessibility tools need extra plumbing: Some screen readers historically had partial support for content inside shadow trees, especially when using ARIA references like aria-labelledby across the boundary. How to handle it: Keep ARIA attributes on light DOM children where possible and use the ElementInternals API to expose role, value, and validation to assistive tech.
  • Form controls inside a shadow root: A <form> in the page head does not pick up a custom <input> defined inside a shadow tree without help. How to handle it: Use ElementInternals.setFormValue() with form-associated custom elements (Chrome 77+, Safari 16.4+, Firefox 98+) so the host element participates in the outer form.

Citations

All Shadow DOM v1 version numbers and platform notes in this guide come from these primary sources:

Author

Prince Dewani is a Community Contributor at TestMu AI, where he manages content strategies around software testing, QA, and test automation. He is certified in Selenium, Cypress, Playwright, Appium, Automation Testing, and KaneAI. Prince has also presented academic research at the international conference PBCON-01. He further specializes in on-page SEO, bridging marketing with core testing technologies. On LinkedIn, he is followed by 4,300+ QA engineers, developers, DevOps experts, tech leaders, and AI-focused practitioners in the global testing community.

Open in ChatGPT Icon

Open in ChatGPT

Open in Claude Icon

Open in Claude

Open in Perplexity Icon

Open in Perplexity

Open in Grok Icon

Open in Grok

Open in Gemini AI Icon

Open in Gemini AI

Copied to Clipboard!
...

3000+ Browsers. One Platform.

See exactly how your site performs everywhere.

Try it free
...

Write Tests in Plain English with KaneAI

Create, debug, and evolve tests using natural language.

Try for free

Frequently asked questions

Did you find this page helpful?

More Related Hubs

TestMu AI forEnterprise

Get access to solutions built on Enterprise
grade security, privacy, & compliance

  • Advanced access controls
  • Advanced data retention rules
  • Advanced Local Testing
  • Premium Support options
  • Early access to beta features
  • Private Slack Channel
  • Unlimited Manual Accessibility DevTools Tests