Skip to content

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

Open
kainstar wants to merge 3 commits intofb55:masterfrom
kainstar:escapse-name-slash
Open

fix: escape slash, comma and semicolon char when stringify name#1585
kainstar wants to merge 3 commits intofb55:masterfrom
kainstar:escapse-name-slash

Conversation

@kainstar
Copy link

@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
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.)

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