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.activeElement
Read only- Returns the
Element
within the shadow tree that has focus. DocumentOrShadowRoot.fullscreenElement
Read only- Returns the
Element
that's currently in full screen mode for this document. DocumentOrShadowRoot.pictureInPictureElement
Read only- Returns the
HTMLVideoElement
that's currently in picture-in-picture 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.styleSheets
Read only- Returns a
StyleSheetList
ofCSSStyleSheet
objects for stylesheets explicitly linked into, or embedded in a document.
Methods
DocumentOrShadowRoot.caretPositionFromPoint()
- Returns a
CaretPosition
object containing the DOM node containing the caret, and caret's character offset within that node. DocumentOrShadowRoot.elementFromPoint()
- Returns the topmost element at the specified coordinates.
DocumentOrShadowRoot.elementsFromPoint()
- Returns an array of all elements at the specified coordinates.
DocumentOrShadowRoot.getAnimations()
'- Returns an array of all
Animation
objects currently in effect, whose target elements are descendants of thedocument
DocumentOrShadowRoot.getSelection()
- Returns a
Selection
object representing the range of text selected by the user, or the current position of the caret. DocumentOrShadowRoot.nodeFromPoint()
'- Returns the topmost node at the specified coordinates.
DocumentOrShadowRoot.nodesFromPoint()
'- Returns an array of all nodes at the specified coordinates.
Specifications
Specification | Status | Comment |
---|---|---|
Shadow DOMThe definition of 'DocumentOrShadowRoot' in that specification. | Obsolete | Implementation in Shadow DOM. |
DOMThe definition of 'DocumentOrShadowRoot' in that specification. | Living Standard | Initial definition. |
Browser compatibility
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Chrome
Full support 53 |
Edge
Full support 12 |
Firefox
Full support Yes |
IE
Full support Yes |
Opera
Full support 40 |
Safari
Full support Yes |
WebView Android
Full support 53 |
Chrome Android
Full support 53 |
Firefox Android
Full support Yes |
Opera Android
Full support 41 |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support 6.0 |
Chrome
Full support 53 |
Edge
Full support 12 |
Firefox
Full support 63 |
IE
Full support 4 |
Opera
Full support 40 |
Safari
Full support 4 |
WebView Android
Full support 53 |
Chrome Android
Full support 53 |
Firefox Android
Full support 63 |
Opera Android
Full support 41 |
Safari iOS
Full support 3.2 |
Samsung Internet Android
Full support 6.0 | |
Chrome
Full support 73 |
Edge
Full support 79 |
Firefox
No support No |
IE
No support No |
Opera
Full support 60 |
Safari
No support No |
WebView Android
Full support 73 |
Chrome Android
Full support 73 |
Firefox Android
No support No |
Opera Android
Full support 50 |
Safari iOS
No support No |
Samsung Internet Android
Full support 11.0 | |
Chrome
No support No |
Edge
No support No |
Firefox
Full support 20 |
IE
No support No |
Opera
No support No |
Safari
Full support Yes |
WebView Android
No support No |
Chrome Android
No support No |
Firefox Android
Full support 20 |
Opera Android
No support No |
Safari iOS
Full support Yes |
Samsung Internet Android
No support No | |
Chrome Full support 53 Full support 53 Notes' Before Chrome 66, this method returned |
Edge
Full support 12 |
Firefox
Full support 63 |
IE
Full support Yes |
Opera
Full support 40 |
Safari
Full support Yes |
WebView Android Full support 53 Full support 53 Notes' Before WebView 66, this method returned |
Chrome Android Full support 53 Full support 53 Notes' Before Chrome 66, this method returned |
Firefox Android
Full support 63 |
Opera Android
Full support 41 |
Safari iOS
Full support Yes |
Samsung Internet Android Full support 6.0 Full support 6.0 Notes' Before Samsung Internet 9.0, this method returned | |
Chrome Full support 53 Full support 53 Notes' Before Chrome 66, this method returned |
Edge Full support 12 Full support 12 Notes' Returns a |
Firefox
Full support 63 |
IE Full support 10 Full support 10 Notes' Returns a |
Opera
Full support 40 |
Safari
Full support 12 |
WebView Android Full support 53 Full support 53 Notes' Before WebView 66, this method returned |
Chrome Android Full support 53 Full support 53 Notes' Before Chrome 66, this method returned |
Firefox Android
Full support 63 |
Opera Android
Full support 41 |
Safari iOS
Full support 12 |
Samsung Internet Android Full support 6.0 Full support 6.0 Notes' Before Samsung Internet 9.0, this method returned | |
fullscreenElement
|
Chrome Full support 71 Full support 71 Full support 53 Prefixed' Implemented with the vendor prefix: webkit |
Edge Full support ≤79 Full support ≤79 Full support ≤18 Prefixed' Implemented with the vendor prefix: webkit Full support 12 Prefixed' Implemented with the vendor prefix: ms |
Firefox Full support 64 Full support 64 No support 47 — 65 Disabled' From version 47 until version 65 (exclusive): this feature is behind the Alternate Name' Uses the non-standard name: |
IE Full support Yes Full support Yes Prefixed' Implemented with the vendor prefix: ms |
Opera Full support 40 Full support 40 Prefixed' Implemented with the vendor prefix: webkit |
Safari Full support Yes Full support Yes Prefixed' Implemented with the vendor prefix: webkit |
WebView Android Full support 71 Full support 71 Full support 53 Prefixed' Implemented with the vendor prefix: webkit |
Chrome Android Full support 71 Full support 71 Full support 53 Prefixed' Implemented with the vendor prefix: webkit |
Firefox Android Full support 64 Full support 64 No support 47 — 65 Disabled' From version 47 until version 65 (exclusive): this feature is behind the Alternate Name' Uses the non-standard name: |
Opera Android Full support 41 Full support 41 Prefixed' Implemented with the vendor prefix: webkit |
Safari iOS Partial support 12 Partial support 12 Notes' Full-screen mode is only supported on the iPad.
Alternate Name' Uses the non-standard name: |
Samsung Internet Android Full support 6.0 Full support 6.0 Prefixed' Implemented with the vendor prefix: webkit |
Chrome
Full support 53 |
Edge
Full support 12 |
Firefox
Full support 63 |
IE
Full support Yes |
Opera
Full support 40 |
Safari
Full support Yes |
WebView Android
Full support 53 |
Chrome Android
Full support 53 |
Firefox Android
Full support 63 |
Opera Android
Full support 41 |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support 6.0 | |
Chrome
Full support 53 |
Edge
Full support 12 |
Firefox
Full support 63 |
IE
Full support Yes |
Opera
Full support 40 |
Safari
Full support Yes |
WebView Android
Full support 53 |
Chrome Android
Full support 53 |
Firefox Android
Full support 63 |
Opera Android
Full support 41 |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support 6.0 | |
Chrome
Full support 53 |
Edge
Full support 12 |
Firefox
Full support 63 |
IE
Full support Yes |
Opera
Full support 40 |
Safari
Full support Yes |
WebView Android
Full support 53 |
Chrome Android
Full support 53 |
Firefox Android
Full support 63 |
Opera Android
Full support 41 |
Safari iOS
Full support Yes |
Samsung Internet Android
Full support 6.0 |
Legend
- Full support
- Full support
- Partial support
- Partial support
- No support
- No support
- Experimental. Expect behavior to change in the future.'
- Experimental. Expect behavior to change in the future.
- See implementation notes.'
- See implementation notes.
- 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.
DocumentOrShadowRoot by Mozilla Contributors is licensed under CC-BY-SA 2.5.