Skip to content

fix: parse escapes in ID selectors as part of the hash token - #356

Merged
bartveneman merged 2 commits into
mainfrom
claude/compassionate-davinci-wjk4ce
Nov 14, 2026
Merged

bartveneman merged 2 commits into
mainfrom
claude/compassionate-davinci-wjk4ce

Conversation

@bartveneman

Copy link
Copy Markdown
Member

Hash tokens now consume CSS escapes, so #md\:hidden and #\31 23 parse as a single IdSelector instead of an IdSelector followed by a TypeSelector. Fixes projectwallace/css-analyzer#673.


Generated by Claude Code

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Package Size Increase

📦 Package 📏 Base Size 📏 Source Size 📈 Size Change
@projectwallace/css-parser 49.8 kB 49.9 kB +102 B

@pkg-pr-new

pkg-pr-new Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@projectwallace/css-parser@0378142

commit: 0378142

@bartveneman
bartveneman merged commit 424bd84 into main Nov 14, 2026
17 checks passed
@bartveneman
bartveneman deleted the claude/compassionate-davinci-wjk4ce branch November 14, 2026 07:44
bartveneman added a commit that referenced this pull request Nov 14, 2026
…357)

Follow-up to #356. Per CSS Syntax, escapes are part of the identifier:

- Dimension units: `1\70x` is one `Dimension` with unit `\70x`.
Breaking: legacy hacks like `0\9`, `0\0` and `100px\9` are now a
`Dimension` with an escaped unit instead of a `Number`/`Dimension` plus
a separate `Identifier`, so consumers that detect these hacks need
updating.
- Idents starting with `-` and an escape (`-\31 x`, `.-\31 x`) are one
ident/class selector instead of an operator plus ident (or an empty
selector).
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.

ID selectors containing an escape get specificity [1,0,1] (parsed as an ID plus a type selector)

2 participants