W3cubDocs

/DOM

DocumentOrShadowRoot

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 CompatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support 53 Yes Yes Yes 40 Yes
activeElement 53 Yes Yes Yes 40 Yes
adoptedStyleSheets 53 Yes Yes Yes 40 Yes
caretPositionFromPoint No Yes Yes Yes No Yes
elementFromPoint 53 Yes Yes Yes 40 Yes
elementsFromPoint 53 Yes Yes Yes 40 Yes
fullscreenElement 53
Prefixed
53
Prefixed
Prefixed Requires the vendor prefix: webkit
Yes
Prefixed
Yes
Prefixed
Prefixed Requires the vendor prefix: webkit
64
64
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.
9
Uses the non-standard name: mozFullScreenElement
Yes
Prefixed
Yes
Prefixed
Prefixed Requires the vendor prefix: ms
40
Prefixed
40
Prefixed
Prefixed Requires the vendor prefix: webkit
Yes
Prefixed
Yes
Prefixed
Prefixed Requires the vendor prefix: webkit
getSelection 53 Yes Yes Yes 40 Yes
pointerLockElement 53 Yes Yes Yes 40 Yes
styleSheets 53 Yes Yes Yes 40 Yes
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support 53 53 Yes Yes 40 Yes 6.0
activeElement 53 53 Yes Yes 40 Yes 6.0
adoptedStyleSheets 53 53 Yes Yes 40 Yes 6.0
caretPositionFromPoint No No Yes Yes No Yes No
elementFromPoint 53 53 Yes Yes 40 Yes 6.0
elementsFromPoint 53 53 Yes Yes 40 Yes 6.0
fullscreenElement 53
Prefixed
53
Prefixed
Prefixed Requires the vendor prefix: webkit
53
Prefixed
53
Prefixed
Prefixed Requires the vendor prefix: webkit
Yes
Prefixed
Yes
Prefixed
Prefixed Requires the vendor prefix: webkit
64
64
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.
9
Uses the non-standard name: mozFullScreenElement
40
Prefixed
40
Prefixed
Prefixed Requires the vendor prefix: webkit
Yes
Prefixed
Yes
Prefixed
Prefixed Requires the vendor prefix: webkit
6.0
Prefixed
6.0
Prefixed
Prefixed Requires the vendor prefix: webkit
getSelection 53 53 Yes Yes 40 Yes 6.0
pointerLockElement 53 53 Yes Yes 40 Yes 6.0
styleSheets 53 53 Yes Yes 40 Yes 6.0

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

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/DocumentOrShadowRoot