# Parserino: Fast HTML5 Parser and DOM Manipulation for D Parserino is a high-performance HTML5 parser and DOM manipulation library for the D programming language, written in pure D (no C dependencies; born as a D port of lexbor, from which the tree construction is derived). Names and behaviour follow the DOM, HTML and Selectors 4 standards; the parser passes the tree construction tests of the web-platform-tests. ## Rules - **Nodes and elements**: `Node` is any node; `Element` is a node that is an element. An `Element` converts implicitly to `Node`; `node.asElement` gives an `Element` (invalid if the node isn't an element). - **Navigation filter**: navigation methods take the kinds of nodes to see as a template parameter `Show` (the bits of DOM `NodeFilter.whatToShow`, combine them with `|`). The default is `Show.Element`, and then the result is an `Element` or a range of `Element`s; with other filters the results are `Node`s. - **Errors**: searches and navigation give an invalid node (`== null`, `isValid == false`) or an empty range when nothing is found; nodes that can't have children (texts, comments) just have none. Calling a method on an invalid node or document, or an impossible mutation (a child of a text, a node inside itself, a node of another document, a sibling of a node without parent), throws `ParserinoException`. - **Views**: getters that copy a stored string have a `...View` variant returning a slice of the document memory (valid until the value changes or the document is destroyed): `localNameView`, `idView`, `getAttributeView`, `classesView`, `attributesView`, `dataView`. Computed values (`textContent` of an element, `innerHTML`, `title`) have none. - **Memory**: `Document` is reference counted; every `Node` keeps its document alive; removed nodes stay valid and can be inserted again. ## Core Types ### `Document` The root of the DOM tree. - `this(string html, Parsing parsing = Parsing.Eager, size_t chunkSize = DefaultChunkSize)`: Parses the document. With `Parsing.Lazy` it parses incrementally, only as far as queries and accessors need. Results are identical to a full parse. Mutations complete the parsing first. - `this(string html, ParseOptions options)`: `ParseOptions` has `parsing`, `chunkSize` and `scripting` (with `scripting: true` the content of `