Re: [csswg-drafts] [css-nesting] Another problem with mixing declarations and rules - error recovery (#8349)

> What color is the background of the div? In a browser that doesn't support nesting, it'll be green, in a browser that does, it'll be red. This is a problem.

I think this is only an issue if CSS authors expect nested CSS to have aspects of graceful degradation / progressive enhancement. But I don't think they do.

```css
.foo {
  /* base styles */

  &:hover {
    /* enhancement */
  }
}
```

CSS authors are aware that any use of nesting will result in a broken and unusable result in older browsers without native support.

`@layer` is no different than this.
Only in very rare cases will a website render ok when large chunks of CSS are missing because they are wrapped in an at rule an older browser doesn't support.

Nested CSS might break down in weirder ways than some might expect but I don't think **how** it breaks is particularly important.

It is also why I spend so much of my time crafting tools to transpile features like these for older browsers. Authors who need to support older browsers and want to use nested CSS can use tools like these (as they do today).

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


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

Received on Sunday, 22 January 2023 21:33:59 UTC