IParentNode Interface

https://dom.spec.whatwg.org/#interface-parentnode

public interface IParentNode

Properties

NameDescription
ChildElementCountGets the number of child elements.
ChildrenGets the live collection of the child elements.
FirstElementChildGets the first child that is an element, or null when there is none.
LastElementChildGets the last child that is an element, or null when there is none.

ChildElementCount

Gets the number of child elements.

uint ChildElementCount { get; }

Children

Gets the live collection of the child elements.

HtmlCollection Children { get; }

FirstElementChild

Gets the first child that is an element, or null when there is none.

Element? FirstElementChild { get; }

LastElementChild

Gets the last child that is an element, or null when there is none.

Element? LastElementChild { get; }

Methods

NameDescription
Append(ReadOnlySpan<NodeOrString>)Inserts the nodes after the last child, converting the strings into text nodes.
MoveBefore(Node, Node?)Moves the node, preserving its state, before the given child (or to the end when the child is null).
Prepend(ReadOnlySpan<NodeOrString>)Inserts the nodes before the first child, converting the strings into text nodes.
QuerySelector(SelectorList)Returns the first inclusive descendant, in tree order, that matches the parsed selector (https://dom.spec.whatwg.org/#dom-parentnode-queryselector).
QuerySelector(string)Returns the first descendant element, in tree order, that matches the selectors, or null.
QuerySelectorAll(SelectorList)Returns the descendants, in tree order, that match the parsed selector (https://dom.spec.whatwg.org/#dom-parentnode-queryselectorall).
QuerySelectorAll(string)Returns the descendant elements, in tree order, that match the selectors.
ReplaceChildren(ReadOnlySpan<NodeOrString>)Replaces all the children with the given nodes, converting the strings into text nodes.

Append(ReadOnlySpan<NodeOrString>)

Inserts the nodes after the last child, converting the strings into text nodes.

void Append(params scoped ReadOnlySpan<NodeOrString> nodes)

MoveBefore(Node, Node?)

Moves the node, preserving its state, before the given child (or to the end when the child is null).

void MoveBefore(Node node, Node? child)

Prepend(ReadOnlySpan<NodeOrString>)

Inserts the nodes before the first child, converting the strings into text nodes.

void Prepend(params scoped ReadOnlySpan<NodeOrString> nodes)

QuerySelector overloads

QuerySelector(SelectorList)

Returns the first inclusive descendant, in tree order, that matches the parsed selector (https://dom.spec.whatwg.org/#dom-parentnode-queryselector).

Element? QuerySelector(SelectorList selectors)
Parameters
selectors SelectorList
Returns

Element?

QuerySelector(string)

Returns the first descendant element, in tree order, that matches the selectors, or null.

Element? QuerySelector(string selectors)

QuerySelectorAll overloads

QuerySelectorAll(SelectorList)

Returns the descendants, in tree order, that match the parsed selector (https://dom.spec.whatwg.org/#dom-parentnode-queryselectorall).

NodeList QuerySelectorAll(SelectorList selectors)
Parameters
selectors SelectorList
Returns

NodeList

QuerySelectorAll(string)

Returns the descendant elements, in tree order, that match the selectors.

NodeList QuerySelectorAll(string selectors)

ReplaceChildren(ReadOnlySpan<NodeOrString>)

Replaces all the children with the given nodes, converting the strings into text nodes.

void ReplaceChildren(params scoped ReadOnlySpan<NodeOrString> nodes)