Class Comment

Comments within the document.

Hierarchy (view full)



data: string

The content of the data node

endIndex: null | number = null

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

next: null | ChildNode = null

Next sibling

parent: null | ParentNode = null

Parent of the node

prev: null | ChildNode = null

Previous sibling

sourceCodeLocation?: null | SourceCodeLocation

parse5 source code location info.

Available if parsing with parse5 and location info is enabled.

startIndex: null | number = null

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

type: Comment = ElementType.Comment

The type of the node.


  • get nodeValue(): string
  • Same as data. DOM spec-compatible alias.

    Returns string

  • set nodeValue(data): void
  • Parameters

    • data: string

    Returns void


  • Clone this node, and optionally its children.

    Type Parameters


    • this: T
    • recursive: boolean = false

      Clone child nodes as well.

    Returns T

    A clone of the node.