Repository navigation
Handle identifier arguments in pseudo-class selectors - #263
Merged
Merged
Conversation
…ments Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
|
| 📦 Package | 📏 Base Size | 📏 Source Size | 📈 Size Change |
|---|---|---|---|
| @projectwallace/format-css | 9.2 kB | 9.2 kB | +23 B |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR improves handling of pseudo-class selector arguments, particularly for the
:lang()pseudo-class and unknown pseudo-classes with identifier arguments. The changes ensure proper formatting and minification of these selectors.Key Changes
:unknown(foo.bar)) are now properly handled and printed as-is without being treated as selectors@projectwallace/css-parserfrom^0.19.6to^0.19.9to support improved parsing of pseudo-class arguments:lang()with multiple identifiers (adds quotes around arguments):lang():lang()and unknown pseudo-classesImplementation Details
The
print_selector_argument()function now includes a check for identifier nodes using theis_identifier()helper, returning the raw text for identifiers before falling back to selector printing. Theprint_selector_list()function was updated to skip operator nodes, allowing the comma-separated formatting to work correctly for pseudo-class argument lists.