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

Of course new functionality won't work on old browsers. This issue is about the old functionality that follows it.

> While an `@layer` rule in an old browser won't mess up the following rule, it will absolutely make your stylesheet useless

That's not true in general. The `@layer` may just contain one rule with some minor styles that aren't really important to render the page well. While ignoring the entire stylesheet could have a heavy negative impact. It depends on the case.

> the error-recovery change doesn't matter; it'll work correctly in the browsers that your stylesheet works in, and it'll be extremely broken in older browsers no matter what

Again, not necessarily, e.g. here I would be fine with losing the cosmetic shadow on hover, losing `display: grid` may have a much worse impact:

```css
.grid {
  &:hover { box-shadow: 0 0 5px }
  display: grid; /* won't work on old browsers */
  grid-template: repeat(auto-fill, 100px); /* won't work without display: grid */
}
```

> It's happened in the past, and it'll happen in the future

I can't recall a single new feature that had this effect. It's not the case for property values, property names, selectors nor at-rules. When these things are not recognized, they don't affect the next declaration or rule. The closest thing that comes to mind is selector lists, where a single invalid branch invalidates the others, but it still only affects that rule, and this behavior has caused lots of frustration.
  
> occurs if you put properties after rules, which is a bad practice anyway

1st time I have seen this described as bad practice. https://drafts.csswg.org/css-nesting/#mixing just says "all three can be arbitrarily mixed". If it's bad practice then the spec should warn authors.


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


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

Received on Thursday, 26 January 2023 21:45:18 UTC