Optional
onOptional callback for elements being popped from the stack of open elements.
Optional
onOptional callback for elements being pushed to the stack of open elements.
Creates a document node.
Creates a document fragment node.
Returns the given comment node's content.
Comment node.
Returns the given document type node's name.
Document type node.
Returns the given document type node's public identifier.
Document type node.
Returns the given document type node's system identifier.
Document type node.
Returns the given node's source code location information.
Node.
Inserts text into a node. If the last child of the node is a text node, the provided text will be appended to the text node content. Otherwise, inserts a new text node with the given text.
Node to insert text into.
Text to insert.
Inserts text into a sibling node that goes before the reference node. If this sibling node is the text node, the provided text will be appended to the text node content. Otherwise, inserts a new sibling text node with the given text before the reference node.
Sets the document mode.
Document node.
Document mode.
Sets the document type. If the document
already contains a document type node, the name
, publicId
and systemId
properties of this node will be updated with the provided values. Otherwise, creates a new document type node
with the given properties and inserts it into the document
.
Document node.
Document type name.
Document type public identifier.
Document type system identifier.
Attaches source code location information to the node.
Node.
Updates the source code location information of the node.
Node.
Tree adapter is a set of utility functions that provides minimal required abstraction layer beetween parser and a specific AST format. Note that
TreeAdapter
is not designed to be a general purpose AST manipulation library. You can build such library on top of existingTreeAdapter
or use one of the existing libraries from npm.See
Have a look at the default tree adapter for reference.