Skip to content

fix: consume whitespace after hexadecimal escapes - #340

Open
jakezwang wants to merge 1 commit into
postcss:mainfrom
jakezwang:fix-hex-escape-whitespace
Open

jakezwang wants to merge 1 commit into
postcss:mainfrom
jakezwang:fix-hex-escape-whitespace

Conversation

@jakezwang

Copy link
Copy Markdown

Parsing [x="\000061 b"] currently produces the attribute value a b instead of ab. Changing the node's quote mark then serializes a selector matching a different value.

Consume the optional CSS whitespace after the hexadecimal digits, including after a six-digit escape. Handle CRLF as one newline and preserve the original raw selector. Add public parser regressions for each whitespace form, replacement characters, and boundaries that must stay in the value.

Validation: 15 regression cases fail before the fix. npm test passes lint, types, coverage thresholds, and all 834 tests on Node 24 and 26. The existing 30 unescape tests also pass; 48 original/reserialized selector pairs match the expected attribute in Chrome. Changed-file formatting passes; the full formatting check flags only unchanged src/__tests__/exceptions.mjs.

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