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

Agenda+ to get a CSSWG resolution nesting property declarations within @media rules etc. when nested into a style rule. The three reasonable options seem to be:

1. naked properties aren't allowed in @media; you have to use nested style rules, such as `& {...}`.
2. naked property declarations are allowed in @media etc.; they're implicitly wrapped in an `& {...}` style rule so we don't need to add a `.style` accessor to the OM.
3. naked properties are allowed in @media etc., and they're exposed via a new `.style` accessor.


(1) is inconsistent with established syntax from Sass and elsewhere. It also means authors have to write some additional wrapping rules for the common case where you just want to conditionally apply some properties based on an MQ or similar.

(3) is more consistent with CSSStyleRule, but requires more invasive changes to at-rule OMs. It also means that, for example, deleting everything from `.cssRules` from an @media (which today would completely clear it out) will leave the properties alone.

I'd prefer (2), as it requires the least changes to the OM and makes it slightly more likely that existing code manipulating the OM will continue to work as intended.

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


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

Received on Tuesday, 10 January 2023 23:17:13 UTC