NodeExtensions
Useful methods for node objects.
Ensures the validity for inserting the given node at parent before
the provided child. Throws an error is the insertation is invalid.
Tries to find a direct child of a certain type.
public static TNode FindDescendant<TNode>(this INode parent, int maxDepth = 1024) where TNode : INode
Tries to find a descendant of a certain type.
Gets the first ancestor node that is of the specified type.
Gets the ancestor nodes of the provided node, in tree order.
Gets the assigned slot given by the shadow root and the slot name.
Gets the associated host object, if any. This is mostly interesting
for the HTML5 template tag.
Gets the descendant nodes of the provided parent, in tree order.
Gets the descendant nodes and itself of the provided parent, in tree order.
Gets the element count of the given node.
Gets the inclusive ancestor nodes of the provided node, in tree
order.
Gets the root of the given node, which is the node itself, if it has
no parent, or the root of the parent.
Checks if any parent is an HTML datalist element..
Checks if the node has any text node children.
Gets the hyperreference of the given URL - transforming the given
(relative) URL to an absolute URL if required.
Gets the index of the provided node in the parent's collection.
Gets the index of the given item in the list of nodes.
Finds the index of the given node of the provided parent node.
Checks if the parent is an ancestor of the given node.
Checks if the node is an descendant of the given parent.
Checks if the provided node is an endpoint, i.e., does not host any
other node.
Checks if the provided NodeType is an endpoint, i.e., does not host any
other node.
Checks if the given child is followed by a document type.
Checks if the context node is after the provided node.
Checks for an inclusive ancestor relationship or if the host (if
any) has such a relationship.
Checks if the parent is an inclusive ancestor of the given node.
Checks if the node is an inclusive descendant of the given parent.
Checks if the provided node can be inserted into some other node.
This excludes, e.g., documents from being inserted.
Checks if the given child is preceded by an element node.
Checks if the context node is before the provided node.
Checks if the current node is a sibling of the specified element.
Pre-inserts the given node at the parent before the provided child.
Pre-removes the given child of the parent.
Gets the content text of the given DOM node.
Sets the text content of the given elements.