Skip to main content

Class: Document

The root node of the document.

Extends

  • NodeWithChildren

Constructors

new Document()

new Document(children): Document

Parameters

children: ChildNode[]

Children of the node. Only certain node types can have children.

Returns

Document

Inherited from

NodeWithChildren.constructor

Defined in

node_modules/domhandler/lib/node.d.ts:130

Properties

children

children: ChildNode[]

Inherited from

NodeWithChildren.children

Defined in

node_modules/domhandler/lib/node.d.ts:126


endIndex

endIndex: null | number

The end index of the node. Requires withEndIndices on the handler to be `true.

Inherited from

NodeWithChildren.endIndex

Defined in

node_modules/domhandler/lib/node.d.ts:39


next

next: null | ChildNode

Next sibling

Inherited from

NodeWithChildren.next

Defined in

node_modules/domhandler/lib/node.d.ts:35


parent

parent: null | ParentNode

Parent of the node

Inherited from

NodeWithChildren.parent

Defined in

node_modules/domhandler/lib/node.d.ts:31


prev

prev: null | ChildNode

Previous sibling

Inherited from

NodeWithChildren.prev

Defined in

node_modules/domhandler/lib/node.d.ts:33


sourceCodeLocation?

optional sourceCodeLocation: null | SourceCodeLocation

parse5 source code location info.

Available if parsing with parse5 and location info is enabled.

Inherited from

NodeWithChildren.sourceCodeLocation

Defined in

node_modules/domhandler/lib/node.d.ts:45


startIndex

startIndex: null | number

The start index of the node. Requires withStartIndices on the handler to be `true.

Inherited from

NodeWithChildren.startIndex

Defined in

node_modules/domhandler/lib/node.d.ts:37


type

type: Root

The type of the node.

Overrides

NodeWithChildren.type

Defined in

node_modules/domhandler/lib/node.d.ts:150


x-mode?

optional x-mode: "no-quirks" | "quirks" | "limited-quirks"

Document mode (parse5 only).

Defined in

node_modules/domhandler/lib/node.d.ts:153

Accessors

childNodes

get childNodes(): ChildNode[]

Same as children. DOM spec-compatible alias.

set childNodes(children): void

Parameters

children: ChildNode[]

Returns

ChildNode[]

Inherited from

NodeWithChildren.childNodes

Defined in

node_modules/domhandler/lib/node.d.ts:139


firstChild

get firstChild(): null | ChildNode

First child of the node.

Returns

null | ChildNode

Inherited from

NodeWithChildren.firstChild

Defined in

node_modules/domhandler/lib/node.d.ts:132


lastChild

get lastChild(): null | ChildNode

Last child of the node.

Returns

null | ChildNode

Inherited from

NodeWithChildren.lastChild

Defined in

node_modules/domhandler/lib/node.d.ts:134


nextSibling

get nextSibling(): null | ChildNode

Same as next. DOM spec-compatible alias.

set nextSibling(next): void

Parameters

next: null | ChildNode

Returns

null | ChildNode

Inherited from

NodeWithChildren.nextSibling

Defined in

node_modules/domhandler/lib/node.d.ts:67


nodeType

get nodeType(): 9

DOM spec-compatible node type.

Returns

9

Overrides

NodeWithChildren.nodeType

Defined in

node_modules/domhandler/lib/node.d.ts:151


parentNode

get parentNode(): null | ParentNode

Same as parent. DOM spec-compatible alias.

set parentNode(parent): void

Parameters

parent: null | ParentNode

Returns

null | ParentNode

Inherited from

NodeWithChildren.parentNode

Defined in

node_modules/domhandler/lib/node.d.ts:55


previousSibling

get previousSibling(): null | ChildNode

Same as prev. DOM spec-compatible alias.

set previousSibling(prev): void

Parameters

prev: null | ChildNode

Returns

null | ChildNode

Inherited from

NodeWithChildren.previousSibling

Defined in

node_modules/domhandler/lib/node.d.ts:61

Methods

cloneNode()

cloneNode<T>(this, recursive?): T

Clone this node, and optionally its children.

Type Parameters

T extends Node

Parameters

this: T

recursive?: boolean

Clone child nodes as well.

Returns

T

A clone of the node.

Inherited from

NodeWithChildren.cloneNode

Defined in

node_modules/domhandler/lib/node.d.ts:75