Re: [csswg-drafts] [css-nesting] support nesting at-rules

Thanks for starting this discussion as a proper issue.

I agree that it often improves readability and reduces duplication to nest media queries inside selectors. Same, too, for `@supports` tests.

I also agree that it makes sense to move forward with this at the same time as the rest of the nesting proposal, as most of the parsing changes that will be needed could be implemented together.

The thing that is different about nested @-rules is that the _interior_ content of the rule changes. Instead of having full style rules with selectors inside the media query, we would only expect property declarations, because the selector would come from the outer context.

This therefore affects not only parsing, but also the CSSOM model for the conditional rules. Do we define new CSSOM models for the nested rules? Or do we keep them as [`CSSGroupingRule`s](https://drafts.csswg.org/css-conditional-3/#cssgroupingrule), but then make the group contents a read-only copy of the outer selector?

Of course, how this question is addressed will be tied to how the CSSOM handles the `@nest` rule and nesting in general, which is still [an open issue on the CSS Nesting proposal](https://tabatkins.github.io/specs/css-nesting/#cssom).

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

Received on Friday, 6 July 2018 14:47:03 UTC