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.
0.3.1, 28 November 2026
Section titled “0.3.1, 28 November 2026”No API changes, so it drops in where 0.3.0 was.
- Lighter crates. With
default-features = false,parsec-web-cssis CSS syntax, values and media queries without the HTML tree, andparsec-web-encodingis sniffing and decoding without it. The cascade andparse_bytesare the defaultcascadeandparsefeatures. Withoutcascade,selector()in@supportsis false. - Faster JavaScript.
parsec-jsparses about 5% faster, 1.06 timesoxc_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.
0.3.0, 25 November 2026
Section titled “0.3.0, 25 November 2026”- JavaScript.
parsec-jsparses ECMAScript 2025 scripts and modules to a tree and to ESTree JSON in acorn’s shape, at 1.05 timesoxc_parser’s speed. It has scopes, module records, regular expression checking, every early error, diagnostics with codes and code frames, incremental reparsing, andparsec_js::datafor the state pages keep in their scripts. See JavaScript. - XML.
parsec-xmlparses XML 1.0 and Namespaces, not validating, with entity expansion capped and nothing ever fetched, and XPath over it with thexpathfeature. 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
@idtook quadratic time on an element with many attributes, and thenamespace::axis was always empty. - Breaking. The packages are
parsec-web,parsec-web-core,parsec-web-cssandparsec-web-encoding; what you import doesn’t change. Python wheels need 3.10 or newer.parsec_xpath::Itemhas a third variant,Item::Ns, andparsec-xpathreads trees through aTreetrait.
Everything below is in 0.1.0.
0.1.0, 20 November 2026
Section titled “0.1.0, 20 November 2026”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::removeis 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:Nonefrom the readers that return anOption, no children or attributes,""from the serializers andtext, no selector matches.append,insert_beforeandattach_shadowwith one return the newEditError::Removed, and the attribute setters leave it alone.kindkeeps the kind, and an element its name. See Editing.Document::detachis the oldremove: 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
removeand inserted it again now getsEditError::Removed. Calldetachthere instead. - C:
parsec_removechanges meaning the same way, aslxb_dom_node_destroy_deepdoes in Lexbor.parsec_detach(aslxb_dom_node_remove) andparsec_node_is_removedare new, and so isPARSEC_ERR_REMOVED(14), from inserting, editing or querying a removed node. The readers returnPARSEC_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 itstag;xpath()from it and inserting or copying it raiseValueError, and so does decomposing the document node.remove()keeps the node readable, to put back withmove=True, and so doesreplace_with()for the node it replaced.unwrap(),strip_tags(), theinner_htmlsetter andmerge_text_nodes()decompose what they throw away. See Python. - JavaScript:
node.remove()keeps the node usable, as the DOM’sChildNode.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().
Bytes in from Python, JavaScript and C
Section titled “Bytes in from Python, JavaScript and C”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)sniffsbytes;parser.encodingandparser.encoding_confidence;StreamParser(...)withfeed(data)andclose(), which returns anHTMLParser;encoding_for_locale(tag). See Python. - Python behaviour change, a small one:
bytesused 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_encodingordefault_encodingwith astrraisesTypeError. - JavaScript:
parseBytes(bytes, { transportEncoding, defaultEncoding, ...ParseOptions }),new ByteParser(options)withfeed(bytes)andfinish(), andDocument.characterSetandencodingConfidence; TypeScript’sByteParseOptions. 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, andparsec_byte_parser_new,_feed,_finishand_freewith theparsec_byte_parserhandle. 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.ByteParserguesses from the bytes it holds back and, when the whole input says otherwise, parses again atfinish, so it still gives whatparse_bytesgives. 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_bytesno 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.
Encoding: bytes streamed into the parser
Section titled “Encoding: bytes streamed into the parser”PR #115, closing #25. In parsec-html-encoding:
ByteParser::new(options), thenfeed(&[u8])as the bytes arrive andfinish(), which gives theParsedthatparse_bytesgives 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’sDecoderand fed toparsec::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.
CSS: pseudo-elements’ computed values
Section titled “CSS: pseudo-elements’ computed values”PR #112, closing #111. In parsec-html-css:
Styled::get_pseudo(el, &Pseudo::Before, property),computed_pseudoandpseudo_exists, for::before,::after,::marker,::placeholder,::first-line,::first-letter,::selection,::highlight(),::backdropand::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
@containercan find the originating element itself. - Each pseudo-element inherits as CSS Pseudo-Elements 4 says (
::first-letterfrom::first-line, highlights from the parent’s highlight) and takes only the properties that apply to it.content: normalisnoneon::beforeand::after, andattr()incontentis substituted. - The user agent stylesheet has CSS Lists 3’s
::markerrule 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 runstest_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,cqminandcqmaxat computed-value time, each axis from its nearest size container, and from the small viewport when there’s none. They work in@containerpreludes too.- Size queries compute
calc()withemandremin it against the container, andvwagainst the viewport rather than the container. ContainerQuery::evaluatetakes aQueryLengths(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”- 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)andposition;HTMLParser.line_col(offset);HTMLParser.errors, a list ofParseError; andXPathError, aValueError. Offsets index what you passed: code points into astr, bytes intobytes. See Python. - C: the
PARSEC_SPANSandPARSEC_ERRORSflags;parsec_node_span,parsec_end_span,parsec_attr_spanandparsec_line_col;parsec_errors_countandparsec_errors_get, which fill aparsec_syntax_error;parsec_xpath_compile,_freeand_evaluate, and theparsec_xpath_result_*calls; and the statusPARSEC_ERR_XPATH. All additions: nothing that was inparsec.hchanged. Offsets are UTF-8 bytes, as C passes them in. See C API. - WebAssembly:
parse(html, { spans, errors });doc.xpath()andnode.xpath();node.span,endSpanandattributeSpan(name), each aSpan;doc.errors, an array ofParseError. Offsets index the JavaScript string, in UTF-16 units. The.wasmgrew from 739 KB to 869 KB. See WASM.
CSS: the cascade’s other at-rules
Section titled “CSS: the cascade’s other at-rules”PR #99, for #95. In parsec-html-css:
@scope, with scoping proximity in the cascade order,:scopeand&inside, limits, and implicit roots.@container, size andstyle()queries, against the sizesStyler::container_sizesgives.@import, through the fetchStyler::fetchgives, withlayer(),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,ScopeBoundsandImport, parsed and written back;Styler::at_rules()gives the winning@keyframes,@counter-styleand@propertyof 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-stylesyntax tests, and the<template>-based@scopetests: 1,141 of 1,345.
CSS values in their canonical forms
Section titled “CSS values in their canonical forms”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()andsymbols()counts, font feature tags,grid-template-areas’ rectangles, path data. Commas are left out only where Values 4 §2.6 says. expandsplits lists of layers (background,mask,transition,animation) layer by layer, follows a longhand that’s a shorthand with its own longhands, and fills inmask-borderandborder-imageformaskandborder.sibling-index()andsibling-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 anEnvironmentyou give, with three-valued logic.parsec_css::supports:@supportsandCSS.supports().parsec_css::cascade:Stylerstyles a Parsec document with user agent, user and author sheets (the HTML Standard’s user agent stylesheet included), layers, nesting, specificity,!importantandstyle="", andStyled::getgives any element’s computed value asgetComputedStyle()writes it, with inheritance,revert,revert-layer,allandvar().values::Color::absolute()and colour conversion between every CSS Color 4 space, with CSS Color 5’s relative colours andcolor-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-cssnow depends onparsec-html, for the document and its selectors.
CSS values
Section titled “CSS values”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/css8.7.9 (pinned incrates/parsec-css/data/webref, MIT): grammar, initial value, inheritance, longhands.property(name)andproperties(). 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), andColor(CSS Color 4, and from Color 5 relative colors,color-mix(),contrast-color(),light-dark()anddevice-cmyk()).expand(shorthand, values), a shorthand split into its longhands.CustomProperties,Resolved,substituteandsubstitute_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 joincargo test: 13,899 of 14,893 pass, with the rest listed. Acssbench row for typed values against Lexbor. CSS values has everything.
CSS: one pass for a whole stylesheet
Section titled “CSS: one pass for a whole stylesheet”parse_stylesheet_deepparses 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, whereparse_stylesheetthencontentson 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,SimpleBlockby default, so code written for #87 compiles as it was. The newBlockis a block with its contents parsed. - Fixed: a declaration with an empty value,
a{foo:}, parsed withcontentsreported a spuriousInvalidRulefor the colon it left behind.
CSS Syntax
Section titled “CSS Syntax”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_contentswith nesting,parse_declaration_list,parse_rule,parse_declaration, the component value entry points, andSimpleBlock::contentsfor a block you already have. - A byte span on every token, function, block, rule and declaration, and
LineIndexfor lines and columns. - An+B,
<urange>,@charsetdecoding through encoding_rs, and serialization that parses back to the same values. - css-parsing-tests, its
<urange>cases and the CSS tokenizer tests incargo test, with counts in CI’s summary; a fuzz target in the nightly run; and acssmode inbench/against Lexbor’s CSS module and Servo’s cssparser. CSS has the counts and the numbers.
A C API
Section titled “A C API”PR #78, for #20, #21 and #22. It adds:
crates/parsec-capi:libparsec, shared and static, withparsec.hgenerated 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.pcand a CMake config withparsec::parsecandparsec::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.
Bytes in, and every encoding
Section titled “Bytes in, and every encoding”PR #79, for #5 and #25. A new package beside the core, parsec-html-encoding (crate parsec_encoding):
parse_bytestakes 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,prescanandlocale_defaultare 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 incargo test. Encoding has the counts.
A URL parser of Parsec’s own
Section titled “A URL parser of Parsec’s own”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::nfcandnfdare new, tested against all of Unicode’s NormalizationTest.- On the links in the 13 benchmark pages it takes 107 ns a URL, where the
urlcrate 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).
Foundations
Section titled “Foundations”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 isparsec-htmland the library isparsec. It’s Netweir’scrates/netweir-html, copied byscripts/sync-from-netweir.shwith its crate names changed, andNETWEIR_COMMITrecords 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 teston 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.
See also
Section titled “See also”- Roadmap, for what comes next and in what order.
- Getting started, to pin the commit you depend on.