ShadowRoot

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.

* Some parts of this feature may have varying levels of support.

The ShadowRoot interface of the Shadow DOM API is the root node of a DOM subtree that is rendered separately from a document's main DOM tree.

You can retrieve a reference to an element's shadow root using its Element.shadowRoot property, provided it was created using Element.attachShadow() with the mode option set to open.

EventTarget Node DocumentFragment ShadowRoot

Instance properties

ShadowRoot.activeElement Read only

Returns the Element within the shadow tree that has focus.

ShadowRoot.adoptedStyleSheets

Add an array of constructed stylesheets to be used by the shadow DOM subtree. These may be shared with other DOM subtrees that share the same parent Document node, and the document itself.

ShadowRoot.clonable Read only

A boolean that indicates whether the shadow root is clonable.

ShadowRoot.customElementRegistry Read only

Returns the CustomElementRegistry object associated with this shadow root, or null if one has not been set.

ShadowRoot.delegatesFocus Read only

A boolean that indicates whether the shadow root delegates focus if a non-focusable node is selected.

ShadowRoot.fullscreenElement Read only

The element that's currently in full screen mode for this shadow tree.

ShadowRoot.host Read only

Returns a reference to the DOM element the ShadowRoot is attached to.

ShadowRoot.innerHTML

Sets or returns a reference to the DOM tree inside the ShadowRoot.

ShadowRoot.mode Read only

The mode of the ShadowRoot, either open or closed. This defines whether or not the shadow root's internal features are accessible from JavaScript.

ShadowRoot.pictureInPictureElement Read only

Returns the Element within the shadow tree that is currently being presented in picture-in-picture mode.

ShadowRoot.pointerLockElement Read only

Returns the Element set as the target for mouse events while the pointer is locked. null if lock is pending, pointer is unlocked, or if the target is in another tree.

ShadowRoot.referenceTarget

A nullable string value that indicates the effective target of any element reference made against the shadow host from outside the host element. The value should be the ID of an element inside the shadow DOM. If set, target references to the host element from outside the shadow DOM will cause the referenced target element to become the effective target of the reference to the host element.

ShadowRoot.serializable Read only

A boolean that indicates whether the shadow root is serializable. A serializable shadow root inside an element will be serialized by Element.getHTML() or ShadowRoot.getHTML() when its options.serializableShadowRoots parameter is set true. This is set when the shadow root is created.

ShadowRoot.slotAssignment Read only

Returns a string containing the type of slot assignment, either manual or named.

ShadowRoot.styleSheets Read only

Returns a StyleSheetList of CSSStyleSheet objects for stylesheets explicitly linked into, or embedded in a shadow tree.

Instance methods

ShadowRoot.getAnimations()

Returns an array of all Animation objects currently in effect, whose target elements are descendants of the shadow tree.

ShadowRoot.getSelection()

Returns a Selection object representing the range of text selected by the user, or the current position of the caret.

ShadowRoot.elementFromPoint()

Returns the topmost element at the specified coordinates.

ShadowRoot.elementsFromPoint()

Returns an array of all elements at the specified coordinates.

ShadowRoot.setHTML()

Provides an XSS-safe method to parse and sanitize a string of HTML into a DocumentFragment, which then replaces the existing tree in the shadow DOM.

ShadowRoot.setHTMLUnsafe()

Parses a string of HTML into a document fragment, without sanitization, which then replaces the shadowroot's original subtree. The HTML string may include declarative shadow roots, which would be parsed as template elements the HTML was set using ShadowRoot.innerHTML.

Events

The following events are available to ShadowRoot via event bubbling from HTMLSlotElement:

HTMLSlotElement slotchange event

An event fired when the node(s) contained in that slot change.

Examples

The following snippets are taken from our life-cycle-callbacks example (see it live also), which creates an element that displays a square of a size and color specified in the element's attributes.

Inside the <custom-square> element's class definition we include some life cycle callbacks that make a call to an external function, updateStyle(), which actually applies the size and color to the element. You'll see that we are passing it this (the custom element itself) as a parameter.

js
class Square extends HTMLElement {
  // …
  connectedCallback() {
    console.log("Custom square element added to page.");
    updateStyle(this);
  }

  attributeChangedCallback(name, oldValue, newValue) {
    console.log("Custom square element attributes changed.");
    updateStyle(this);
  }
  // …
}

In the updateStyle() function itself, we get a reference to the shadow DOM using Element.shadowRoot. From here we use standard DOM traversal techniques to find the <style> element inside the shadow DOM and then update the CSS found inside it:

js
function updateStyle(elem) {
  const shadow = elem.shadowRoot;
  const childNodes = shadow.childNodes;
  for (const node of childNodes) {
    if (node.nodeName === "STYLE") {
      node.textContent = `
div {
  width: ${elem.getAttribute("l")}px;
  height: ${elem.getAttribute("l")}px;
  background-color: ${elem.getAttribute("c")};
}
      `;
    }
  }
}

Specifications

Specification
DOM
# interface-shadowroot

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
ShadowRoot
Chrome – Full support
Chrome 53 (Release date: 2016-08-31)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 63 (Release date: 2018-10-23)
footnote Full support
Opera – Full support
Opera 40 (Release date: 2016-09-20)
footnote Full support
Safari – Full support
Safari 10 (Release date: 2016-09-20)
footnote Full support
Chrome Android – Full support
Chrome Android 53 (Release date: 2016-09-07)
footnote Full support
Firefox for Android – Full support
Firefox for Android 63 (Release date: 2018-10-23)
footnote Full support
Opera Android – Full support
Opera Android 41 (Release date: 2016-10-25)
footnote Full support
Safari on iOS – Full support
Safari on iOS 10 (Release date: 2016-09-13)
footnote Full support
Samsung Internet – Full support
Samsung Internet 6 (Release date: 2017-08-23)
footnote Full support
WebView Android – Full support
WebView Android 53 (Release date: 2016-09-07)
footnote Full support
WebView on iOS – Full support
WebView on iOS 10 (Release date: 2016-09-13)
footnote Full support
activeElement
Chrome – Full support
Chrome 53 (Release date: 2016-08-31)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 63 (Release date: 2018-10-23)
footnote Full support
Opera – Full support
Opera 40 (Release date: 2016-09-20)
footnote Full support
Safari – Full support
Safari 10 (Release date: 2016-09-20)
footnote Full support
Chrome Android – Full support
Chrome Android 53 (Release date: 2016-09-07)
footnote Full support
Firefox for Android – Full support
Firefox for Android 63 (Release date: 2018-10-23)
footnote Full support
Opera Android – Full support
Opera Android 41 (Release date: 2016-10-25)
footnote Full support
Safari on iOS – Full support
Safari on iOS 10 (Release date: 2016-09-13)
footnote Full support
Samsung Internet – Full support
Samsung Internet 6 (Release date: 2017-08-23)
footnote Full support
WebView Android – Full support
WebView Android 53 (Release date: 2016-09-07)
footnote Full support
WebView on iOS – Full support
WebView on iOS 10 (Release date: 2016-09-13)
footnote Full support
adoptedStyleSheets
Chrome – Full support
Chrome 73 (Release date: 2019-03-12)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 101 (Release date: 2022-05-31)
footnote Full support
Opera – Full support
Opera 60 (Release date: 2019-04-09)
footnote Full support
Safari – Full support
Safari 16.4 (Release date: 2023-03-27)
footnote Full support
Chrome Android – Full support
Chrome Android 73 (Release date: 2019-03-12)
footnote Full support
Firefox for Android – Full support
Firefox for Android 101 (Release date: 2022-05-31)
footnote Full support
Opera Android – Full support
Opera Android 50 (Release date: 2019-02-18)
footnote Full support
Safari on iOS – Full support
Safari on iOS 16.4 (Release date: 2023-03-27)
footnote Full support
Samsung Internet – Full support
Samsung Internet 11 (Release date: 2019-12-05)
footnote Full support
WebView Android – Full support
WebView Android 73 (Release date: 2019-03-12)
footnote Full support
WebView on iOS – Full support
WebView on iOS 16.4 (Release date: 2023-03-27)
footnote Full support
clonable
Chrome – Full support
Chrome 124 (Release date: 2024-04-16)
footnote Full support
Edge – Full support
Edge 124 (Release date: 2024-04-18)
footnote Full support
Firefox – Full support
Firefox 123 (Release date: 2024-02-20)
footnote Full support
Opera – Full support
Opera 110 (Release date: 2024-05-14)
footnote Full support
Safari – Full support
Safari 17.4 (Release date: 2024-03-05)
footnote Full support
Chrome Android – Full support
Chrome Android 124 (Release date: 2024-04-16)
footnote Full support
Firefox for Android – Full support
Firefox for Android 123 (Release date: 2024-02-20)
footnote Full support
Opera Android – Full support
Opera Android 82 (Release date: 2024-05-02)
footnote Full support
Safari on iOS – Full support
Safari on iOS 17.4 (Release date: 2024-03-05)
footnote Full support
Samsung Internet – Full support
Samsung Internet 27 (Release date: 2024-11-06)
footnote Full support
WebView Android – Full support
WebView Android 124 (Release date: 2024-04-16)
footnote Full support
WebView on iOS – Full support
WebView on iOS 17.4 (Release date: 2024-03-05)
footnote Full support
customElementRegistry
Chrome – Full support
Chrome 146 (Release date: 2026-03-10)
footnote Full support
Edge – Full support
Edge 146 (Release date: 2026-03-13)
footnote Full support
Firefox – No support
Firefox 150 (Release date: 2026-04-21)
footnote , disabled
disabled From version 150 users must explicitly set the dom.scoped-custom-element-registries.enabled preference to true. To change preferences in Firefox, visit about:config.
footnote See bug 2018900
Opera – Full support
Opera 130 (Release date: 2026-04-08)
footnote Full support
Safari – Full support
Safari 26 (Release date: 2025-09-15)
footnote Full support
Chrome Android – Full support
Chrome Android 146 (Release date: 2026-03-10)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Full support
Opera Android 97 (Release date: 2026-04-16)
footnote Full support
Safari on iOS – Full support
Safari on iOS 26 (Release date: 2025-09-15)
footnote Full support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – Full support
WebView Android 146 (Release date: 2026-03-10)
footnote Full support
WebView on iOS – Full support
WebView on iOS 26 (Release date: 2025-09-15)
footnote Full support
delegatesFocus
Chrome – Full support
Chrome 53 (Release date: 2016-08-31)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 94 (Release date: 2021-11-02)
footnote Full support
Opera – Full support
Opera 40 (Release date: 2016-09-20)
footnote Full support
Safari – Full support
Safari 15 (Release date: 2021-09-20)
footnote Full support
Chrome Android – Full support
Chrome Android 53 (Release date: 2016-09-07)
footnote Full support
Firefox for Android – Full support
Firefox for Android 94 (Release date: 2021-11-02)
footnote Full support
Opera Android – Full support
Opera Android 41 (Release date: 2016-10-25)
footnote Full support
Safari on iOS – Full support
Safari on iOS 15 (Release date: 2021-09-20)
footnote Full support
Samsung Internet – Full support
Samsung Internet 6 (Release date: 2017-08-23)
footnote Full support
WebView Android – Full support
WebView Android 53 (Release date: 2016-09-07)
footnote Full support
WebView on iOS – Full support
WebView on iOS 15 (Release date: 2021-09-20)
footnote Full support
elementFromPoint
Non-standard
Chrome – Full support
Chrome 53 (Release date: 2016-08-31)
footnote
footnote Before Chrome 66, this method returned null when the element was a child of a host node. See bug 40537452.
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 63 (Release date: 2018-10-23)
footnote Full support
Opera – Full support
Opera 40 (Release date: 2016-09-20)
footnote
footnote Before Opera 53, this method returned null when the element was a child of a host node. See bug 40537452.
Safari – Full support
Safari 10.1 (Release date: 2017-03-27)
footnote Full support
Chrome Android – Full support
Chrome Android 53 (Release date: 2016-09-07)
footnote
footnote Before Chrome Android 66, this method returned null when the element was a child of a host node. See bug 40537452.
Firefox for Android – Full support
Firefox for Android 63 (Release date: 2018-10-23)
footnote Full support
Opera Android – Full support
Opera Android 41 (Release date: 2016-10-25)
footnote
footnote Before Opera Android 47, this method returned null when the element was a child of a host node. See bug 40537452.
Safari on iOS – Full support
Safari on iOS 10.3 (Release date: 2017-03-27)
footnote Full support
Samsung Internet – Full support
Samsung Internet 6 (Release date: 2017-08-23)
footnote
footnote Before Samsung Internet 9.0, this method returned null when the element was a child of a host node. See bug 40537452.
WebView Android – Full support
WebView Android 53 (Release date: 2016-09-07)
footnote
footnote Before WebView Android 66, this method returned null when the element was a child of a host node. See bug 40537452.
WebView on iOS – Full support
WebView on iOS 10.3 (Release date: 2017-03-27)
footnote Full support
elementsFromPoint
Non-standard
Chrome – Full support
Chrome 53 (Release date: 2016-08-31)
footnote
footnote Before Chrome 66, this method returned null when the element was a child of a host node. See bug 40537452.
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 63 (Release date: 2018-10-23)
footnote Full support
Opera – Full support
Opera 40 (Release date: 2016-09-20)
footnote Full support
Safari – Full support
Safari 11.1 (Release date: 2018-04-12)
footnote Full support
Chrome Android – Full support
Chrome Android 53 (Release date: 2016-09-07)
footnote
footnote Before Chrome Android 66, this method returned null when the element was a child of a host node. See bug 40537452.
Firefox for Android – Full support
Firefox for Android 63 (Release date: 2018-10-23)
footnote Full support
Opera Android – Full support
Opera Android 41 (Release date: 2016-10-25)
footnote Full support
Safari on iOS – Full support
Safari on iOS 11.3 (Release date: 2018-03-29)
footnote Full support
Samsung Internet – Full support
Samsung Internet 6 (Release date: 2017-08-23)
footnote
footnote Before Samsung Internet 9.0, this method returned null when the element was a child of a host node. See bug 40537452.
WebView Android – Full support
WebView Android 53 (Release date: 2016-09-07)
footnote
footnote Before WebView Android 66, this method returned null when the element was a child of a host node. See bug 40537452.
WebView on iOS – Full support
WebView on iOS 11.3 (Release date: 2018-03-29)
footnote Full support
fullscreenElement
Chrome – Full support
Chrome 71 (Release date: 2018-12-04)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 63 (Release date: 2018-10-23)
altname
altname Alternate name: mozFullScreenElement
Firefox – Full support
Firefox 64 (Release date: 2018-12-11)
footnote Full support
Opera – Full support
Opera 58 (Release date: 2019-01-23)
footnote Full support
Safari – Full support
Safari 16.4 (Release date: 2023-03-27)
footnote Full support
Chrome Android – Full support
Chrome Android 71 (Release date: 2018-12-04)
footnote Full support
Firefox for Android – Full support
Firefox for Android 63 (Release date: 2018-10-23)
altname
altname Alternate name: mozFullScreenElement
Firefox for Android – Full support
Firefox for Android 64 (Release date: 2018-12-11)
footnote Full support
Opera Android – Full support
Opera Android 50 (Release date: 2019-02-18)
footnote Full support
Safari on iOS – Partial support
Safari on iOS 16.4 (Release date: 2023-03-27)
footnote Partial support
footnote Only available on iPad, not on iPhone.
footnote Shows an overlay button which can not be disabled. Swiping down exits fullscreen mode, making it unsuitable for some use cases like games.
Samsung Internet – Full support
Samsung Internet 10 (Release date: 2019-08-22)
footnote Full support
WebView Android – Full support
WebView Android 71 (Release date: 2018-12-04)
footnote Full support
WebView on iOS – Partial support
WebView on iOS 16.4 (Release date: 2023-03-27)
footnote Partial support
footnote Only available on iPad, not on iPhone.
footnote Shows an overlay button which can not be disabled. Swiping down exits fullscreen mode, making it unsuitable for some use cases like games.
getAnimations
Chrome – Full support
Chrome 84 (Release date: 2020-07-27)
footnote Full support
Edge – Full support
Edge 84 (Release date: 2020-07-16)
footnote Full support
Firefox – Full support
Firefox 75 (Release date: 2020-04-07)
footnote Full support
Opera – Full support
Opera 70 (Release date: 2020-07-27)
footnote Full support
Safari – Full support
Safari 14 (Release date: 2020-09-16)
footnote Full support
Chrome Android – Full support
Chrome Android 84 (Release date: 2020-07-27)
footnote Full support
Firefox for Android – Full support
Firefox for Android 79 (Release date: 2020-07-28)
footnote Full support
Opera Android – Full support
Opera Android 60 (Release date: 2020-09-23)
footnote Full support
Safari on iOS – Full support
Safari on iOS 14 (Release date: 2020-09-16)
footnote Full support
Samsung Internet – Full support
Samsung Internet 14 (Release date: 2021-04-17)
footnote Full support
WebView Android – Full support
WebView Android 84 (Release date: 2020-07-27)
footnote Full support
WebView on iOS – Full support
WebView on iOS 14 (Release date: 2020-09-16)
footnote Full support
getHTML
Chrome – Full support
Chrome 125 (Release date: 2024-05-14)
footnote Full support
Edge – Full support
Edge 125 (Release date: 2024-05-17)
footnote Full support
Firefox – Full support
Firefox 128 (Release date: 2024-07-09)
footnote Full support
Opera – Full support
Opera 111 (Release date: 2024-06-12)
footnote Full support
Safari – Full support
Safari 18 (Release date: 2024-09-16)
footnote Full support
Chrome Android – Full support
Chrome Android 125 (Release date: 2024-05-14)
footnote Full support
Firefox for Android – Full support
Firefox for Android 128 (Release date: 2024-07-09)
footnote Full support
Opera Android – Full support
Opera Android 83 (Release date: 2024-06-25)
footnote Full support
Safari on iOS – Full support
Safari on iOS 18 (Release date: 2024-09-16)
footnote Full support
Samsung Internet – Full support
Samsung Internet 27 (Release date: 2024-11-06)
footnote Full support
WebView Android – Full support
WebView Android 125 (Release date: 2024-05-14)
footnote Full support
WebView on iOS – Full support
WebView on iOS 18 (Release date: 2024-09-16)
footnote Full support
Serializes < and > in attributes as &lt; and &gt; (see this spec issue)
Non-standard
Chrome – Full support
Chrome 138 (Release date: 2025-06-24)
footnote Full support
Edge – Full support
Edge 138 (Release date: 2025-06-26)
footnote Full support
Firefox – Full support
Firefox 140 (Release date: 2025-06-24)
footnote Full support
Opera – Full support
Opera 122 (Release date: 2025-09-11)
footnote Full support
Safari – Full support
Safari 26 (Release date: 2025-09-15)
footnote Full support
Chrome Android – Full support
Chrome Android 138 (Release date: 2025-06-24)
footnote Full support
Firefox for Android – Full support
Firefox for Android 140 (Release date: 2025-06-24)
footnote Full support
Opera Android – Full support
Opera Android 91 (Release date: 2025-08-19)
footnote Full support
Safari on iOS – Full support
Safari on iOS 26 (Release date: 2025-09-15)
footnote Full support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – Full support
WebView Android 138 (Release date: 2025-06-24)
footnote Full support
WebView on iOS – Full support
WebView on iOS 26 (Release date: 2025-09-15)
footnote Full support
getSelection
Non-standard
Chrome – Full support
Chrome 53 (Release date: 2016-08-31)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 40 (Release date: 2016-09-20)
footnote Full support
Safari – No support
Safari
footnote No support
Chrome Android – Full support
Chrome Android 53 (Release date: 2016-09-07)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Full support
Opera Android 41 (Release date: 2016-10-25)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – Full support
Samsung Internet 6 (Release date: 2017-08-23)
footnote Full support
WebView Android – Full support
WebView Android 53 (Release date: 2016-09-07)
footnote Full support
WebView on iOS – No support
WebView on iOS
footnote No support
host
Chrome – Full support
Chrome 53 (Release date: 2016-08-31)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 63 (Release date: 2018-10-23)
footnote Full support
Opera – Full support
Opera 40 (Release date: 2016-09-20)
footnote Full support
Safari – Full support
Safari 10 (Release date: 2016-09-20)
footnote Full support
Chrome Android – Full support
Chrome Android 53 (Release date: 2016-09-07)
footnote Full support
Firefox for Android – Full support
Firefox for Android 63 (Release date: 2018-10-23)
footnote Full support
Opera Android – Full support
Opera Android 41 (Release date: 2016-10-25)
footnote Full support
Safari on iOS – Full support
Safari on iOS 10 (Release date: 2016-09-13)
footnote Full support
Samsung Internet – Full support
Samsung Internet 6 (Release date: 2017-08-23)
footnote Full support
WebView Android – Full support
WebView Android 53 (Release date: 2016-09-07)
footnote Full support
WebView on iOS – Full support
WebView on iOS 10 (Release date: 2016-09-13)
footnote Full support
innerHTML
Chrome – Full support
Chrome 53 (Release date: 2016-08-31)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 63 (Release date: 2018-10-23)
footnote Full support
Opera – Full support
Opera 40 (Release date: 2016-09-20)
footnote Full support
Safari – Full support
Safari 10 (Release date: 2016-09-20)
footnote Full support
Chrome Android – Full support
Chrome Android 53 (Release date: 2016-09-07)
footnote Full support
Firefox for Android – Full support
Firefox for Android 63 (Release date: 2018-10-23)
footnote Full support
Opera Android – Full support
Opera Android 41 (Release date: 2016-10-25)
footnote Full support
Safari on iOS – Full support
Safari on iOS 10 (Release date: 2016-09-13)
footnote Full support
Samsung Internet – Full support
Samsung Internet 6 (Release date: 2017-08-23)
footnote Full support
WebView Android – Full support
WebView Android 53 (Release date: 2016-09-07)
footnote Full support
WebView on iOS – Full support
WebView on iOS 10 (Release date: 2016-09-13)
footnote Full support
Requires TrustedHTML instance when trusted types are enforced
Chrome – Full support
Chrome 83 (Release date: 2020-05-19)
footnote Full support
Edge – Full support
Edge 83 (Release date: 2020-05-21)
footnote Full support
Firefox – Full support
Firefox 148 (Release date: 2026-02-24)
footnote Full support
Opera – Full support
Opera 69 (Release date: 2020-06-24)
footnote Full support
Safari – Full support
Safari 26 (Release date: 2025-09-15)
footnote Full support
Chrome Android – Full support
Chrome Android 83 (Release date: 2020-05-19)
footnote Full support
Firefox for Android – Full support
Firefox for Android 148 (Release date: 2026-02-24)
footnote Full support
Opera Android – Full support
Opera Android 59 (Release date: 2020-06-30)
footnote Full support
Safari on iOS – Full support
Safari on iOS 26 (Release date: 2025-09-15)
footnote Full support
Samsung Internet – Full support
Samsung Internet 13 (Release date: 2020-12-02)
footnote Full support
WebView Android – Full support
WebView Android 83 (Release date: 2020-05-19)
footnote Full support
WebView on iOS – Full support
WebView on iOS 26 (Release date: 2025-09-15)
footnote Full support
Serializes < and > in attributes as &lt; and &gt; (see this spec issue)
Non-standard
Chrome – Full support
Chrome 138 (Release date: 2025-06-24)
footnote Full support
Edge – Full support
Edge 138 (Release date: 2025-06-26)
footnote Full support
Firefox – Full support
Firefox 140 (Release date: 2025-06-24)
footnote Full support
Opera – Full support
Opera 122 (Release date: 2025-09-11)
footnote Full support
Safari – Full support
Safari 26 (Release date: 2025-09-15)
footnote Full support
Chrome Android – Full support
Chrome Android 138 (Release date: 2025-06-24)
footnote Full support
Firefox for Android – Full support
Firefox for Android 140 (Release date: 2025-06-24)
footnote Full support
Opera Android – Full support
Opera Android 91 (Release date: 2025-08-19)
footnote Full support
Safari on iOS – Full support
Safari on iOS 26 (Release date: 2025-09-15)
footnote Full support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – Full support
WebView Android 138 (Release date: 2025-06-24)
footnote Full support
WebView on iOS – Full support
WebView on iOS 26 (Release date: 2025-09-15)
footnote Full support
mode
Chrome – Full support
Chrome 53 (Release date: 2016-08-31)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 63 (Release date: 2018-10-23)
footnote Full support
Opera – Full support
Opera 40 (Release date: 2016-09-20)
footnote Full support
Safari – Full support
Safari 10.1 (Release date: 2017-03-27)
footnote Full support
Chrome Android – Full support
Chrome Android 53 (Release date: 2016-09-07)
footnote Full support
Firefox for Android – Full support
Firefox for Android 63 (Release date: 2018-10-23)
footnote Full support
Opera Android – Full support
Opera Android 41 (Release date: 2016-10-25)
footnote Full support
Safari on iOS – Full support
Safari on iOS 10.3 (Release date: 2017-03-27)
footnote Full support
Samsung Internet – Full support
Samsung Internet 6 (Release date: 2017-08-23)
footnote Full support
WebView Android – Full support
WebView Android 53 (Release date: 2016-09-07)
footnote Full support
WebView on iOS – Full support
WebView on iOS 10.3 (Release date: 2017-03-27)
footnote Full support
pictureInPictureElement
Chrome – Full support
Chrome 69 (Release date: 2018-09-04)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – No support
Firefox
footnote
footnote See bug 1463402
Opera – Full support
Opera 56 (Release date: 2018-09-25)
footnote Full support
Safari – Full support
Safari 13.1 (Release date: 2020-03-24)
footnote Full support
Chrome Android – Full support
Chrome Android 105 (Release date: 2022-09-02)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote
footnote See bug 1463402
Opera Android – Full support
Opera Android 72 (Release date: 2022-10-21)
footnote Full support
Safari on iOS – Full support
Safari on iOS 13.4 (Release date: 2020-03-24)
footnote Full support
Samsung Internet – Full support
Samsung Internet 20 (Release date: 2023-02-10)
footnote Full support
WebView Android – Full support
WebView Android 105 (Release date: 2022-09-02)
footnote Full support
WebView on iOS – Full support
WebView on iOS 13.4 (Release date: 2020-03-24)
footnote Full support
pointerLockElement
Chrome – Full support
Chrome 53 (Release date: 2016-08-31)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 63 (Release date: 2018-10-23)
footnote Full support
Opera – Full support
Opera 40 (Release date: 2016-09-20)
footnote Full support
Safari – Full support
Safari 10.1 (Release date: 2017-03-27)
footnote Full support
Chrome Android – No support
Chrome Android
footnote
footnote See bug 40290045
Firefox for Android – Full support
Firefox for Android 63 (Release date: 2018-10-23)
footnote Full support
Opera Android – No support
Opera Android
footnote
footnote See bug 40290045
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – No support
Samsung Internet
footnote
footnote See bug 40290045
WebView Android – No support
WebView Android
footnote
footnote See bug 40290045
WebView on iOS – No support
WebView on iOS
footnote No support
referenceTarget
Experimental Non-standard
Chrome – No support
Chrome 133 (Release date: 2025-02-04)
disabled
disabled From version 133 users must explicitly set the #enable-experimental-web-platform-features preference to true. To change preferences in Chrome, visit chrome://flags.
Edge – No support
Edge 133 (Release date: 2025-02-06)
disabled
disabled From version 133 users must explicitly set the #enable-experimental-web-platform-features preference to true. To change preferences in Edge, visit about:flags.
Firefox – No support
Firefox 144 (Release date: 2025-10-14)
disabled
disabled From version 144 users must explicitly set the dom.shadowdom.referenceTarget.enabled preference to true. To change preferences in Firefox, visit about:config.
Opera – No support
Opera 118 (Release date: 2025-04-15)
disabled
disabled From version 118 users must explicitly set the #enable-experimental-web-platform-features preference to true. To change preferences in Opera, visit opera://flags.
Safari – No support
Safari 26 (Release date: 2025-09-15)
disabled
disabled From version 26 users must explicitly set the referenceTarget preference to true.
disabled From version 26 users must explicitly set the referenceTarget support for aria-owns preference to true.
Chrome Android – No support
Chrome Android 133 (Release date: 2025-02-04)
disabled
disabled From version 133 users must explicitly set the #enable-experimental-web-platform-features preference to true. To change preferences in Chrome Android, visit chrome://flags.
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – No support
Safari on iOS 26 (Release date: 2025-09-15)
disabled
disabled From version 26 users must explicitly set the referenceTarget preference to true.
disabled From version 26 users must explicitly set the referenceTarget support for aria-owns preference to true.
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – No support
WebView on iOS
footnote No support
serializable
Chrome – Full support
Chrome 125 (Release date: 2024-05-14)
footnote Full support
Edge – Full support
Edge 125 (Release date: 2024-05-17)
footnote Full support
Firefox – Full support
Firefox 128 (Release date: 2024-07-09)
footnote Full support
Opera – Full support
Opera 111 (Release date: 2024-06-12)
footnote Full support
Safari – Full support
Safari 18 (Release date: 2024-09-16)
footnote Full support
Chrome Android – Full support
Chrome Android 125 (Release date: 2024-05-14)
footnote Full support
Firefox for Android – Full support
Firefox for Android 128 (Release date: 2024-07-09)
footnote Full support
Opera Android – Full support
Opera Android 83 (Release date: 2024-06-25)
footnote Full support
Safari on iOS – Full support
Safari on iOS 18 (Release date: 2024-09-16)
footnote Full support
Samsung Internet – Full support
Samsung Internet 27 (Release date: 2024-11-06)
footnote Full support
WebView Android – Full support
WebView Android 125 (Release date: 2024-05-14)
footnote Full support
WebView on iOS – Full support
WebView on iOS 18 (Release date: 2024-09-16)
footnote Full support
setHTML
Experimental
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – Full support
Firefox 148 (Release date: 2026-02-24)
footnote Full support
Opera – No support
Opera
footnote No support
Safari – No support
Safari
footnote No support
Chrome Android – No support
Chrome Android
footnote No support
Firefox for Android – Full support
Firefox for Android 148 (Release date: 2026-02-24)
footnote Full support
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – No support
WebView on iOS
footnote No support
setHTMLUnsafe
Chrome – Full support
Chrome 124 (Release date: 2024-04-16)
footnote Full support
Edge – Full support
Edge 124 (Release date: 2024-04-18)
footnote Full support
Firefox – Full support
Firefox 123 (Release date: 2024-02-20)
footnote Full support
Opera – Full support
Opera 110 (Release date: 2024-05-14)
footnote Full support
Safari – Partial support
Safari 17.4 – 18.6 (Release date: 2024-03-05)
footnote Partial support
footnote If there are custom elements in a declarative shadow root in the parsed HTML, then the elements' constructors and connectedCallback() methods are not called (bug 296420).
Safari – Full support
Safari 26 (Release date: 2025-09-15)
footnote Full support
Chrome Android – Full support
Chrome Android 124 (Release date: 2024-04-16)
footnote Full support
Firefox for Android – Full support
Firefox for Android 123 (Release date: 2024-02-20)
footnote Full support
Opera Android – Full support
Opera Android 82 (Release date: 2024-05-02)
footnote Full support
Safari on iOS – Partial support
Safari on iOS 17.4 – 18.6 (Release date: 2024-03-05)
footnote Partial support
footnote If there are custom elements in a declarative shadow root in the parsed HTML, then the elements' constructors and connectedCallback() methods are not called (bug 296420).
Safari on iOS – Full support
Safari on iOS 26 (Release date: 2025-09-15)
footnote Full support
Samsung Internet – Full support
Samsung Internet 27 (Release date: 2024-11-06)
footnote Full support
WebView Android – Full support
WebView Android 124 (Release date: 2024-04-16)
footnote Full support
WebView on iOS – Partial support
WebView on iOS 17.4 – 18.6 (Release date: 2024-03-05)
footnote Partial support
footnote If there are custom elements in a declarative shadow root in the parsed HTML, then the elements' constructors and connectedCallback() methods are not called (bug 296420).
WebView on iOS – Full support
WebView on iOS 26 (Release date: 2025-09-15)
footnote Full support
Requires TrustedHTML instance when trusted types are enforced
Chrome – Full support
Chrome 124 (Release date: 2024-04-16)
footnote Full support
Edge – Full support
Edge 124 (Release date: 2024-04-18)
footnote Full support
Firefox – Full support
Firefox 148 (Release date: 2026-02-24)
footnote Full support
Opera – Full support
Opera 110 (Release date: 2024-05-14)
footnote Full support
Safari – Full support
Safari 26 (Release date: 2025-09-15)
footnote Full support
Chrome Android – Full support
Chrome Android 124 (Release date: 2024-04-16)
footnote Full support
Firefox for Android – Full support
Firefox for Android 148 (Release date: 2026-02-24)
footnote Full support
Opera Android – Full support
Opera Android 82 (Release date: 2024-05-02)
footnote Full support
Safari on iOS – Full support
Safari on iOS 26 (Release date: 2025-09-15)
footnote Full support
Samsung Internet – Full support
Samsung Internet 27 (Release date: 2024-11-06)
footnote Full support
WebView Android – Full support
WebView Android 124 (Release date: 2024-04-16)
footnote Full support
WebView on iOS – Full support
WebView on iOS 26 (Release date: 2025-09-15)
footnote Full support
options.sanitizer parameter
Experimental
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – Preview support
Firefox Nightly
footnote Preview browser support
Opera – No support
Opera
footnote No support
Safari – No support
Safari
footnote No support
Chrome Android – No support
Chrome Android
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – No support
WebView on iOS
footnote No support
slotAssignment
Chrome – Full support
Chrome 86 (Release date: 2020-10-20)
footnote Full support
Edge – Full support
Edge 86 (Release date: 2020-10-09)
footnote Full support
Firefox – Full support
Firefox 92 (Release date: 2021-09-07)
footnote Full support
Opera – Full support
Opera 72 (Release date: 2020-10-21)
footnote Full support
Safari – Full support
Safari 16.4 (Release date: 2023-03-27)
footnote Full support
Chrome Android – Full support
Chrome Android 86 (Release date: 2020-10-20)
footnote Full support
Firefox for Android – Full support
Firefox for Android 92 (Release date: 2021-09-07)
footnote Full support
Opera Android – Full support
Opera Android 61 (Release date: 2020-12-07)
footnote Full support
Safari on iOS – Full support
Safari on iOS 16.4 (Release date: 2023-03-27)
footnote Full support
Samsung Internet – Full support
Samsung Internet 14 (Release date: 2021-04-17)
footnote Full support
WebView Android – Full support
WebView Android 86 (Release date: 2020-10-20)
footnote Full support
WebView on iOS – Full support
WebView on iOS 16.4 (Release date: 2023-03-27)
footnote Full support
styleSheets
Chrome – Full support
Chrome 53 (Release date: 2016-08-31)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 63 (Release date: 2018-10-23)
footnote Full support
Opera – Full support
Opera 40 (Release date: 2016-09-20)
footnote Full support
Safari – Full support
Safari 12.1 (Release date: 2019-03-25)
footnote Full support
Chrome Android – Full support
Chrome Android 53 (Release date: 2016-09-07)
footnote Full support
Firefox for Android – Full support
Firefox for Android 63 (Release date: 2018-10-23)
footnote Full support
Opera Android – Full support
Opera Android 41 (Release date: 2016-10-25)
footnote Full support
Safari on iOS – Full support
Safari on iOS 12.2 (Release date: 2019-03-25)
footnote Full support
Samsung Internet – Full support
Samsung Internet 6 (Release date: 2017-08-23)
footnote Full support
WebView Android – Full support
WebView Android 53 (Release date: 2016-09-07)
footnote Full support
WebView on iOS – Full support
WebView on iOS 12.2 (Release date: 2019-03-25)
footnote Full support

Legend

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

Full support
Full support
Partial support
Partial support
In development. Supported in a pre-release version.
In development. Supported in a pre-release version.
No support
No support
Experimental. Expect behavior to change in the future.
Non-standard. Check cross-browser support before using.
See implementation notes.
User must explicitly enable this feature.
Uses a non-standard name
Has more compatibility info.

See also