-
Notifications
You must be signed in to change notification settings - Fork 19
Fix CSS Nesting selector validation #47
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
base: main
Are you sure you want to change the base?
Conversation
Update fork to match updated original
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds CSS Nesting support by fixing the validation of the nesting selector & when followed immediately by other selector parts (e.g., &:hover, &.foo). The grammar now correctly recognizes & as a valid nesting selector and includes it in selector matching patterns throughout the grammar.
Key Changes:
- Added nesting selector
&as a valid selector type with scopeentity.name.tag.nesting.css - Updated selector validation patterns to include
&in lookahead and lookaround assertions - Added comprehensive test coverage for CSS nesting scenarios
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| spec/css-spec.mjs | Adds four comprehensive test cases covering the nesting selector & in isolation, with classes, with pseudo-classes, and with combinators |
| grammars/css.cson | Updates the CSS grammar to recognize & as a valid nesting selector, refactors arithmetic operators, adds function nesting support, and updates selector validation patterns to include & in various contexts |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| { | ||
| 'include': '#property-values' | ||
| }, |
Copilot
AI
Nov 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing comma after the object in the patterns array. This is invalid CSON syntax and will cause a parsing error.
| }, | |
| } |
38c45ef to
390604c
Compare
Co-authored-by: Copilot <[email protected]>
|
@microsoft-github-policy-service agree |
|
@torresgol10 does this need to be fixed here? |
|
Hi @thernstig , thanks for linking that issue! It's an interesting topic. However, this PR won't fix that problem. The directives mentioned (@variant, @utilities, @apply, etc.) are Tailwind-specific syntax, not standard CSS. This PR focuses solely on native CSS Nesting support as per the W3C specification. |
Supersedes #30. Continues the work of @jacobcassidy to add CSS Nesting support.
This should fix #9 and #15.
Changes:
Updated css.cson to allow & followed by identifier characters.
Added tests in css-spec.mjs covering nesting scenarios.