[csswg-drafts] [css-nesting] Make @nest default to descendant when no & is present (#5738)

LeaVerou has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-nesting] Make @nest default to descendant when no & is present ==
https://drafts.csswg.org/css-nesting/#at-nest

> The @nest rule functions identically to a style rule: it starts with a selector, and contains declarations that apply to the elements the selector matches. The only difference is that the selector used in a @nest rule must be nest-containing, which means it contains a nesting selector in it somewhere. A list of selectors is nest-containing if all of its individual complex selectors are nest-containing.

Since there is no ambiguity with `@nest`, neither syntactic, nor ambiguity of intent, why still force `&`? We can just default to the descendant selector, just like preprocessors. 

This, is a little awkward:

```css
.foo {
 @nest & .bar {
  color: white;
 }
}
```

compared to: 

```css
.foo {
 @nest .bar {
  color: white;
 }
}
```

Yes, in that case you don't actually need `@nest`, but some people may prefer it for the explicitness, or it could be generated. In any case, it's a sensible default, that is trivial to implement.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5738 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 20 November 2020 13:30:59 UTC