Re: [csswg-drafts] [css-nesting] Syntax suggestion (#4748)

This is kinda a generic complaint about long comma-separated preludes on at-rules, I'd think? We haven't really had them in CSS yet, so we don't have a good indentation strategy established in common culture.

I'd be fine with the "@nest with an empty prelude is allowed, and changes the parsing of its inside to *only* allow rules, not properties", tho it makes the OM somewhat fiddlier. Hmm.

So if we did that, I think we could handle it as a serialization fix-up: if you try to serialize a @nest rule with a null selector list *and* properties, we'd just serialize it as having a `&` selector, and translate child rules into @nest (rather than just being CSSStyleRule).

This does make me wonder slightly if we should dump the CSSNestRule interface entirely, since it's, by design, identical to CSSStyleRule, and just say that nested CSSStyleRules are automatically serialized with @nest (even if we allow, in some situations, them to be written by authors without the at-keyword). To get the null-selector behavior from above we'd have to make .selectorText nullable, which should be fine? (Currently it's *specced* to throw, tho it appears in Chrome at least we'll happily stringify `null` and use it as the selector; that's equally broken, tho, so should be all right to change behavior for.)

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


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

Received on Monday, 11 October 2021 17:19:47 UTC