Element.createShadowRoot()

Draft
This page is not complete.

Deprecated
This feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. Avoid using it and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

Use Element.createShadowRoot to create an instance of shadow DOM. When shadow DOM is created, it is always attached to an existing element. After the shadow DOM is created, the element that it is attached to is called the shadow root.

This method has been deprecated in favor of attachShadow.

Syntax

var shadowroot = element.createShadowRoot(); 

Parameters

No parameters.

Result value

Returns a ShadowRoot.

Specifications

This feature is no longer defined by any specifications.

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support

351

25 —? webkit

No

59 — 612

29 — 593

No

224

15 —? webkit

No
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support

351

25 —? webkit

351

25 —? webkit

No

59 — 612

29 — 593

224

14 —? webkit

No

5.0

4.0 —? webkit

1. In Chrome 45, the ability to have multiple shadow roots was deprecated.

2. From version 59 until version 61 (exclusive): this feature is behind the dom.webcomponents.shadowdom.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.

3. From version 29 until version 59 (exclusive): this feature is behind the dom.webcomponents.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.

4. In Opera 32, the ability to have multiple shadow roots was deprecated.

Document Tags and Contributors

Contributors to this page: ExE-Boss, DomenicDenicola, Keysox, japacible, jpmedley, markg, Sebastianz
Last updated by: ExE-Boss,