Skip to content

stylesheet: parse nested rules starting with an identifier#193

Merged
samoht merged 1 commit into
mainfrom
nested-rule-ident-pseudo
Jul 24, 2026
Merged

stylesheet: parse nested rules starting with an identifier#193
samoht merged 1 commit into
mainfrom
nested-rule-ident-pseudo

Conversation

@samoht

@samoht samoht commented Jul 24, 2026

Copy link
Copy Markdown
Owner

A nested rule whose selector starts with an identifier, such as h2:where(:not(.x)) { ... }, was dropped with a "curly block in declaration value" warning: CSS Nesting 1 makes that prelude ambiguous with a declaration until the block appears, and the declaration parser raised rather than letting the existing nested-rule fallback run. Parsing now rewinds and retries as a rule when a block follows, so a declaration that is merely invalid still reports as one.

Found against the Tailwind typography stylesheet, where cascade parsed 2 of its 47 blocks.

CSS Nesting 1 lets a nested rule begin with an identifier, so a prelude
like h2:where(...) parses as a declaration until the block shows up. The
declaration parser raised instead of returning None, so recovery dropped
the rule: cascade saw 2 of typography.css's 47 blocks.
@samoht
samoht force-pushed the nested-rule-ident-pseudo branch from 1d594e6 to 203176f Compare July 24, 2026 03:50
@samoht
samoht merged commit 3bd7382 into main Jul 24, 2026
5 checks passed
@samoht
samoht deleted the nested-rule-ident-pseudo branch July 24, 2026 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant