← 输入框|github.com|刷新
Skip to content

fix: keep escaped commas inside CSS selectors - #11463

Merged
NathanWalker merged 2 commits into
mainfrom
fix/css-escaped-comma-selectors
Sep 29, 2026
Merged

NathanWalker merged 2 commits into
mainfrom
fix/css-escaped-comma-selectors

Conversation

@triniwiz

@triniwiz triniwiz commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

PR Checklist

What is the current behavior?

Both CSS pipelines (@nativescript/vite's main entry and @nativescript/webpack's css2json-loader) parse with css, which splits a rule's selector list on every comma outside parentheses and counts an escaped \( as a parenthesis. An escaped comma inside a class name therefore splits the class in two. For example, Tailwind's grid-cols-[repeat(auto-fill,minmax(260px,1fr))] compiles to .grid-cols-\[repeat\(auto-fill\,minmax\(260px\,1fr\)\)\], which is parsed as two selectors that match nothing, so the rule never applies. This affects every platform.

What is the new behavior?

After parsing, selector pieces that end on an escaped comma (an odd number of trailing backslashes) are joined back to the next piece, including in rules nested under @media and similar at-rules. Real selector lists and escaped backslashes are unchanged.

Tests: packages/vite/helpers/css-ast.spec.ts (4) and packages/webpack5/__tests__/loaders/css2json-loader.spec.ts (3), using real Tailwind output, a genuine selector list, an escaped backslash and a nested @media. Without the fix, the raw css parse splits the selector.

@nx-cloud

nx-cloud Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 22c23bd

Command Status Duration Result
nx test apps-automated -c=android ✅ Succeeded 3m 33s View ↗
nx run-many --target=test --configuration=ci --... ✅ Succeeded <1s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-09-29 22:07:37 UTC

@pkg-pr-new

pkg-pr-new Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nativescript/core@11463
npm i https://pkg.pr.new/@nativescript/vite@11463
npm i https://pkg.pr.new/@nativescript/webpack@11463

commit: 22c23bd

@triniwiz
triniwiz force-pushed the fix/css-escaped-comma-selectors branch from 400f7ee to ed90c7b Compare September 28, 2026 04:56
@triniwiz
triniwiz changed the base branch from feat/windows to main September 28, 2026 04:56
…rsers

Application.addCss, component css and HMR css updates parse at runtime and
split Tailwind arbitrary-value selectors the same way the build-time parsers
did.
@NathanWalker
NathanWalker merged commit 19b7071 into main Sep 29, 2026
10 checks passed
@NathanWalker
NathanWalker deleted the fix/css-escaped-comma-selectors branch September 29, 2026 22:24
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