parse-html

Parses HTML files to an abstract syntax tree.

Parses HTML files to abstract syntax trees.

ParseHtml.prototype.sources(file, context[, options])

Parse a file to an abstract syntax tree, the AST is assigned to file.ast.html.

This implementation assigns a seal function to the file so that when the file content is updated it will correspond to the current state of the AST.

The generated AST is decorated with querySelector and querySelectorAll functions so that you can query the AST for desired nodes.

It also adds an adapter getter that allows access to the static DOM adapter function.

static getAttribute(el, name[, value])

Utility to get an attribute from a node.

Iterates the attribute list and gets the first attribute that has the given name and optionally a specific value.

Note this is an extension to the interface required by css-select.

Returns the attribute or undefined.