Skip to main content

Comment

Comments within the document.

Hierarchy

Index

Constructors

constructor

  • Parameters

    • data: string

      The content of the data node

    Returns Comment

Properties

children

children: Node[] = []

publicdata

data: string

The content of the data node

endIndex

endIndex: null | number = null

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

next

next: null | ChildNode = null

Next sibling

parent

parent: null | ParentNode = null

Parent of the node

prev

prev: null | ChildNode = null

Previous sibling

optionalsourceCodeLocation

sourceCodeLocation?: null | SourceCodeLocation

parse5 source code location info.

Available if parsing with parse5 and location info is enabled.

startIndex

startIndex: null | number = null

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

type

type: Comment = ElementType.Comment

The type of the node.

Accessors

close

  • Node close tag details. Can be null for self closing tag


    Returns undefined | CharValue

  • Parameters

    Returns void

loc

  • Node position in document


    Returns Range

  • Parameters

    Returns void

nextSibling

  • Same as next. DOM spec-compatible alias.


    Returns null | ChildNode

  • Parameters

    Returns void

nodeType

  • get nodeType(): 8
  • DOM spec-compatible node type.


    Returns 8

nodeValue

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


    Returns string

  • Parameters

    • data: string

    Returns void

open

  • Node open tag details


    Returns CharValue

  • Parameters

    Returns void

parentNode

  • Same as parent. DOM spec-compatible alias.


    Returns null | ParentNode

  • Parameters

    Returns void

previousSibling

  • Same as prev. DOM spec-compatible alias.


    Returns null | ChildNode

  • Parameters

    Returns void

Methods

cloneNode

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


    Type parameters

    Parameters

    • this: T
    • recursive: boolean = false

      Clone child nodes as well.

    Returns T

    A clone of the node.