This library contains extra APIs that aren't in the DOM, but are useful when interacting with the parse tree.

Functions

htmlSerializeEscape(String text, {bool attributeMode: false}) → String

Escapes text for use in the HTML fragment serialization algorithm. In particular, as described in the specification:

htmlToCodeMarkup(Node node) → String

Converts the DOM tree into an HTML string with code markup suitable for displaying the HTML's source code with CSS colors for different parts of the markup. See also CodeMarkupVisitor.

isVoidElement(String tagName) → bool

Returns true if this tag name is a void element. This method is useful to a pretty printer, because void elements must not have an end tag. See also: http://dev.w3.org/html5/markup/syntax.html#void-elements.

writeTextNodeAsHtml(StringBuffer str, Text node) → void

Serialize text node according to: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#html-fragment-serialization-algorithm

Classes

CodeMarkupVisitor

Converts the DOM tree into an HTML string with code markup suitable for displaying the HTML's source code with CSS colors for different parts of the markup. See also htmlToCodeMarkup.

TreeVisitor

A simple tree visitor for the DOM nodes.