Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IDomHandler<Node, ContainerNode>

Defines node factories and callbacks that are invoked during DOM parsing.

Note: Don't keep references to tokens! Tokens passed to some of the handler callbacks are pooled objects that are reused by the parser after callback finishes. Make a deep copy using IToken.clone to retain a token.

Type parameters

  • Node

  • ContainerNode: Node

Hierarchy

Index

Methods

appendChild

  • appendChild(parentNode: ContainerNode, node: Node): void
  • Triggered when the node must be added to the list of children of the parentNode.

    Parameters

    • parentNode: ContainerNode

      The container node to which node must be appended.

    • node: Node

      The node to append to parentNode as a child.

    Returns void

Optional cdata

  • Creates a new CDATA section node.

    Parameters

    Returns Node

    The DOM node that describes a CDATA section.

Optional comment

  • Creates a new comment node.

    Parameters

    Returns Node

    The DOM node that describes a comment.

Optional containerEnd

  • containerEnd(node: ContainerNode, token: Token): void
  • Triggered when an element or a document was fully read from source.

    Parameters

    • node: ContainerNode

      The element or document node for which the end token was read.

    • token: Token

      The token that closes the container.

    Returns void

Optional document

  • Creates a new document node when a DOCTYPE was read.

    Parameters

    Returns ContainerNode

    The DOM node that document container.

element

  • Creates a new element node.

    Parameters

    • token: IStartTagToken

      The start tag token that denotes the opened element.

    Returns ContainerNode

    The new element node.

Optional processingInstruction

Optional reset

  • reset(): void

Optional sourceEnd

  • sourceEnd(sourceLength: number): void
  • Triggered when parsing of the source is completed.

    Parameters

    • sourceLength: number

      The number of chars that were read from the source.

    Returns void

Optional text

  • Creates a new text node.

    Parameters

    Returns Node

    The DOM node that describes a text.

Generated using TypeDoc