Skip to content

fix: selectors CSS rejects parsed, and a comment split a compound - #62

Merged
jamesconwaydev merged 1 commit into
mainfrom
sync-css-selectors
Nov 6, 2026
Merged

jamesconwaydev merged 1 commit into
mainfrom
sync-css-selectors

Conversation

@jamesconwaydev

Copy link
Copy Markdown
Collaborator

Problem

#37 found four places where the selector parser was looser than CSS: a comment read as whitespace, so a/**/.b was a descendant selector; An+B took 2 n and + 5; #1a parsed as an ID; and :has() nested inside :has().

Change

Synced from Netweir 90fcd03, netweir/netweir#246, which @foothillsdigital wrote. NETWEIR_COMMIT moves to that commit. The full write-up, including where Lexbor differs, is on that PR.

Tests

selectors_read_as_css_reads_them in tests/css.rs covers each case, with the valid forms beside the rejected ones. cargo test, cargo clippy --all-targets -D warnings and the drift check pass locally.

Closes #37.

Synced from Netweir 90fcd03 (netweir/netweir#246), by @foothillsdigital,
for #37. A comment between simple selectors no longer reads as
whitespace, so a/**/.b is the compound a.b. An+B allows whitespace only
where CSS Syntax does, so 2 n and + 5 are errors. An ID selector must
be an identifier, so #1a is an error. :has() inside :has() is an error,
as Selectors 4 says.
@jamesconwaydev jamesconwaydev added selectors CSS selector parsing and matching netweir-first Before #208: made in Netweir's netweir-html first, then synced here labels Nov 5, 2026
@jamesconwaydev
jamesconwaydev merged commit 5ce990f into main Nov 6, 2026
11 checks passed
@jamesconwaydev
jamesconwaydev deleted the sync-css-selectors branch November 6, 2026 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

netweir-first Before #208: made in Netweir's netweir-html first, then synced here selectors CSS selector parsing and matching

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Selectors: a few things parse that CSS doesn't allow

1 participant