The DocumentOrShadowRoot mixin of the Shadow DOM API provides APIs that are shared between documents and shadow roots. The following features are included in both Document and ShadowRoot.

Properties

DocumentOrShadowRoot.activeElementRead only
Returns the Element within the shadow tree that has focus.
DocumentOrShadowRoot.fullscreenElementRead only
Returns the Element that's currently in full screen mode for this document.
DocumentOrShadowRoot.pointerLockElement  Read only
Returns the element set as the target for mouse events while the pointer is locked. It returns null if lock is pending, the pointer is unlocked, or if the target is in another document.
DocumentOrShadowRoot.styleSheetsRead only
Returns a StyleSheetList of CSSStyleSheet objects for stylesheets explicitly linked into, or embedded in a document.

Methods

DocumentOrShadowRoot.getSelection()
Returns a Selection object representing the range of text selected by the user, or the current position of the caret.
DocumentOrShadowRoot.elementFromPoint()
Returns the topmost element at the specified coordinates.
DocumentOrShadowRoot.elementsFromPoint()
Returns an array of all elements at the specified coordinates.
DocumentOrShadowRoot.caretPositionFromPoint()
Returns a CaretPosition object containing the DOM node containing the caret, and caret's character offset within that node.

Specifications

Specification Status Comment
DOM
The definition of 'DocumentOrShadowRoot' in that specification.
Living Standard Initial definition.
Shadow DOM
The definition of 'DocumentOrShadowRoot' in that specification.
Obsolete Implementation in Shadow DOM.

Browser Compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic support
Experimental
Chrome Full support 53Edge Full support YesFirefox Full support YesIE Full support YesOpera Full support 40Safari Full support YesWebView Android Full support 53Chrome Android Full support 53Edge Mobile Full support YesFirefox Android Full support YesOpera Android Full support 40Safari iOS Full support YesSamsung Internet Android Full support 6.0
activeElement
Experimental
Chrome Full support 53Edge Full support YesFirefox Full support YesIE Full support YesOpera Full support 40Safari Full support YesWebView Android Full support 53Chrome Android Full support 53Edge Mobile Full support YesFirefox Android Full support YesOpera Android Full support 40Safari iOS Full support YesSamsung Internet Android Full support 6.0
adoptedStyleSheets
Experimental
Chrome Full support 53Edge Full support YesFirefox Full support YesIE Full support YesOpera Full support 40Safari Full support YesWebView Android Full support 53Chrome Android Full support 53Edge Mobile Full support YesFirefox Android Full support YesOpera Android Full support 40Safari iOS Full support YesSamsung Internet Android Full support 6.0
caretPositionFromPoint
Experimental
Chrome No support NoEdge Full support YesFirefox Full support YesIE Full support YesOpera No support NoSafari Full support YesWebView Android No support NoChrome Android No support NoEdge Mobile Full support YesFirefox Android Full support YesOpera Android No support NoSafari iOS Full support YesSamsung Internet Android No support No
elementFromPoint
Experimental
Chrome Full support 53Edge Full support YesFirefox Full support YesIE Full support YesOpera Full support 40Safari Full support YesWebView Android Full support 53Chrome Android Full support 53Edge Mobile Full support YesFirefox Android Full support YesOpera Android Full support 40Safari iOS Full support YesSamsung Internet Android Full support 6.0
elementsFromPoint
Experimental
Chrome Full support 53Edge Full support YesFirefox Full support YesIE Full support YesOpera Full support 40Safari Full support YesWebView Android Full support 53Chrome Android Full support 53Edge Mobile Full support YesFirefox Android Full support YesOpera Android Full support 40Safari iOS Full support YesSamsung Internet Android Full support 6.0
fullscreenElementChrome Full support 53
Prefixed
Full support 53
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Full support Yes
Prefixed
Full support Yes
Prefixed
Prefixed Requires the vendor prefix: webkit
Firefox Full support 64
Full support 64
Full support 47
Disabled
Disabled From version 47: this feature is behind the full-screen-api.unprefix.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
Full support 9
Alternate Name
Alternate Name Uses the non-standard name: mozFullScreenElement
IE Full support Yes
Prefixed
Full support Yes
Prefixed
Prefixed Requires the vendor prefix: ms
Opera Full support 40
Prefixed
Full support 40
Prefixed
Prefixed Requires the vendor prefix: webkit
Safari Full support Yes
Prefixed
Full support Yes
Prefixed
Prefixed Requires the vendor prefix: webkit
WebView Android Full support 53
Prefixed
Full support 53
Prefixed
Prefixed Requires the vendor prefix: webkit
Chrome Android Full support 53
Prefixed
Full support 53
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Mobile Full support Yes
Prefixed
Full support Yes
Prefixed
Prefixed Requires the vendor prefix: webkit
Firefox Android Full support 64
Full support 64
Full support 47
Disabled
Disabled From version 47: this feature is behind the full-screen-api.unprefix.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
Full support 9
Alternate Name
Alternate Name Uses the non-standard name: mozFullScreenElement
Opera Android Full support 40
Prefixed
Full support 40
Prefixed
Prefixed Requires the vendor prefix: webkit
Safari iOS Full support Yes
Prefixed
Full support Yes
Prefixed
Prefixed Requires the vendor prefix: webkit
Samsung Internet Android Full support 6.0
Prefixed
Full support 6.0
Prefixed
Prefixed Requires the vendor prefix: webkit
getSelection
Experimental
Chrome Full support 53Edge Full support YesFirefox Full support YesIE Full support YesOpera Full support 40Safari Full support YesWebView Android Full support 53Chrome Android Full support 53Edge Mobile Full support YesFirefox Android Full support YesOpera Android Full support 40Safari iOS Full support YesSamsung Internet Android Full support 6.0
pointerLockElement
Experimental
Chrome Full support 53Edge Full support YesFirefox Full support YesIE Full support YesOpera Full support 40Safari Full support YesWebView Android Full support 53Chrome Android Full support 53Edge Mobile Full support YesFirefox Android Full support YesOpera Android Full support 40Safari iOS Full support YesSamsung Internet Android Full support 6.0
styleSheets
Experimental
Chrome Full support 53Edge Full support YesFirefox Full support YesIE Full support YesOpera Full support 40Safari Full support YesWebView Android Full support 53Chrome Android Full support 53Edge Mobile Full support YesFirefox Android Full support YesOpera Android Full support 40Safari iOS Full support YesSamsung Internet Android Full support 6.0

Legend

Full support  
Full support
No support  
No support
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.
User must explicitly enable this feature.
User must explicitly enable this feature.
Uses a non-standard name.
Uses a non-standard name.
Requires a vendor prefix or different name for use.
Requires a vendor prefix or different name for use.

[1] This interface's features are still implemented on the Document object.

Document Tags and Contributors

Contributors to this page: Sheppy, ExE-Boss, jpmedley, chrisdavidmills, iainreid629, david_ross
Last updated by: Sheppy,