Re: [csswg-drafts] [css-nesting] request to pick up the css-nesting proposal

Yes please.

I wonder if this could also solve developers' requests for scoping. Two birds with one stone. I.e. instead of having nesting as merely syntactic sugar for the equivalent selectors, making it an alternative to preprocessors, make these rules have higher priority than non-scoped rules. 

To clarify with an example, given the following CSS:

```css
#foo p { color: red }

.bar {
  p { color: green }
}
```

and the following HTML:

```html
<div id="foo">
  <div class="bar">
    <p>foo</p>
  </div>
</div>
```

The paragraph would be green.

I know that we are dead set against introducing any new specificity rules, but it seems that scoping is such a huge problem that developers are avoiding the cascade altogether (see also CSS in JS which apparently half of devs use now?), We need to give them tools to avoid these problems, and it doesn't look like minor changes will do it. @tabatkins seemed to understand the problem well in a series of recent tweets, perhaps he can elaborate here too.

-- 
GitHub Notification of comment by LeaVerou
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2701#issuecomment-391984617 using your GitHub account

Received on Friday, 25 May 2018 08:42:37 UTC