This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

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.


DocumentOrShadowRoot.activeElement Read only
Returns the Element within the shadow tree that has focus.
Document.fullscreenElement Read only
Returns the Element that's currently in full screen mode for this document.
Document.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.styleSheets Read only
Returns a StyleSheetList of CSSStyleSheet objects for stylesheets explicitly linked into, or embedded in a document.


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


Specification Status Comment
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

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support53 Yes Yes Yes40 Yes
activeElement53 Yes Yes Yes40 Yes
styleSheets53 Yes Yes Yes40 Yes
getSelection53 Yes Yes Yes40 Yes
elementFromPoint53 Yes Yes Yes40 Yes
elementsFromPoint53 Yes Yes Yes40 Yes
caretPositionFromPoint No Yes Yes Yes No Yes
pointerLockElement53 Yes Yes Yes40 Yes
fullscreenElement531 Yes2



Yes40 Yes
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support5353 Yes Yes40 Yes6.0
activeElement5353 Yes Yes40 Yes6.0
styleSheets5353 Yes Yes40 Yes6.0
getSelection5353 Yes Yes40 Yes6.0
elementFromPoint5353 Yes Yes40 Yes6.0
elementsFromPoint5353 Yes Yes40 Yes6.0
caretPositionFromPoint No No Yes Yes No Yes No
pointerLockElement5353 Yes Yes40 Yes6.0
fullscreenElement5353 Yes



40 Yes6.0

1. Supported as webkitFullscreenElement.

2. Supported as msFullscreenElement.

3. Supported as mozFullScreenElement.

4. 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.

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

Document Tags and Contributors

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