Skip to main content

Interface: ShadowRootWithSelection

lexical.ShadowRootWithSelection

Extension for ShadowRoot with experimental getSelection method. This is a fallback for browsers that don't support getComposedRanges yet.

Hierarchy

  • ShadowRoot

    ShadowRootWithSelection

Properties

ATTRIBUTE_NODE

Readonly ATTRIBUTE_NODE: 2

Inherited from

ShadowRoot.ATTRIBUTE_NODE

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16315


CDATA_SECTION_NODE

Readonly CDATA_SECTION_NODE: 4

node is a CDATASection node.

Inherited from

ShadowRoot.CDATA_SECTION_NODE

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16319


COMMENT_NODE

Readonly COMMENT_NODE: 8

node is a Comment node.

Inherited from

ShadowRoot.COMMENT_NODE

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16325


DOCUMENT_FRAGMENT_NODE

Readonly DOCUMENT_FRAGMENT_NODE: 11

node is a DocumentFragment node.

Inherited from

ShadowRoot.DOCUMENT_FRAGMENT_NODE

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16331


DOCUMENT_NODE

Readonly DOCUMENT_NODE: 9

node is a document.

Inherited from

ShadowRoot.DOCUMENT_NODE

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16327


DOCUMENT_POSITION_CONTAINED_BY

Readonly DOCUMENT_POSITION_CONTAINED_BY: 16

Set when other is a descendant of node.

Inherited from

ShadowRoot.DOCUMENT_POSITION_CONTAINED_BY

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16342


DOCUMENT_POSITION_CONTAINS

Readonly DOCUMENT_POSITION_CONTAINS: 8

Set when other is an ancestor of node.

Inherited from

ShadowRoot.DOCUMENT_POSITION_CONTAINS

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16340


DOCUMENT_POSITION_DISCONNECTED

Readonly DOCUMENT_POSITION_DISCONNECTED: 1

Set when node and other are not in the same tree.

Inherited from

ShadowRoot.DOCUMENT_POSITION_DISCONNECTED

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16334


DOCUMENT_POSITION_FOLLOWING

Readonly DOCUMENT_POSITION_FOLLOWING: 4

Set when other is following node.

Inherited from

ShadowRoot.DOCUMENT_POSITION_FOLLOWING

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16338


DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC

Readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 32

Inherited from

ShadowRoot.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16343


DOCUMENT_POSITION_PRECEDING

Readonly DOCUMENT_POSITION_PRECEDING: 2

Set when other is preceding node.

Inherited from

ShadowRoot.DOCUMENT_POSITION_PRECEDING

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16336


DOCUMENT_TYPE_NODE

Readonly DOCUMENT_TYPE_NODE: 10

node is a doctype.

Inherited from

ShadowRoot.DOCUMENT_TYPE_NODE

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16329


ELEMENT_NODE

Readonly ELEMENT_NODE: 1

node is an element.

Inherited from

ShadowRoot.ELEMENT_NODE

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16314


ENTITY_NODE

Readonly ENTITY_NODE: 6

Inherited from

ShadowRoot.ENTITY_NODE

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16321


ENTITY_REFERENCE_NODE

Readonly ENTITY_REFERENCE_NODE: 5

Inherited from

ShadowRoot.ENTITY_REFERENCE_NODE

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16320


NOTATION_NODE

Readonly NOTATION_NODE: 12

Inherited from

ShadowRoot.NOTATION_NODE

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16332


PROCESSING_INSTRUCTION_NODE

Readonly PROCESSING_INSTRUCTION_NODE: 7

node is a ProcessingInstruction node.

Inherited from

ShadowRoot.PROCESSING_INSTRUCTION_NODE

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16323


TEXT_NODE

Readonly TEXT_NODE: 3

node is a Text node.

Inherited from

ShadowRoot.TEXT_NODE

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16317


activeElement

Readonly activeElement: null | Element

Returns the deepest element in the document through which or to which key events are being routed. This is, roughly speaking, the focused element in the document.

For the purposes of this API, when a child browsing context is focused, its container is focused in the parent browsing context. For example, if the user moves the focus to a text control in an iframe, the iframe is the element returned by the activeElement API in the iframe's node document.

Similarly, when the focused element is in a different node tree than documentOrShadowRoot, the element returned will be the host that's located in the same node tree as documentOrShadowRoot if documentOrShadowRoot is a shadow-including inclusive ancestor of the focused element, and null if not.

MDN Reference

Inherited from

ShadowRoot.activeElement

Defined in

node_modules/typescript/lib/lib.dom.d.ts:7449


adoptedStyleSheets

adoptedStyleSheets: CSSStyleSheet[]

MDN Reference

Inherited from

ShadowRoot.adoptedStyleSheets

Defined in

node_modules/typescript/lib/lib.dom.d.ts:7451


baseURI

Readonly baseURI: string

Returns node's node document's document base URL.

MDN Reference

Inherited from

ShadowRoot.baseURI

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16184


childElementCount

Readonly childElementCount: number

MDN Reference

Inherited from

ShadowRoot.childElementCount

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16877


childNodes

Readonly childNodes: NodeListOf<ChildNode>

Returns the children.

MDN Reference

Inherited from

ShadowRoot.childNodes

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16190


children

Readonly children: HTMLCollection

Returns the child elements.

MDN Reference

Inherited from

ShadowRoot.children

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16883


delegatesFocus

Readonly delegatesFocus: boolean

MDN Reference

Inherited from

ShadowRoot.delegatesFocus

Defined in

node_modules/typescript/lib/lib.dom.d.ts:21396


firstChild

Readonly firstChild: null | ChildNode

Returns the first child.

MDN Reference

Inherited from

ShadowRoot.firstChild

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16196


firstElementChild

Readonly firstElementChild: null | Element

Returns the first child that is an element, and null otherwise.

MDN Reference

Inherited from

ShadowRoot.firstElementChild

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16889


fullscreenElement

Readonly fullscreenElement: null | Element

Returns document's fullscreen element.

MDN Reference

Inherited from

ShadowRoot.fullscreenElement

Defined in

node_modules/typescript/lib/lib.dom.d.ts:7457


host

Readonly host: Element

MDN Reference

Inherited from

ShadowRoot.host

Defined in

node_modules/typescript/lib/lib.dom.d.ts:21398


innerHTML

innerHTML: string

MDN Reference

Inherited from

ShadowRoot.innerHTML

Defined in

node_modules/typescript/lib/lib.dom.d.ts:14381


isConnected

Readonly isConnected: boolean

Returns true if node is connected and false otherwise.

MDN Reference

Inherited from

ShadowRoot.isConnected

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16202


lastChild

Readonly lastChild: null | ChildNode

Returns the last child.

MDN Reference

Inherited from

ShadowRoot.lastChild

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16208


lastElementChild

Readonly lastElementChild: null | Element

Returns the last child that is an element, and null otherwise.

MDN Reference

Inherited from

ShadowRoot.lastElementChild

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16895


mode

Readonly mode: ShadowRootMode

MDN Reference

Inherited from

ShadowRoot.mode

Defined in

node_modules/typescript/lib/lib.dom.d.ts:21400


nextSibling

Readonly nextSibling: null | ChildNode

Returns the next sibling.

MDN Reference

Inherited from

ShadowRoot.nextSibling

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16214


nodeName

Readonly nodeName: string

Returns a string appropriate for the type of node.

MDN Reference

Inherited from

ShadowRoot.nodeName

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16220


nodeType

Readonly nodeType: number

Returns the type of node.

MDN Reference

Inherited from

ShadowRoot.nodeType

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16226


nodeValue

nodeValue: null | string

MDN Reference

Inherited from

ShadowRoot.nodeValue

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16228


onslotchange

onslotchange: null | (this: ShadowRoot, ev: Event) => any

Inherited from

ShadowRoot.onslotchange

Defined in

node_modules/typescript/lib/lib.dom.d.ts:21401


ownerDocument

Readonly ownerDocument: Document

Inherited from

ShadowRoot.ownerDocument

Defined in

node_modules/typescript/lib/lib.dom.d.ts:7430


parentElement

Readonly parentElement: null | HTMLElement

Returns the parent element.

MDN Reference

Inherited from

ShadowRoot.parentElement

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16240


parentNode

Readonly parentNode: null | ParentNode

Returns the parent.

MDN Reference

Inherited from

ShadowRoot.parentNode

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16246


pictureInPictureElement

Readonly pictureInPictureElement: null | Element

MDN Reference

Inherited from

ShadowRoot.pictureInPictureElement

Defined in

node_modules/typescript/lib/lib.dom.d.ts:7459


pointerLockElement

Readonly pointerLockElement: null | Element

MDN Reference

Inherited from

ShadowRoot.pointerLockElement

Defined in

node_modules/typescript/lib/lib.dom.d.ts:7461


previousSibling

Readonly previousSibling: null | ChildNode

Returns the previous sibling.

MDN Reference

Inherited from

ShadowRoot.previousSibling

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16252


slotAssignment

Readonly slotAssignment: SlotAssignmentMode

MDN Reference

Inherited from

ShadowRoot.slotAssignment

Defined in

node_modules/typescript/lib/lib.dom.d.ts:21403


styleSheets

Readonly styleSheets: StyleSheetList

Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document.

MDN Reference

Inherited from

ShadowRoot.styleSheets

Defined in

node_modules/typescript/lib/lib.dom.d.ts:7467


textContent

textContent: null | string

MDN Reference

Inherited from

ShadowRoot.textContent

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16254

Methods

addEventListener

addEventListener<K>(type, listener, options?): void

Throws a "NotSupportedError" DOMException if context object is a shadow root.

Type parameters

NameType
Kextends "slotchange"

Parameters

NameType
typeK
listener(this: ShadowRoot, ev: ShadowRootEventMap[K]) => any
options?boolean | AddEventListenerOptions

Returns

void

Inherited from

ShadowRoot.addEventListener

Defined in

node_modules/typescript/lib/lib.dom.d.ts:21405

addEventListener(type, listener, options?): void

Parameters

NameType
typestring
listenerEventListenerOrEventListenerObject
options?boolean | AddEventListenerOptions

Returns

void

Inherited from

ShadowRoot.addEventListener

Defined in

node_modules/typescript/lib/lib.dom.d.ts:21406


append

append(...nodes): void

Inserts nodes after the last child of node, while replacing strings in nodes with equivalent Text nodes.

Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.

MDN Reference

Parameters

NameType
...nodes(string | Node)[]

Returns

void

Inherited from

ShadowRoot.append

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16903


appendChild

appendChild<T>(node): T

MDN Reference

Type parameters

NameType
Textends Node

Parameters

NameType
nodeT

Returns

T

Inherited from

ShadowRoot.appendChild

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16256


cloneNode

cloneNode(deep?): Node

Returns a copy of node. If deep is true, the copy also includes the node's descendants.

MDN Reference

Parameters

NameType
deep?boolean

Returns

Node

Inherited from

ShadowRoot.cloneNode

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16262


compareDocumentPosition

compareDocumentPosition(other): number

Returns a bitmask indicating the position of other relative to node.

MDN Reference

Parameters

NameType
otherNode

Returns

number

Inherited from

ShadowRoot.compareDocumentPosition

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16268


contains

contains(other): boolean

Returns true if other is an inclusive descendant of node, and false otherwise.

MDN Reference

Parameters

NameType
othernull | Node

Returns

boolean

Inherited from

ShadowRoot.contains

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16274


dispatchEvent

dispatchEvent(event): boolean

Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.

MDN Reference

Parameters

NameType
eventEvent

Returns

boolean

Inherited from

ShadowRoot.dispatchEvent

Defined in

node_modules/typescript/lib/lib.dom.d.ts:8262


elementFromPoint

elementFromPoint(x, y): null | Element

Returns the element for the specified x coordinate and the specified y coordinate.

Parameters

NameTypeDescription
xnumberThe x-offset
ynumberThe y-offset

Returns

null | Element

Inherited from

ShadowRoot.elementFromPoint

Defined in

node_modules/typescript/lib/lib.dom.d.ts:7473


elementsFromPoint

elementsFromPoint(x, y): Element[]

Parameters

NameType
xnumber
ynumber

Returns

Element[]

Inherited from

ShadowRoot.elementsFromPoint

Defined in

node_modules/typescript/lib/lib.dom.d.ts:7474


getAnimations

getAnimations(): Animation[]

MDN Reference

Returns

Animation[]

Inherited from

ShadowRoot.getAnimations

Defined in

node_modules/typescript/lib/lib.dom.d.ts:7476


getElementById

getElementById(elementId): null | HTMLElement

Parameters

NameType
elementIdstring

Returns

null | HTMLElement

Inherited from

ShadowRoot.getElementById

Defined in

node_modules/typescript/lib/lib.dom.d.ts:7431


getRootNode

getRootNode(options?): Node

Returns node's root.

MDN Reference

Parameters

NameType
options?GetRootNodeOptions

Returns

Node

Inherited from

ShadowRoot.getRootNode

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16280


getSelection

getSelection(): null | Selection

Experimental API for getting selection within shadow DOM. Available in some browsers as experimental feature.

Returns

null | Selection

Selection object or null if no selection

Defined in

packages/lexical/src/LexicalSelection.ts:131


hasChildNodes

hasChildNodes(): boolean

Returns whether node has children.

MDN Reference

Returns

boolean

Inherited from

ShadowRoot.hasChildNodes

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16286


insertBefore

insertBefore<T>(node, child): T

MDN Reference

Type parameters

NameType
Textends Node

Parameters

NameType
nodeT
childnull | Node

Returns

T

Inherited from

ShadowRoot.insertBefore

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16288


isDefaultNamespace

isDefaultNamespace(namespace): boolean

MDN Reference

Parameters

NameType
namespacenull | string

Returns

boolean

Inherited from

ShadowRoot.isDefaultNamespace

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16290


isEqualNode

isEqualNode(otherNode): boolean

Returns whether node and otherNode have the same properties.

MDN Reference

Parameters

NameType
otherNodenull | Node

Returns

boolean

Inherited from

ShadowRoot.isEqualNode

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16296


isSameNode

isSameNode(otherNode): boolean

MDN Reference

Parameters

NameType
otherNodenull | Node

Returns

boolean

Inherited from

ShadowRoot.isSameNode

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16298


lookupNamespaceURI

lookupNamespaceURI(prefix): null | string

MDN Reference

Parameters

NameType
prefixnull | string

Returns

null | string

Inherited from

ShadowRoot.lookupNamespaceURI

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16300


lookupPrefix

lookupPrefix(namespace): null | string

MDN Reference

Parameters

NameType
namespacenull | string

Returns

null | string

Inherited from

ShadowRoot.lookupPrefix

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16302


normalize

normalize(): void

Removes empty exclusive Text nodes and concatenates the data of remaining contiguous exclusive Text nodes into the first of their nodes.

MDN Reference

Returns

void

Inherited from

ShadowRoot.normalize

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16308


prepend

prepend(...nodes): void

Inserts nodes before the first child of node, while replacing strings in nodes with equivalent Text nodes.

Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.

MDN Reference

Parameters

NameType
...nodes(string | Node)[]

Returns

void

Inherited from

ShadowRoot.prepend

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16911


querySelector

querySelector<K>(selectors): null | HTMLElementTagNameMap[K]

Returns the first element that is a descendant of node that matches selectors.

MDN Reference

Type parameters

NameType
Kextends keyof HTMLElementTagNameMap

Parameters

NameType
selectorsK

Returns

null | HTMLElementTagNameMap[K]

Inherited from

ShadowRoot.querySelector

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16917

querySelector<K>(selectors): null | SVGElementTagNameMap[K]

Type parameters

NameType
Kextends keyof SVGElementTagNameMap

Parameters

NameType
selectorsK

Returns

null | SVGElementTagNameMap[K]

Inherited from

ShadowRoot.querySelector

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16918

querySelector<K>(selectors): null | MathMLElementTagNameMap[K]

Type parameters

NameType
Kextends keyof MathMLElementTagNameMap

Parameters

NameType
selectorsK

Returns

null | MathMLElementTagNameMap[K]

Inherited from

ShadowRoot.querySelector

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16919

querySelector<K>(selectors): null | HTMLElementDeprecatedTagNameMap[K]

Type parameters

NameType
Kextends keyof HTMLElementDeprecatedTagNameMap

Parameters

NameType
selectorsK

Returns

null | HTMLElementDeprecatedTagNameMap[K]

Deprecated

Inherited from

ShadowRoot.querySelector

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16921

querySelector<E>(selectors): null | E

Type parameters

NameType
Eextends Element = Element

Parameters

NameType
selectorsstring

Returns

null | E

Inherited from

ShadowRoot.querySelector

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16922


querySelectorAll

querySelectorAll<K>(selectors): NodeListOf<HTMLElementTagNameMap[K]>

Returns all element descendants of node that match selectors.

MDN Reference

Type parameters

NameType
Kextends keyof HTMLElementTagNameMap

Parameters

NameType
selectorsK

Returns

NodeListOf<HTMLElementTagNameMap[K]>

Inherited from

ShadowRoot.querySelectorAll

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16928

querySelectorAll<K>(selectors): NodeListOf<SVGElementTagNameMap[K]>

Type parameters

NameType
Kextends keyof SVGElementTagNameMap

Parameters

NameType
selectorsK

Returns

NodeListOf<SVGElementTagNameMap[K]>

Inherited from

ShadowRoot.querySelectorAll

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16929

querySelectorAll<K>(selectors): NodeListOf<MathMLElementTagNameMap[K]>

Type parameters

NameType
Kextends keyof MathMLElementTagNameMap

Parameters

NameType
selectorsK

Returns

NodeListOf<MathMLElementTagNameMap[K]>

Inherited from

ShadowRoot.querySelectorAll

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16930

querySelectorAll<K>(selectors): NodeListOf<HTMLElementDeprecatedTagNameMap[K]>

Type parameters

NameType
Kextends keyof HTMLElementDeprecatedTagNameMap

Parameters

NameType
selectorsK

Returns

NodeListOf<HTMLElementDeprecatedTagNameMap[K]>

Deprecated

Inherited from

ShadowRoot.querySelectorAll

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16932

querySelectorAll<E>(selectors): NodeListOf<E>

Type parameters

NameType
Eextends Element = Element

Parameters

NameType
selectorsstring

Returns

NodeListOf<E>

Inherited from

ShadowRoot.querySelectorAll

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16933


removeChild

removeChild<T>(child): T

MDN Reference

Type parameters

NameType
Textends Node

Parameters

NameType
childT

Returns

T

Inherited from

ShadowRoot.removeChild

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16310


removeEventListener

removeEventListener<K>(type, listener, options?): void

Type parameters

NameType
Kextends "slotchange"

Parameters

NameType
typeK
listener(this: ShadowRoot, ev: ShadowRootEventMap[K]) => any
options?boolean | EventListenerOptions

Returns

void

Inherited from

ShadowRoot.removeEventListener

Defined in

node_modules/typescript/lib/lib.dom.d.ts:21407

removeEventListener(type, listener, options?): void

Parameters

NameType
typestring
listenerEventListenerOrEventListenerObject
options?boolean | EventListenerOptions

Returns

void

Inherited from

ShadowRoot.removeEventListener

Defined in

node_modules/typescript/lib/lib.dom.d.ts:21408


replaceChild

replaceChild<T>(node, child): T

MDN Reference

Type parameters

NameType
Textends Node

Parameters

NameType
nodeNode
childT

Returns

T

Inherited from

ShadowRoot.replaceChild

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16312


replaceChildren

replaceChildren(...nodes): void

Replace all children of node with nodes, while replacing strings in nodes with equivalent Text nodes.

Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.

MDN Reference

Parameters

NameType
...nodes(string | Node)[]

Returns

void

Inherited from

ShadowRoot.replaceChildren

Defined in

node_modules/typescript/lib/lib.dom.d.ts:16941