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

I agree that we should bias towards rule recovery, where we'll get into trouble is if we ever add something like:
```css
new-property:something { something } color: red;
```
and the part of the declaration after the `{}` could potentially be interpreted as a valid property and will start taking effect during error recovery. We can choose to never do that, but we need to document that and the why of it for our future selves and whoever comes after.

Where we need to be really careful are the cases where we use lookahead to tell if something is a rule or property, and guess wrong because it's invalid either way. Falling into declaration error recovery by mistake could be really bad.

> Right, we've said if often enough that it didn't particularly bear repeating, plus "don't do it" isn't a valid response to "what should the behavior be when someone does it".

Agreed, but one of the options here is to make properties after rules invalid, turning 'best practice' into 'mandatory practice', which would make all the spec'd behavior of mixed rules and declarations moot. (I'm not in favor of this approach, fwiw, because older browsers will only skip the first declaration after a rule, not all of them, so it's still inconsistent behavior.)

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


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

Received on Friday, 27 January 2023 00:19:52 UTC