Overview of html5ever
mainhtml5ever is an HTML parser developed as part of the Servo project. It parses and serializes HTML according to the WHATWG (HTML5) specifications.
Key characteristics:
- Performance & Safety: Written in Rust to provide C-like performance without the security risks of C or the need for a garbage collector.
- DOM Manipulation: Unlike many parsers, html5ever does not provide a built-in DOM tree representation; instead, it uses callbacks to manipulate the DOM.
- Encoding: Exclusively uses UTF-8 for string representation.
- Compatibility: Passes tokenizer tests from
html5lib-testsand aims to provide hooks necessary for production web browsers (e.g.,document.write).
Note: For XHTML, it is recommended to use an XML parser, as html5ever is optimized for HTML5.