Skip to content

Keep hexadecimal escape terminators inside selector words - #364

Open
nyvexis1 wants to merge 1 commit into
postcss:mainfrom
nyvexis1:fix/hexadecimal-escape-terminators
Open

nyvexis1 wants to merge 1 commit into
postcss:mainfrom
nyvexis1:fix/hexadecimal-escape-terminators

Conversation

@nyvexis1

Copy link
Copy Markdown

Summary

Keep the optional whitespace terminating a hexadecimal escape inside its selector word. For example, .\000061 b currently parses as class a followed by a descendant b; it should be a single class named ab.

The tokenizer now consumes one CSS whitespace terminator after any 1–6 digit hexadecimal escape, including a raw CRLF pair. It preserves the original selector text and updates source positions for words spanning escaped newlines and their following nodes.

This follows CSS Syntax's escaped-code-point algorithm. It complements #340, which fixed decoding in quoted values; this addresses token boundaries in class, ID, tag, and unquoted attribute selectors.

Validation

  • Expanded escape suite: 46 tests fail before the fix; all 168 pass afterward (including four added Sass round-trip/source-position checks).
  • npm test: 1,192 tests pass, including lint, type checks, build, and coverage thresholds (95.47% lines, 96.26% branches, 97.84% functions).
  • Tests cover short/six-digit escapes, each CSS whitespace terminator, an additional real descendant separator, LF/CRLF source positions, Sass interpolation, and unchanged round-tripping.
  • Changed-file formatting and git diff --check pass.

AI assistance was used for implementation and independent agent review.

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