Skip to content

fix: escape slash, comma and semicolon char when stringify name#1585

Merged
fb55 merged 6 commits intofb55:masterfrom
kainstar:escapse-name-slash
Mar 21, 2026
Merged

fix: escape slash, comma and semicolon char when stringify name#1585
fb55 merged 6 commits intofb55:masterfrom
kainstar:escapse-name-slash

Conversation

@kainstar
Copy link
Copy Markdown
Contributor

@kainstar kainstar commented Jul 3, 2025

add slash, comma and semicolon char in charsToEscapeInName to support class like:

import { stringify, parse } from 'css-what';

const selector = parse('.before\\:bottom-1\\/2, .bg-\\[hsl\\(227\\,91\\%\\,65\\%\\)\\;\\]');
console.log(stringify(selector)); // .before\:bottom-1\/2, .bg-\[hsl\(227\,91\%\,65\%\)\;\]

@kainstar kainstar changed the title fix: escape slash char when stringify name fix: escape slash and comma char when stringify name Jul 4, 2025
@kainstar kainstar changed the title fix: escape slash and comma char when stringify name fix: escape slash, comma and semicolon char when stringify name Jul 4, 2025
@fb55
Copy link
Copy Markdown
Owner

fb55 commented Jul 20, 2025

Thanks a lot @kainstar! Could you also add a test case? (The example you gave in the PR description would suffice.)

fb55 and others added 3 commits March 21, 2026 00:29
Also add test cases for Tailwind CSS-style class names with escaped
slashes, commas, semicolons, brackets, and parentheses.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@fb55 fb55 merged commit 62b7b0e into fb55:master Mar 21, 2026
8 checks passed
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.

2 participants