Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

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