Re: [csswg-drafts] [css-nesting-1] CSSOM for nested media query rules (#7850)

We implemented the rule of implicit & {} in Blink, and I think the end result is good enough that the spec should strongly consider adopting it. It gave us:

- Free reuse of the style declaration parser for this case
- Instant disallowing of `@layer` and other relevant rules in indirectly nested context (save for in CSSOM inserts, which we'd need to check anyway)
- Zero CSSOM extensions required
- Instantly correct invalidation
- No new inconsistent cases around top-level `@media`
- Instantly correct handling of order tiebreak between properties and subrules
- And most of all, no need to insert such a rule internally when constructing rule sets for matching/applying (which we'd otherwise probably need to do)

The single thing that's “odd” is that when you serialize (or peek into the rules with CSSOM), you don't get back what you wrote the first time. But this isn't new, and the serialization part could be fixed by removing & {} if it's the first rule if we really care.

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


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

Received on Friday, 21 October 2022 10:58:15 UTC