Skip to content

Changelog

Parsec 0.3.1 came out on 28 November 2026, with the C library on the GitHub release. 0.3.0, on 25 November, was the first release as parsec-web on crates.io, PyPI and npm; before it, 0.1.0 and 0.2.0 went out as parsec-html. CHANGELOG.md has every release in full; this page has 0.3.1 and 0.3.0 in short and 0.1.0 in detail.

No API changes, so it drops in where 0.3.0 was.

  • Lighter crates. With default-features = false, parsec-web-css is CSS syntax, values and media queries without the HTML tree, and parsec-web-encoding is sniffing and decoding without it. The cascade and parse_bytes are the default cascade and parse features. Without cascade, selector() in @supports is false.
  • Faster JavaScript. parsec-js parses about 5% faster, 1.06 times oxc_parser‘s speed over the bench, and reads page state three times as fast as before: as fast as the parse, on nytimes’ 852 KB of it.
  • JavaScript. parsec-js parses ECMAScript 2025 scripts and modules to a tree and to ESTree JSON in acorn’s shape, at 1.05 times oxc_parser’s speed. It has scopes, module records, regular expression checking, every early error, diagnostics with codes and code frames, incremental reparsing, and parsec_js::data for the state pages keep in their scripts. See JavaScript.
  • XML. parsec-xml parses XML 1.0 and Namespaces, not validating, with entity expansion capped and nothing ever fetched, and XPath over it with the xpath feature. See XML.
  • Every binding. JavaScript and XML in the C API, Python and WebAssembly; a native Node.js build in the npm package (Node.js); and a step limit on selector matching in all of them.
  • Fixed. XPath name tests like @id took quadratic time on an element with many attributes, and the namespace:: axis was always empty.
  • Breaking. The packages are parsec-web, parsec-web-core, parsec-web-css and parsec-web-encoding; what you import doesn’t change. Python wheels need 3.10 or newer. parsec_xpath::Item has a third variant, Item::Ns, and parsec-xpath reads trees through a Tree trait.

Everything below is in 0.1.0.

A node you hold after it’s removed reads as nothing

Section titled “A node you hold after it’s removed reads as nothing”

PR #121, closing #12, with the core from Netweir (netweir/netweir#346). This finishes M2.

  • Document::remove is now for good. The node and everything in it (a template’s contents and a shadow host’s shadow tree too) read as nothing from then on: None from the readers that return an Option, no children or attributes, "" from the serializers and text, no selector matches. append, insert_before and attach_shadow with one return the new EditError::Removed, and the attribute setters leave it alone. kind keeps the kind, and an element its name. See Editing.
  • Document::detach is the old remove: out of the tree and still usable, to move. Document::is_removed(id) is new.
  • Rust behaviour change: code that took a node out with remove and inserted it again now gets EditError::Removed. Call detach there instead.
  • C: parsec_remove changes meaning the same way, as lxb_dom_node_destroy_deep does in Lexbor. parsec_detach (as lxb_dom_node_remove) and parsec_node_is_removed are new, and so is PARSEC_ERR_REMOVED (14), from inserting, editing or querying a removed node. The readers return PARSEC_NO_NODE, 0, NULL, "" or false for one, all but its type, namespace and name. See C API and Moving from Lexbor.
  • Python behaviour change: decompose() is for good, as selectolax’s is. A decomposed node, and any node inside it, reads as empty but keeps its tag; xpath() from it and inserting or copying it raise ValueError, and so does decomposing the document node. remove() keeps the node readable, to put back with move=True, and so does replace_with() for the node it replaced. unwrap(), strip_tags(), the inner_html setter and merge_text_nodes() decompose what they throw away. See Python.
  • JavaScript: node.remove() keeps the node usable, as the DOM’s ChildNode.remove() does, so nothing changes there.
  • Tests: the core’s own for every reader, editing, a parent’s subtree, templates, shadow trees and selectors; a C section on removed and detached nodes, under ASan and UBSan in CI; pytest for each Python call that takes a node out; and a package test for JavaScript’s remove().

PR #118, closing #116. The bindings decode a page given as bytes the way parse_bytes does, whole or as it arrives:

  • Python: HTMLParser(data, transport_encoding=None, default_encoding=None) sniffs bytes; parser.encoding and parser.encoding_confidence; StreamParser(...) with feed(data) and close(), which returns an HTMLParser; encoding_for_locale(tag). See Python.
  • Python behaviour change, a small one: bytes used to be read as UTF-8 whatever they were. UTF-8 still decodes as UTF-8, declared or not. Bytes that aren’t valid UTF-8 and don’t name their encoding used to get U+FFFD for each bad byte, and now decode as windows-1252, as in a browser. transport_encoding or default_encoding with a str raises TypeError.
  • JavaScript: parseBytes(bytes, { transportEncoding, defaultEncoding, ...ParseOptions }), new ByteParser(options) with feed(bytes) and finish(), and Document.characterSet and encodingConfidence; TypeScript’s ByteParseOptions. The WebAssembly grows by 201 KB, 142 KB gzipped, to 1,071 KB, 504 KB gzipped. See WASM.
  • C: parsec_parse_bytes, parsec_document_encoding, and parsec_byte_parser_new, _feed, _finish and _free with the parsec_byte_parser handle. All additions. See C API.
  • In all three, spans and error offsets for bytes are byte offsets into those bytes, in their own encoding, and a transport label that names no encoding is passed over.
  • parsec-html-encoding: the sniffing’s autodetection step. With no BOM, transport encoding or <meta> in the first 1,024 bytes, bytes with something beyond ASCII that are all valid UTF-8 are UTF-8, tentatively, before the fallback. ByteParser guesses from the bytes it holds back and, when the whole input says otherwise, parses again at finish, so it still gives what parse_bytes gives. All 82 html5lib encoding cases still pass.
  • parsec-html-encoding: Offsets, which turns offsets into the decoded page into offsets into its bytes and back. parse_bytes no longer reads the clock without a budget, which panicked in WebAssembly. See Encoding.
  • Tests: the 82 html5lib encoding cases through each binding, whole and in pieces of 1 to 7 bytes, all passing; 187,952 spans on 334 pages mapped back to their bytes.

PR #115, closing #25. In parsec-html-encoding:

  • ByteParser::new(options), then feed(&[u8]) as the bytes arrive and finish(), which gives the Parsed that parse_bytes gives for the same bytes, however they were cut.
  • It holds bytes back only until the encoding is known: a byte order mark (cut over pieces or not), the transport encoding, a whole <meta> from the prescan, or 1,024 bytes. Each piece is then decoded with encoding_rs’s Decoder and fed to parsec::Parser.
  • While the encoding is a guess it keeps every byte for the late-<meta> reparse, so pass the transport encoding when you have one.
  • Tests: 418,818 cuts of the html5lib encoding inputs and the WPT multi-byte pages, 0 differ from parse_bytes.

PR #112, closing #111. In parsec-html-css:

  • Styled::get_pseudo(el, &Pseudo::Before, property), computed_pseudo and pseudo_exists, for ::before, ::after, ::marker, ::placeholder, ::first-line, ::first-letter, ::selection, ::highlight(), ::backdrop and ::file-selector-button. Pseudo::parse("::before") reads a name.
  • Rules ending in a pseudo-element match their originating element, with the pseudo-element in their specificity, and @container can find the originating element itself.
  • Each pseudo-element inherits as CSS Pseudo-Elements 4 says (::first-letter from ::first-line, highlights from the parent’s highlight) and takes only the properties that apply to it. content: normal is none on ::before and ::after, and attr() in content is substituted.
  • The user agent stylesheet has CSS Lists 3’s ::marker rule and ::backdrop’s.
  • They’re worked out when you ask, so styling a page costs no more for having them.
  • WPT: the cascade runner reads getComputedStyle(el, pseudo) and runs css-pseudo’s static tests, 1,343 of 1,474 (from 1,198 of 1,345); the computed-value runner runs test_pseudo_computed_value, 11,356 of 12,111.

CSS: style ranges and container query units

Section titled “CSS: style ranges and container query units”

PR #109, part of #100. In parsec-html-css:

  • Range syntax in style() queries: style(--gap > 1em), style(10px <= --gap < 2em), with each value substituted, typed and computed on the container.
  • cqw, cqh, cqi, cqb, cqmin and cqmax at computed-value time, each axis from its nearest size container, and from the small viewport when there’s none. They work in @container preludes too.
  • Size queries compute calc() with em and rem in it against the container, and vw against the viewport rather than the container.
  • ContainerQuery::evaluate takes a QueryLengths (font size, viewport, container units, writing mode) and a callback for style range values, in place of the font size alone.
  • WPT cascade and at-rules: 1,198 of 1,345, from 1,141.

XPath, positions and parse errors from Python, C and JavaScript

Section titled “XPath, positions and parse errors from Python, C and JavaScript”

PR #108, for #23:

  • Python: HTMLParser(html, positions=True, errors=True); xpath(query, **variables) on the parser and on nodes, giving what lxml gives; Node.source_range, end_tag_range, attribute_range(name) and position; HTMLParser.line_col(offset); HTMLParser.errors, a list of ParseError; and XPathError, a ValueError. Offsets index what you passed: code points into a str, bytes into bytes. See Python.
  • C: the PARSEC_SPANS and PARSEC_ERRORS flags; parsec_node_span, parsec_end_span, parsec_attr_span and parsec_line_col; parsec_errors_count and parsec_errors_get, which fill a parsec_syntax_error; parsec_xpath_compile, _free and _evaluate, and the parsec_xpath_result_* calls; and the status PARSEC_ERR_XPATH. All additions: nothing that was in parsec.h changed. Offsets are UTF-8 bytes, as C passes them in. See C API.
  • WebAssembly: parse(html, { spans, errors }); doc.xpath() and node.xpath(); node.span, endSpan and attributeSpan(name), each a Span; doc.errors, an array of ParseError. Offsets index the JavaScript string, in UTF-16 units. The .wasm grew from 739 KB to 869 KB. See WASM.

PR #99, for #95. In parsec-html-css:

  • @scope, with scoping proximity in the cascade order, :scope and & inside, limits, and implicit roots.
  • @container, size and style() queries, against the sizes Styler::container_sizes gives.
  • @import, through the fetch Styler::fetch gives, with layer(), scope(), supports() and media.
  • @property: registered custom properties take their syntax, inheritance and initial value from it.
  • parsec_css::rules: Keyframes, CounterStyle, PropertyRule, Syntax, ContainerQuery, ScopeBounds and Import, parsed and written back; Styler::at_rules() gives the winning @keyframes, @counter-style and @property of each name.
  • @supports at-rule(…).
  • WPT: the cascade runner now also runs css-conditional’s container queries, css-properties-values-api and css-counter-styles’ @counter-style syntax tests, and the <template>-based @scope tests: 1,141 of 1,345.

PR #98, for #92. In parsec_css::values:

  • Values are written in the shortest form CSSOM gives them, for 65 properties and the types and functions they share (positions, repeat-style, basic shapes, transform and filter functions, easing functions, counters, SVG path data), and a shorthand’s longhands at their initial values are left out.
  • The specs’ prose restrictions are checked: the names a <custom-ident> can’t be, steps() and symbols() counts, font feature tags, grid-template-areas’ rectangles, path data. Commas are left out only where Values 4 §2.6 says.
  • expand splits lists of layers (background, mask, transition, animation) layer by layer, follows a longhand that’s a shorthand with its own longhands, and fills in mask-border and border-image for mask and border.
  • sibling-index() and sibling-count() in math functions.
  • WPT CSS parsing: 14,758 of 14,893 pass, from 13,907; computed values 11,287 of 12,041, from 10,974.
  • Typed values are at least level with Lexbor on every sheet in bench -- css: a keyword alone is looked up, one-token values skip the matcher, a grammar’s alternatives that can’t start with the next token aren’t tried, and canonical forms need no tree for the common shapes.

CSS: the cascade, media queries and computed values

Section titled “CSS: the cascade, media queries and computed values”

PR #94, for #30. New in parsec-html-css:

  • parsec_css::media: media queries parsed, written back and evaluated against an Environment you give, with three-valued logic.
  • parsec_css::supports: @supports and CSS.supports().
  • parsec_css::cascade: Styler styles a Parsec document with user agent, user and author sheets (the HTML Standard’s user agent stylesheet included), layers, nesting, specificity, !important and style="", and Styled::get gives any element’s computed value as getComputedStyle() writes it, with inheritance, revert, revert-layer, all and var().
  • values::Color::absolute() and colour conversion between every CSS Color 4 space, with CSS Color 5’s relative colours and color-mix() worked out.
  • WPT in cargo test: media queries 1,370 of 1,370, computed values 10,974 of 12,041, cascade 104 of 123, and CSS parsing up to 13,907 of 14,893. Cascade has the details.
  • parsec-html-css now depends on parsec-html, for the document and its selectors.

PR #91, for #29. New in parsec_css::values:

  • A table of every property in the CSS specs, 822 of them, generated from w3c/webref’s @webref/css 8.7.9 (pinned in crates/parsec-css/data/webref, MIT): grammar, initial value, inheritance, longhands. property(name) and properties().
  • parse_value(property, values): a value parsed against the property’s grammar by a backtracking matcher for the value definition syntax, typed, and written back as CSSOM writes a specified value. Specified, Component, CssWide.
  • Unit, Math (every Values 4 math function, simplified and serialized per §10), and Color (CSS Color 4, and from Color 5 relative colors, color-mix(), contrast-color(), light-dark() and device-cmyk()).
  • expand(shorthand, values), a shorthand split into its longhands.
  • CustomProperties, Resolved, substitute and substitute_value: custom properties resolved against each other, cycles made the guaranteed-invalid value, var() substituted with fallbacks, and a cap on how far substitution can grow a value.
  • css-parsing-tests’ color_* files now run (4,803 of 8,061 pass, the rest checked against how CSS Color has changed), and web-platform-tests’ CSS parsing tests join cargo test: 13,899 of 14,893 pass, with the rest listed. A css bench row for typed values against Lexbor. CSS values has everything.

PR #89, for #88.

  • parse_stylesheet_deep parses a whole stylesheet with every block’s declarations and nested rules, straight from the tokenizer, in one pass: 211 MB/s on the benchmark’s ten sheets, where parse_stylesheet then contents on every block managed 148, and Servo’s cssparser 196. CSS has the numbers.
  • The rule types (Stylesheet, Rule, AtRule, QualifiedRule, Item) take what their block is kept as as a type parameter, SimpleBlock by default, so code written for #87 compiles as it was. The new Block is a block with its contents parsed.
  • Fixed: a declaration with an empty value, a{foo:}, parsed with contents reported a spurious InvalidRule for the colon it left behind.

PR #87, for #28. A new package, parsec-html-css (crate parsec_css):

  • The CSS Syntax Level 3 tokenizer and parser, from the current editor’s draft: parse_stylesheet, parse_block_contents with nesting, parse_declaration_list, parse_rule, parse_declaration, the component value entry points, and SimpleBlock::contents for a block you already have.
  • A byte span on every token, function, block, rule and declaration, and LineIndex for lines and columns.
  • An+B, <urange>, @charset decoding through encoding_rs, and serialization that parses back to the same values.
  • css-parsing-tests, its <urange> cases and the CSS tokenizer tests in cargo test, with counts in CI’s summary; a fuzz target in the nightly run; and a css mode in bench/ against Lexbor’s CSS module and Servo’s cssparser. CSS has the counts and the numbers.

PR #78, for #20, #21 and #22. It adds:

  • crates/parsec-capi: libparsec, shared and static, with parsec.h generated by cbindgen and checked in. Opaque handles, node numbers checked against their document, status codes, and no panics into C. C API is the reference.
  • crates/parsec-capi/package.sh, which lays out the header, the libraries, parsec.pc and a CMake config with parsec::parsec and parsec::parsec_static.
  • .github/workflows/release-capi.yml, which builds a package for Linux x86-64 and ARM64, macOS (universal) and Windows x86-64 and ARM64 for each release, tests each one, and attests and attaches them.
  • CI jobs that build and run the C test on Linux, macOS and Windows, and under AddressSanitizer, LeakSanitizer and UndefinedBehaviorSanitizer on Linux, and that fail if the header drifts from the source.
  • Moving from Lexbor, rewritten with each Lexbor call’s C equivalent and the same program written for both.

PR #79, for #5 and #25. A new package beside the core, parsec-html-encoding (crate parsec_encoding):

  • parse_bytes takes a page as bytes and finds its encoding as the HTML Standard says: byte order mark, transport charset, <meta> prescan, fallback. It reparses once when a later <meta> disagrees with a guess. sniff, prescan and locale_default are there on their own too.
  • encoding_rs, re-exported, for decoding and encoding every WHATWG encoding.
  • The html5lib encoding/ tests and the web-platform-tests encoding data in cargo test. Encoding has the counts.

PR #86, for #82. parsec-url keeps its API and drops the url and idna crates for a parser written from the URL Standard’s current text:

  • All 4,565 web-platform-tests URL cases pass, up from 3,690, so the known-failures list is gone and any failure fails the run. URL has the counts.
  • IDNA is UTS #46 with Unicode 18.0 tables generated by crates/parsec-url/scripts/gen-tables.py, with Punycode and the Bidi and ContextJ rules.
  • parsec_url::normalize::nfc and nfd are new, tested against all of Unicode’s NormalizationTest.
  • On the links in the 13 benchmark pages it takes 107 ns a URL, where the url crate took 181 and Ada takes 142 (Benchmarks).

What you might need to change: Url::as_url() and the conversions to and from url::Url are gone, with the crate they pointed to. ParseError and Host are parsec-url’s own types now, with the same names. domain_to_unicode returns a domain it finds an error in unchanged, as the standard’s domain to Unicode does, instead of marking the label with U+FFFD.

Added crates/parsec-url (#26): the WHATWG URL Standard with every getter and setter of URL, URLSearchParams, IDNA and Punycode, built on Servo’s url and idna crates. cargo test runs the web-platform-tests URL suite and CI publishes the counts: 3,690 of 4,565 cases pass, and every failure is listed with its cause on URL. bench/ now times URL parsing against Lexbor and Ada too (#27, Benchmarks).

PR #1, merged on 4 November 2026. Before it, the repository held a licence and a one-line README. It brought in:

  • The parser core, crates/parsec. The package is parsec-html and the library is parsec. It’s Netweir’s crates/netweir-html, copied by scripts/sync-from-netweir.sh with its crate names changed, and NETWEIR_COMMIT records the commit it came from. Everything marked ✅ on Home arrived here.
  • Its tests, as Netweir runs them: the html5lib tokenizer tests from a submodule, the web-platform-tests tree-construction cases pinned in crates/parsec/tests/tree-construction, the selector and editing tests, and the fuzz target. Conformance has the counts.
  • CI: fmt, clippy, cargo-deny and cargo test on Linux, macOS and Windows; a drift check against Netweir; nightly fuzzing, OpenSSF Scorecard and a CLA check.
  • The project files: the README, ROADMAP, CONTRIBUTING, the CLA, the Code of Conduct, SECURITY, GOVERNANCE, SUPPORT, NOTICE, issue and pull request templates, Dependabot and deny.toml.