@@ -522,48 +522,47 @@ Syntax {#syntax}
522522 </div>
523523
524524 <div class=note>
525- Some CSS-generating tools will concatenate selectors like strings,
526- allowing authors to build up a single simple selector
525+ Some CSS-generating tools that preprocess nesting
526+ will concatenate selectors as strings,
527+ allowing authors to build up a <em> single</em> [=simple selector=]
527528 across nesting levels.
528- This is sometimes used by selector-organization methods
529+ This is sometimes used with hierarchical name patterns
529530 like <a href="https://en.wikipedia.org/wiki/CSS#:~:text=bem%20(block%2C%20element%2C%20modifier)">BEM</a>
530531 to reduce repetition across a file,
531532 when the selectors themselves have significant repetition internally.
532533
533534 For example, if one component uses the class ''.foo'' ,
534- and a nested component uses ''.foo__bar '' ,
535+ and a nested component uses ''.fooBar '' ,
535536 you could write this in <a href="https://sass-lang.com/">Sass</a> as:
536537
537538 <pre class="lang-css">
538539 .foo {
539- color: blue;
540- &__bar { color: red; }
540+ color: blue;
541+ &Bar { color: red; }
541542 }
542543 /* In Sass, this is equivalent to
543544 .foo { color: blue; }
544- .foo__bar { color: red; }
545+ .fooBar { color: red; }
545546 */
546547 </pre>
547548
548- Unfortunately, this method is inconsistent with selector syntax in general,
549- and at best requires heuristics tuned to particularly selector-writing practices
550- to recognize when the author wants it,
551- versus the author attempting to add a type selector in the nested rule.
552- ''__bar'' , for example,
549+ Unfortunately, this string-based interpretation is ambiguous with
550+ the author attempting to add a type selector in the nested rule.
551+ ''Bar'' , for example,
553552 <em> is</em> a valid <a href="https://html.spec.whatwg.org/multipage/custom-elements.html">custom element name</a> in HTML.
554553
555- As such, CSS can 't do this;
556- the nested selector components are interpreted on their own ,
557- and not " concatenated" :
554+ CSS doesn 't do this:
555+ the nested selector components are interpreted atomically ,
556+ and not string- concatenated:
558557
559558 <pre class="lang-css">
560559 .foo {
561- color: blue;
562- &__bar { color: red; }
560+ color: blue;
561+ &Bar { color: red; }
563562 }
564563 /* In CSS, this is instead equivalent to
565564 .foo { color: blue; }
566- __bar .foo { color: red; }
565+ Bar .foo { color: red; }
567566 */
568567 </pre>
569568 </div>
0 commit comments