Skip to content

@miy2/xml-api


Abstract Class: Node

Base class for all DOM nodes. Implements a subset of the W3C Node interface to allow applications to interact with the XML model using familiar methods.

Extended by

Constructors

Constructor

new Node(model, ownerDocument): Node

Parameters

model

ModelNode

ownerDocument

Document | null

Returns

Node

Properties

CDATA_SECTION_NODE

readonly CDATA_SECTION_NODE: 4 = 4


COMMENT_NODE

readonly COMMENT_NODE: 8 = 8


DOCUMENT_NODE

readonly DOCUMENT_NODE: 9 = 9


ELEMENT_NODE

readonly ELEMENT_NODE: 1 = 1


model

protected model: ModelNode


ownerDocument

ownerDocument: Document | null


TEXT_NODE

readonly TEXT_NODE: 3 = 3

Accessors

childNodes

Get Signature

get childNodes(): NodeList

Returns a NodeList containing all children of this node, respecting the document's filter.

Returns

NodeList


firstChild

Get Signature

get firstChild(): Node | null

Returns

Node | null


lastChild

Get Signature

get lastChild(): Node | null

Returns

Node | null


nextSibling

Get Signature

get nextSibling(): Node | null

Returns

Node | null


nodeName

Get Signature

get abstract nodeName(): string

Returns

string


nodeType

Get Signature

get abstract nodeType(): number

Returns

number


parentNode

Get Signature

get parentNode(): Node | null

Returns the parent of this node.

Returns

Node | null


previousSibling

Get Signature

get previousSibling(): Node | null

Returns

Node | null


textContent

Get Signature

get textContent(): string | null

Returns

string | null

Set Signature

set textContent(value): void

Parameters
value

string | null

Returns

void

Methods

appendChild()

appendChild<T>(newChild): T

Adds a node to the end of the list of children of a specified parent node.

Type Parameters

T

T extends Node

Parameters

newChild

T

The node to append.

Returns

T


getModel()

getModel(): ModelNode

Returns

ModelNode


insertBefore()

insertBefore<T>(newChild, refChild): T

Inserts a node before a reference node as a child of this node.

Type Parameters

T

T extends Node

Parameters

newChild

T

The node to insert.

refChild

The reference node (must be a child of this node).

Node | null

Returns

T


removeChild()

removeChild<T>(child): T

Removes a child node from the DOM and returns the removed node.

Type Parameters

T

T extends Node

Parameters

child

T

The child node to remove.

Returns

T


replaceChild()

replaceChild<T>(newChild, oldChild): T

Replaces a child node with a new node.

Type Parameters

T

T extends Node

Parameters

newChild

T

The new node to add.

oldChild

Node

The child node to be replaced.

Returns

T