Skip to main content

Class: Document

The root node of the document.

Hierarchy

  • NodeWithChildren

    Document

Constructors

constructor

new Document(children): Document

Parameters

NameTypeDescription
childrenChildNode[]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

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.

Returns

ChildNode[]

Inherited from

NodeWithChildren.childNodes

Defined in

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

set childNodes(children): void

Parameters

NameType
childrenChildNode[]

Returns

void

Inherited from

NodeWithChildren.childNodes

Defined in

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


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.

Returns

null | ChildNode

Inherited from

NodeWithChildren.nextSibling

Defined in

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

set nextSibling(next): void

Parameters

NameType
nextnull | ChildNode

Returns

void

Inherited from

NodeWithChildren.nextSibling

Defined in

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


nodeType

get nodeType(): 9

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.

Returns

null | ParentNode

Inherited from

NodeWithChildren.parentNode

Defined in

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

set parentNode(parent): void

Parameters

NameType
parentnull | ParentNode

Returns

void

Inherited from

NodeWithChildren.parentNode

Defined in

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


previousSibling

get previousSibling(): null | ChildNode

Same as prev. DOM spec-compatible alias.

Returns

null | ChildNode

Inherited from

NodeWithChildren.previousSibling

Defined in

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

set previousSibling(prev): void

Parameters

NameType
prevnull | ChildNode

Returns

void

Inherited from

NodeWithChildren.previousSibling

Defined in

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

Methods

cloneNode

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

Clone this node, and optionally its children.

Type parameters

NameType
Textends Node

Parameters

NameTypeDescription
thisT-
recursive?booleanClone 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