Skip to content

Commit 47ccf09

Browse files
author
Adam Argyle
committed
[css-nesting-1] adds another valid and invalid example to nested conditionals
1 parent fbc343c commit 47ccf09

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

css-nesting-1/Overview.bs

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,12 +458,32 @@ Nesting Conditional Rules {#conditionals}
458458
/* equivalent to
459459
.foo { display: grid; }
460460

461-
@media (orientation: portrait) {
461+
@media (orientation: landscape) {
462462
.foo {
463463
grid-auto-flow: column;
464464
}
465465
}
466466
*/
467+
468+
.foo {
469+
color: red;
470+
471+
@media (min-width: 480px) {
472+
& > .bar,
473+
& > .baz {
474+
color: blue;
475+
}
476+
}
477+
}
478+
/* equivalent to
479+
.foo { color: red; }
480+
481+
@media (min-width: 480px) {
482+
.foo > :is(.bar, .baz) {
483+
color: blue;
484+
}
485+
}
486+
*/
467487
</pre>
468488

469489
But the following are invalid:
@@ -487,6 +507,16 @@ Nesting Conditional Rules {#conditionals}
487507
}
488508
/* Invalid because not all selectors in the list
489509
contain a nesting selector */
510+
511+
.foo {
512+
color: red;
513+
514+
@nest @media (min-width: 480px) {
515+
& { color: blue; }
516+
}
517+
}
518+
/* Invalid because @nest expects a selector prelude,
519+
instead a conditional rule was provided */
490520
</pre>
491521
</div>
492522

0 commit comments

Comments
 (0)