ShadowRoot
interface of the Shadow DOM API is the root node of a DOM subtree that is rendered separately from a document's main DOM tree.Element.shadowRoot
property, provided it was created using Element.attachShadow()
with the mode
option set to open
.Returns a boolean that indicates whether delegatesFocus was set when the shadow was attached (see Element.attachShadow()
).
Promise<boolean>
Returns a reference to the DOM element the ShadowRoot
is attached to.
SuperElement
Sets or returns a reference to the DOM tree inside the ShadowRoot
.
Promise<string>
The mode of the ShadowRoot
— either open
or closed
. This defines whether or not the shadow root's internal features are accessible from JavaScript.
Promise<ShadowRootMode>
Returns a string
representing the base URL of the document containing the Node
.
Promise<string>
Returns a live NodeList
containing all the children of this node. NodeList
being live means that if the children of the Node
change, the NodeList
object is automatically updated.
SuperNodeList
Returns a Node
representing the first direct child node of the node, or null
if the node has no child.
SuperNode
A boolean indicating whether or not the Node is connected (directly or indirectly) to the context object, e.g. the Document
object in the case of the normal DOM, or the ShadowRoot
in the case of a shadow DOM.
Promise<boolean>
Returns a Node
representing the last direct child node of the node, or null
if the node has no child.
SuperNode
Returns a Node
representing the next node in the tree, or null
if there isn't such node.
SuperNode
Returns a string
containing the name of the Node
. The structure of the name will differ with the node type. E.g. An HTMLElement
will contain the name of the corresponding tag, like 'audio'
for an HTMLAudioElement
, a Text
node will have the '#text'
string, or a Document
node will have the '#document'
string.
Promise<string>
Returns an unsigned short
representing the type of the node. Possible values are:
Name Value ELEMENT_NODE
1
ATTRIBUTE_NODE
2
TEXT_NODE
3
CDATA_SECTION_NODE
4
ENTITY_REFERENCE_NODE
5
ENTITY_NODE
6
PROCESSING_INSTRUCTION_NODE
7
COMMENT_NODE
8
DOCUMENT_NODE
9
DOCUMENT_TYPE_NODE
10
DOCUMENT_FRAGMENT_NODE
11
NOTATION_NODE
12
Promise<number>
Returns / Sets the value of the current node.
Promise<string>
Returns the Document
that this node belongs to. If the node is itself a document, returns null
.
SuperDocument
Returns an Element
that is the parent of this node. If the node has no parent, or if that parent is not an Element
, this property returns null
.
SuperElement
Returns a Node
that is the parent of this node. If there is no such node, like if this node is the top of the tree or if doesn't participate in a tree, this property returns null
.
SuperNode
Returns a Node
representing the previous node in the tree, or null
if there isn't such node.
SuperNode
Returns / Sets the textual content of an element and all its descendants.
Promise<string>
Returns the Element
within the shadow tree that has focus.
SuperElement
Returns the Element
that's currently in full screen mode for this document.
SuperElement
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.
SuperElement
Returns the number of children of this ParentNode
which are elements.
Promise<number>
Returns a live HTMLCollection
containing all of the Element
objects that are children of this ParentNode
, omitting all of its non-element nodes.
SuperHTMLCollection
Returns the first node which is both a child of this ParentNode
and is also an Element
, or null
if there is none.
SuperElement
Returns the last node which is both a child of this ParentNode
and is an Element
, or null
if there is none.
SuperElement
Compares the position of the current node against another node in any other document.
Node
. The other Node
with which to compare the first node
’s document position.Promise<number>
Returns a boolean
value indicating whether or not a node is a descendant of the calling node.
Node
. Needs content.Promise<boolean>
Returns the context object's root which optionally includes the shadow root if it is available.
GetRootNodeOptions
. An object that sets options for getting the root node. The available options are: composed
: A `boolean` that indicates whether the shadow root should be returned (false
, the default), or a root node beyond shadow root (true
).SuperNode
Returns a boolean
indicating whether or not the element has any child nodes.
Promise<boolean>
Accepts a namespace URI as an argument and returns a boolean
with a value of true
if the namespace is the default namespace on the given node or false
if not.
string
. namespaceURI
is a string representing the namespace against which the element will be checked.Promise<boolean>
Returns a boolean
which indicates whether or not two nodes are of the same type and all their defining data points match.
Node
. otherNode
: The Node
to compare equality with.Promise<boolean>
Returns a boolean
value indicating whether or not the two nodes are the same (that is, they reference the same object).
Node
. otherNode
The Node
to test against.Promise<boolean>
Accepts a prefix and returns the namespace URI associated with it on the given node if found (and null
if not). Supplying null
for the prefix will return the default namespace.
string
. The prefix to look for. If this parameter is null
, the method will return the default namespace URI, if any.Promise<string>
Returns a string
containing the prefix for a given namespace URI, if present, and null
if not. When multiple prefixes are possible, the result is implementation-dependent.
string
. Needs content.Promise<string>
Clean up all the text nodes under this element (merge adjacent, remove empty).
Promise<void>
Returns a CaretPosition
object containing the DOM node containing the caret, and caret's character offset within that node.
number
. The horizontal coordinate of a point.number
. The vertical coordinate of a point.CaretPosition
Returns the topmost element at the specified coordinates.
number
. The horizontal coordinate of a point, relative to the left edge of the current viewport.number
. The vertical coordinate of a point, relative to the top edge of the current viewport.SuperElement
Returns a Selection
object representing the range of text selected by the user, or the current position of the caret.
Selection
Needs content.
string
. Needs content.SuperElement
Returns the first Element
with the current element as root that matches the specified group of selectors.
string
. A string
containing one or more selectors to match against. This string must be a valid compound selector list supported by the browser; if it's not, a SyntaxError
exception is thrown. See Locating DOM elements using selectors for more information about using selectors to identify elements. Multiple selectors may be specified by separating them using commas.SuperElement
Returns a NodeList
representing a list of elements with the current element as root that matches the specified group of selectors.
string
. A string
containing one or more selectors to match against. This string must be a valid CSS selector string; if it's not, a SyntaxError
exception is thrown. See Locating DOM elements using selectors for more information about using selectors to identify elements. Multiple selectors may be specified by separating them using commas.SuperNodeList
appendChild() | cloneNode() |
insertBefore() | removeChild() |
replaceChild() | addEventListener() |
dispatchEvent() | removeEventListener() |
elementsFromPoint() | append() |
prepend() |