#dom #testing #html5ever #parser #node #html #html5


Basic, unsupported DOM structure for use by tests in html5ever/xml5ever

3 releases (breaking)

0.3.0 Mar 23, 2024
0.2.0 Aug 18, 2022
0.1.0 Dec 19, 2019

#3 in #html5

Download history 17567/week @ 2023-12-20 9406/week @ 2023-12-27 17584/week @ 2024-01-03 14879/week @ 2024-01-10 15270/week @ 2024-01-17 18873/week @ 2024-01-24 15523/week @ 2024-01-31 17188/week @ 2024-02-07 12669/week @ 2024-02-14 11147/week @ 2024-02-21 15427/week @ 2024-02-28 15470/week @ 2024-03-06 16158/week @ 2024-03-13 15688/week @ 2024-03-20 29059/week @ 2024-03-27 19605/week @ 2024-04-03

84,113 downloads per month
Used in 195 crates (30 directly)


11K SLoC


This crate is built for the express purpose of writing automated tests for the html5ever and xml5ever crates. It is not intended to be a production-quality DOM implementation, and has not been fuzzed or tested against arbitrary, malicious, or nontrivial inputs. No maintenance or support for any such issues will be provided. If you use this DOM implementation in a production, user-facing system, you do so at your own risk.


A simple reference-counted DOM.

This is sufficient as a static parse tree, but don't build a web browser using it. :)

A DOM is a tree structure with ordered children that can be represented in an XML-like format. For example, the following graph

 +- "text node"
 +- span

in HTML would be serialized as

<div>text node<span></span></div>

See the document object model article on wikipedia for more information.

This implementation stores the information associated with each node once, and then hands out refs to children. The nodes themselves are reference-counted to avoid copying - you can create a new ref and then a node will outlive the document. Nodes own their children, but only have weak references to their parents.


~23K SLoC