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

I'm *really* not a fan of the additional set of braces; it adds *two* indents for each level of nesting.

I'm not sure what your additional three syntaxes are doing - is a bare selector allowed (not nested in an extra {}) if it starts with an `&`? If so, then I'm not sure what this gets us over putting `@nest` in front of everything - you'd still have two syntaxes and have to know when to switch from one to the other. You get to avoid writing a `@nest` keyword in front of each of your selectors, but in return you have to indent an extra level each time and deal with more matched braces.

Is the `~` one doing some implicit relative combinators? That's even more powerful than what Sass/etc currently allow, and means there's more context for a reader to carry into parsing the nested selectors - seeing a `span {...}` doesn't mean "a span that's a descendant of the parent rule's element" like it does in Sass, but instead can mean it has any of the four combinator relationships with the parent.

Actually, hm, it *looks* like you still can't put properties directly in the block; the nested block must contain style rules, not declaration lists, right? Then yeah, I'm still on the "two indents per nesting level sounds bad" train.

Finally, the current rules allow us to avoid having to write a heuristic for determining when a selector is meant to *implicitly* chain from the parent and when it's explicitly referencing the parent instead. These appear to bring that heuristic back, so we have to decide, for example, whether a `&` nested inside of an :is() or :not() counts as "referencing the parent" and so whether it means there's still a `&` implicitly prepended or not. This heuristic smells like an editing hazard to me, which is why I was so glad to be able to get rid of it with the current proposal, where all selectors are "complete" as written.

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


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

Received on Monday, 27 September 2021 23:32:27 UTC