Re: [csswg-drafts] [css-nesting-1] Declaration occuring after an invalid nested rule (#7501)

From what I understand, there was some concern about how to represent interleaved declarations and selectors in CSSOM, and worry that browsers would have to store this interleaving in order to resolve [order of appearance](https://drafts.csswg.org/css-cascade-4/#cascade-order). So we have this section that requires rules to come after declarations to simplify both issues.

But in a very cursory glance at a couple of codebases using PostCSS nesting, I found several instances of declarations coming after rules - sometimes in ways that made perfect sense to me in how one might want to group styling decisions. So I wonder if the restriction is worth having.

We could let authors interleave declarations and rules as they like, then define both CSSOM and order of appearance to do the grouping automatically. Order of appearance would just have one more rule that nested declarations are always placed “after” top-level declarations in a block.

This would cause problems for the implicit rule switch currently proposed, but I am not a fan of that spooky-action-at-a-distance, anyway.

@tabatkins @argyleink @fantasai @mirisuzanne 

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


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

Received on Tuesday, 11 October 2022 20:59:47 UTC