Re: [csswg-drafts] [css-nesting-1] Syntax Invites Errors (#7834)

> And regarding to defaulting to descentant combinator, it's not clear to me at all why

This is how Sass and every Sass-like preprocessor works. It's not new, it's precisely what authors would expect if we allowed naked nesting like this.

> (The current spec has 2 cases, I have lost track of how many different variants the new proposal has. So less learnable)

Both proposals have exactly two cases, so I'm not sure what you're referring to.

If going with the proposal as originally presented, the cases are:

* If no other rule precedes it, then if the style rule starts its selector with & it's fine. Otherwise you need to put `@nest;` before it (or any other at-rule, once those are allowed).
* If any rule precedes it, then any nested style rule is valid, using the existing well-known Sass rules. (Allow relative selectors, assume a relative descendant selector if & isn't already used in the selector.)

If going with my more aggressive parsing suggestion, the first case changes from "starts its selector with &" to "starts its selector with anything but a tagname selector". The second case is identical.

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


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

Received on Saturday, 8 October 2022 01:36:02 UTC