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
Element
within the shadow tree that has focus.DocumentOrShadowRoot.fullscreenElement
Read only
Element
that's currently in full screen mode for this document.DocumentOrShadowRoot.pointerLockElement
Read only
null
if lock is pending, the pointer is unlocked, or if the target is in another document.DocumentOrShadowRoot.styleSheets
Read only
StyleSheetList
of CSSStyleSheet
objects for stylesheets explicitly linked into, or embedded in a document.DocumentOrShadowRoot.getSelection()
Selection
object representing the range of text selected by the user, or the current position of the caret.DocumentOrShadowRoot.elementFromPoint()
DocumentOrShadowRoot.elementsFromPoint()
DocumentOrShadowRoot.caretPositionFromPoint()
CaretPosition
object containing the DOM node containing the caret, and caret's character offset within that node.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. |
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
|
Yes
|
64
|
Yes
|
40
|
Yes
|
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
|
53
|
Yes
|
64
|
40
|
Yes
|
6.0
|
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