Re: [csswg-drafts] [css-cascade] [css-nesting] Figure out whether we're fine with "shifting up" bare declarations after rules (#8738)

It seems that all the proposals try to work around the fact that we can’t mix declarations and rules because the OM CSSStyleRule/CSSGroupingRule doesn’t allow this : so we either shift the bare declarations up to group them (current behaviour) or rewrite the following bare declarations to look like rules (and because we can’t do that for the first group of declarations inside the rule, we try to find a switch point like first-valid-rule or @nest).

What about introducing a new CSSBlockContent (with contains a list of declarations and rules intermixed) ? It would be the content of style rule, @media rule, @container rule, @scope rule.. - all nested group rules https://drafts.csswg.org/css-nesting/#nested-group-rules

For backward compatibility, CSSStyleRule would derive from it but would also maintain the current CSSStyleDeclaration API behaviour - overwriting similar declarations and ignoring interleaved rules ; but with the new behaviour visible through the CSSBlockContent API to get the list of rules/declarations in the actual cascade respected order.

It introduces some complexity for implementation, but seems doable ?

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


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

Received on Wednesday, 28 February 2024 23:14:34 UTC