-
-
Notifications
You must be signed in to change notification settings - Fork 3
Fix nested element selector parsing in DeclarationList context #85
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
Hi @Copilot!, thanks for the Pull Request The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.
To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page. Read more about contributing to ESLint here |
Hi @Copilot!, thanks for the Pull Request The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.
To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page. Read more about contributing to ESLint here |
Co-authored-by: nzakas <[email protected]>
Hi @Copilot!, thanks for the Pull Request The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.
To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page. Read more about contributing to ESLint here |
2 similar comments
Hi @Copilot!, thanks for the Pull Request The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.
To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page. Read more about contributing to ESLint here |
Hi @Copilot!, thanks for the Pull Request The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.
To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page. Read more about contributing to ESLint here |
Co-authored-by: nzakas <[email protected]>
Hi @Copilot!, thanks for the Pull Request The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.
To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page. Read more about contributing to ESLint here |
2 similar comments
Hi @Copilot!, thanks for the Pull Request The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.
To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page. Read more about contributing to ESLint here |
Hi @Copilot!, thanks for the Pull Request The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.
To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page. Read more about contributing to ESLint here |
Hi @Copilot!, thanks for the Pull Request The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.
To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page. Read more about contributing to ESLint here |
The CSS parser was failing to correctly parse nested rules that begin with element selectors in DeclarationList context. Consider:
The issue was in the
DeclarationList.js
parser which only recognized&
(nesting selector) as the start of a nested rule. Any other selector likep
,div:hover
,.class
, etc. would be incorrectly parsed as a malformed declaration and converted to Raw content.Changes made:
Enhanced selector detection: Updated
DeclarationList.js
to use comprehensiveisSelectorStart()
logic instead of just checking for&
Improved lookahead logic: Added sophisticated token lookahead in
isElementSelectorStart()
to distinguish between:p: value;
orp: value
p { ... }
div:hover { ... }
Fixed EOF handling: Properly handle end-of-input cases to ensure
p:v
(without semicolon) is correctly parsed as a declaration, not a selectorUpdated test fixtures: Modified existing test cases to reflect the correct parsing behavior
Before:
After:
The fix now correctly handles all selector types in nested contexts while preserving proper distinction between properties and selectors.
Fixes #84.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.