Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Document

Re-exporting all of the node types.

Hierarchy

  • NodeWithChildren
    • Document

Index

Constructors

  • new Document(children: ChildNode[]): Document
  • Parameters

    • children: ChildNode[]

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

    Returns Document

Properties

children: ChildNode[]
endIndex: null | number

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

next: null | ChildNode

Next sibling

parent: null | ParentNode

Parent of the node

prev: null | ChildNode

Previous sibling

sourceCodeLocation?: null | SourceCodeLocation

parse5 source code location info.

Available if parsing with parse5 and location info is enabled.

startIndex: null | number

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

type: Root
x-mode?: "no-quirks" | "quirks" | "limited-quirks"

Document mode (parse5 only).

Accessors

  • get childNodes(): ChildNode[]
  • set childNodes(children: ChildNode[]): void
  • Same as children. DOM spec-compatible alias.

    Returns ChildNode[]

  • Same as children. DOM spec-compatible alias.

    Parameters

    • children: ChildNode[]

    Returns void

  • get firstChild(): null | ChildNode
  • First child of the node.

    Returns null | ChildNode

  • get lastChild(): null | ChildNode
  • Last child of the node.

    Returns null | ChildNode

  • get nextSibling(): null | ChildNode
  • set nextSibling(next: null | ChildNode): void
  • Same as next. DOM spec-compatible alias.

    Returns null | ChildNode

  • Same as next. DOM spec-compatible alias.

    Parameters

    • next: null | ChildNode

    Returns void

  • get nodeType(): 9
  • Returns 9

  • Same as parent. DOM spec-compatible alias.

    Returns null | ParentNode

  • Same as parent. DOM spec-compatible alias.

    Parameters

    Returns void

  • get previousSibling(): null | ChildNode
  • set previousSibling(prev: null | ChildNode): void
  • Same as prev. DOM spec-compatible alias.

    Returns null | ChildNode

  • Same as prev. DOM spec-compatible alias.

    Parameters

    • prev: null | ChildNode

    Returns void

Methods

  • cloneNode<T>(this: T, recursive?: boolean): T
  • Clone this node, and optionally its children.

    Type parameters

    Parameters

    • this: T
    • Optional recursive: boolean

      Clone child nodes as well.

    Returns T

    A clone of the node.