@@ -567,6 +567,61 @@ Mixing Nesting Rules and Declarations {#mixing}
567
567
the relative order in the stylesheet of the applicable declarations
568
568
determines which declaration "wins" the <a>cascade</a> .
569
569
570
+ <div class="example">
571
+ For example, consider the following where the specificity is the same and the
572
+ cascade is used for value resolution:
573
+
574
+ <pre class="lang-css">
575
+ article {
576
+ & .blue { color: blue; }
577
+ & .red { color: red; }
578
+ }
579
+
580
+ /* equivalent to
581
+ article .blue { color: blue; }
582
+ article .red { color: red; }
583
+ */
584
+ </pre>
585
+
586
+ <pre class="lang-html">
587
+ <article>
588
+ <div class="red blue"></div>
589
+ </article>
590
+
591
+ /* div text color is red */
592
+ </pre>
593
+
594
+ and this follow up:
595
+
596
+ <pre class="lang-css">
597
+ article {
598
+ & .blue, & #gotcha { color: blue; }
599
+ & .red { color: red; }
600
+ }
601
+
602
+ /* equivalent to
603
+ article :is(.blue, #gotcha) {
604
+ color: blue;
605
+ }
606
+ article .red { color: red; }
607
+ */
608
+ </pre>
609
+
610
+ <pre class="lang-html">
611
+ <article>
612
+ <div class="red blue"></div>
613
+ </article>
614
+
615
+ /* div text color is blue */
616
+ </pre>
617
+
618
+ specificities between ''.red'' and ''.blue''
619
+ no longer match because the equivalent internal representation of the nesting
620
+ uses '':is()'' , which becomes the specificity of it's highest selector.
621
+ The convenience of nesting ''#gotcha'' and ''.blue'' together has joined
622
+ their specificity, affecting the resolve style, making the color blue.
623
+ </div>
624
+
570
625
571
626
CSS Object Model Modifications {#cssom}
572
627
=======================================
0 commit comments