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
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. null if lock is pending, 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.
Working Draft 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
caretPositionFromPoint53 Yes Yes Yes40 Yes
pointerLockElement53 Yes Yes Yes40 Yes
fullscreenElement53 Yes Yes Yes40 Yes
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support5353 Yes Yes40 Yes ?
activeElement5353 Yes Yes40 Yes ?
styleSheets5353 Yes Yes40 Yes ?
getSelection5353 Yes Yes40 Yes ?
elementFromPoint5353 Yes Yes40 Yes ?
elementsFromPoint5353 Yes Yes40 Yes ?
caretPositionFromPoint5353 Yes Yes40 Yes ?
pointerLockElement5353 Yes Yes40 Yes ?
fullscreenElement5353 Yes Yes40 Yes ?

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

Document Tags and Contributors

 Contributors to this page: ExE_Boss, chrisdavidmills, iainreid629, bunnybooboo, jpmedley
 Last updated by: ExE_Boss,