Table of Contents

Interface ParentNode

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

Element is the most general base class from which all element objects (i.e., objects that represent elements) in a Document inherit. It only has methods and properties common to all kinds of elements. More specific classes inherit from Element.

[Value("ParentNode")]
public interface ParentNode

Remarks

For example, the HTMLElement interface is the base interface for HTML elements. Similarly, the SVGElement interface is the basis for all SVG elements, and the MathMLElement interface is the base interface for MathML elements. Most functionality is specified further down the class hierarchy.

Languages outside the realm of the Web platform, like XUL through the XULElement interface, also implement Element.

See also on MDN

Properties

ChildElementCount

The Element.childElementCount read-only property
returns the number of child elements of this element.

[Value("childElementCount")]
ulong ChildElementCount { get; }

Property Value

ulong

Remarks

-Document.ChildElementCount
-DocumentFragment.ChildElementCount

See also on MDN

Children

The read-only children property returns a live HTMLCollection
which contains all of the child Element of the element upon which it was called.

[Value("children")]
HTMLCollection Children { get; }

Property Value

HTMLCollection

An HTMLCollection which is a live, ordered collection of the DOM
elements which are children of node. You can access the
individual child nodes in the collection by using either the
HTMLCollection.Item method on the collection, or by using
JavaScript array-style notation.If the element has no element children, then children is an empty list with a
length of 0.

Remarks

Element.children includes only element nodes. To get all child nodes, including non-element nodes like text and comment nodes, use ChildNodes.

-ChildNodes

See also on MDN

FirstElementChild

The Element.firstElementChild read-only property
returns an element's first child Element, or null if there
are no child elements.

[Value("firstElementChild")]
Element? FirstElementChild { get; }

Property Value

Element

An Element object, or null.

Remarks

Element.firstElementChild includes only element nodes.
To get all child nodes, including non-element nodes like text and comment nodes, use FirstChild.

-Element.NextElementSibling
-Element.LastElementChild

See also on MDN

LastElementChild

The Element.lastElementChild read-only property
returns an element's last child Element, or null if there
are no child elements.

[Value("lastElementChild")]
Element? LastElementChild { get; }

Property Value

Element

An Element object, or null.

Remarks

Element.lastElementChild includes only element nodes.
To get all child nodes, including non-element nodes like text and comment nodes, use LastChild.

-Element.PreviousElementSibling
-Element.FirstElementChild

See also on MDN

Methods

Append(params Union29[])

The Element.append() method
inserts a set of Node objects or strings after
the last child of the Element. Strings
are inserted as equivalent Text nodes.

[Value("append")]
GlobalObject.Undefined Append(params Union29[] nodes)

Parameters

nodes Union29[]

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

Prepend(params Union28[])

The Element.prepend() method inserts a set of
Node objects or strings before the first child
of the Element. Strings are inserted as
equivalent Text nodes.

[Value("prepend")]
GlobalObject.Undefined Prepend(params Union28[] nodes)

Parameters

nodes Union28[]

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

QuerySelector(string)

The querySelector() method of the Element
interface returns the first element that is a descendant of the element on which it is
invoked that matches the specified group of selectors.

[Value("querySelector")]
Element? QuerySelector(string selectors)

Parameters

selectors string

Returns

Element

The first descendant element of baseElement which matches the specified
group of selectors. The entire hierarchy of elements is considered when
matching, including those outside the set of elements including baseElement
and its descendants; in other words, selectors is first applied to the
whole document, not the baseElement, to generate an initial list of
potential elements. The resulting elements are then examined to see if they are
descendants of baseElement. The first match of those remaining elements is
returned by the querySelector() method.If no matches are found, the returned value is null.

Remarks

-Locating DOM elements using selectors
-Attribute selectors in the CSS
Guide
-Attribute selectors in the MDN Learning Area
-Element.QuerySelectorAll
-Document.QuerySelector and
Document.QuerySelectorAll
-DocumentFragment.QuerySelector and
DocumentFragment.QuerySelectorAll
-Other methods that take selectors: Closest(string) and
Matches(string).

See also on MDN

QuerySelectorAll(string)

The Element method querySelectorAll()
returns a static (not live) NodeList representing a list of elements
matching the specified group of selectors which are descendants of the element on which
the method was called.

[Value("querySelectorAll")]
NodeList QuerySelectorAll(string selectors)

Parameters

selectors string

Returns

NodeList

A non-live NodeList containing one Element object for
each descendant node that matches at least one of the specified selectors. The elements are in document order — that is, parents before children, earlier siblings before later siblings.

NOTE
If the specified selectors include a CSS pseudo-element, the returned list
is always empty.

Remarks

-Locating DOM elements using selectors
-Attribute selectors in the CSS
Guide
-Attribute selectors in the MDN Learning Area
-Element.QuerySelector
-Document.QuerySelector and
Document.QuerySelectorAll
-DocumentFragment.QuerySelector and
DocumentFragment.QuerySelectorAll

See also on MDN

QuerySelector<T>(string)

[To("FirstCharToLowerCase")]
T? QuerySelector<T>(string selectors) where T : Element

Parameters

selectors string

Returns

T

Type Parameters

T

ReplaceChildren(params Union30[])

The Element.replaceChildren() method replaces the
existing children of a Node with a specified new set of children. These
can be string or Node objects.

[Value("replaceChildren")]
GlobalObject.Undefined ReplaceChildren(params Union30[] nodes)

Parameters

nodes Union30[]

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

-Element.Prepend
-Element.Append
-NodeList

See also on MDN