Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ulixee
GitHub Repository: ulixee/secret-agent
Path: blob/main/website/awaited-dom/DocumentOrShadowRoot.md
1029 views

AwaitedDOM / 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

.activeElement
W3C {#activeElement}

Returns the Element within the shadow tree that has focus.

Type: SuperElement

.fullscreenElement
W3C {#fullscreenElement}

Returns the Element that's currently in full screen mode for this document.

Type: SuperElement

.pointerLockElement
W3C {#pointerLockElement}

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.

Type: SuperElement

Methods

.caretPositionFromPoint*(x, y)*
W3C {#caretPositionFromPoint}

Returns a CaretPosition object containing the DOM node containing the caret, and caret's character offset within that node.

Arguments:

  • x number. The horizontal coordinate of a point.

  • y number. The vertical coordinate of a point.

Returns: CaretPosition

.elementFromPoint*(x, y)*
W3C {#elementFromPoint}

Returns the topmost element at the specified coordinates.

Arguments:

  • x number. The horizontal coordinate of a point, relative to the left edge of the current viewport.

  • y number. The vertical coordinate of a point, relative to the top edge of the current viewport.

Returns: SuperElement

.getSelection*()*
W3C {#getSelection}

Returns a Selection object representing the range of text selected by the user, or the current position of the caret.

Returns: Selection

Unimplemented Specs

Methods

elementsFromPoint()