forked from prettier/prettier
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Format pseudo-selector args like a function call (prettier#13577)
- Loading branch information
Showing
6 changed files
with
231 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#### Fix formatting of long `:is`, `:where`, and `:not` selectors (#13577 by @j-f1) | ||
|
||
Pseudo-selectors like `:is`, `:where`, and `:not` that can take multiple selectors as arguments are now formatted like function calls are in other languages. Previously, no special significance was attached to the commas between their “arguments,” leading to confusing wrapping behavior. There are likely still improvements to be made here — please open an issue with some example code if you find something that doesn’t look as expected. | ||
|
||
<!-- prettier-ignore --> | ||
```css | ||
/* Input */ | ||
:where( | ||
label > input:valid, | ||
label > textarea:not(:empty), | ||
label > button[disabled] | ||
) ~ .errors > .error { display: none; } | ||
|
||
/* Prettier stable */ | ||
:where(label > input:valid, label > textarea:not(:empty), label | ||
> button[disabled]) | ||
~ .errors | ||
> .error { | ||
display: none; | ||
} | ||
|
||
/* Prettier main */ | ||
:where( | ||
label > input:valid, | ||
label > textarea:not(:empty), | ||
label > button[disabled] | ||
) | ||
~ .errors | ||
> .error { | ||
display: none; | ||
} | ||
``` |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
:is(ol, ul, menu:unsupported) :is(ol, ul) { | ||
color: green; | ||
} | ||
|
||
:is(ol, ul) :is(ol, ul) ol { | ||
list-style-type: lower-greek; | ||
color: chocolate; | ||
} | ||
|
||
:is(ol, ul, menu, dir) :is(ol, ul, menu, dir) :is(ul, menu, dir) { | ||
list-style-type: square; | ||
} | ||
|
||
/* Level 0 */ | ||
h1 { | ||
font-size: 30px; | ||
} | ||
/* Level 1 */ | ||
:is(section, article, aside, nav) h1 { | ||
font-size: 25px; | ||
} | ||
/* Level 2 */ | ||
:is(section, article, aside, nav) :is(section, article, aside, nav) h1 { | ||
font-size: 20px; | ||
} | ||
/* Level 3 */ | ||
:is(section, article, aside, nav) :is(section, article, aside, nav) :is(section, article, aside, nav) h1 { | ||
font-size: 15px; | ||
} | ||
|
||
some-element:is(::before, ::after) { | ||
display: block; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
:where(#p0:checked ~ #play:checked ~ #c1:checked, #p1:checked ~ #play:checked ~ #c2:checked, #p2:checked ~ #play:checked ~ #cO:checked) ~ #result > | ||
#c { display: block; } | ||
|
||
:where(ol, ul, menu:unsupported) :where(ol, ul) { | ||
color: green; | ||
} | ||
|
||
:where(ol, ul) :where(ol, ul) ol { | ||
list-style-type: lower-greek; | ||
color: chocolate; | ||
} | ||
|
||
:is(section.is-styling, aside.is-styling, footer.is-styling) a { | ||
color: red; | ||
} | ||
|
||
:where(section.where-styling, aside.where-styling, footer.where-styling) a { | ||
color: orange; | ||
} |