feat: Add support for most CSS nesting rules #37
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request implements parsing for most CSS nesting rules. This works for rules beginning with:
The only I couldn't figure out is the element selector. I've also pushed these changes to csstree#337 in the hopes to get some feedback on how to do that.
In the meantime, I don't want to hold up getting these changes merged in.
Expansion of test cases for nested CSS rules:
fixtures/ast/rule/nesting.json
. These updates ensure the parser correctly handles a broader range of nested selectors. [1] [2] [3]Parsing logic updates:
Delim
,Hash
,Colon
,LeftSquareBracket
) and aselectorStarts
set to identify valid selector starting characters inlib/syntax/node/Block.js
.consumeDeclaration
function to include a helper methodisSelectorStart
, which checks for valid selector starting tokens.parse
function to useisSelectorStart
for determining whether to consume a rule, enabling support for more selector types.