Re: [csswg-drafts] [css-nesting-1] Should prefixing nested selectors be mandatory? (#8270)

The "clarity for authors" argument appears to be completely theoretical. The current syntax is more or less what has been supported in many widely-used preprocessors for over a decade, and there doesn't seem to have been any significant confusion on author's parts. We're not exploring new space here; this is a well-trod cowpath.

Using the & as the mandatory prefix *as well as* a nesting selector is absolutely a no-go - that is *legitimately* extremely confusing that `.foo { & .bar & {...}}` is actually equivalent to `.bar .foo {...}`, when `.foo { & .bar {...}}` is equivalent to `.foo .bar`.  The similar case in the current syntax (`.foo { .bar & {...}}` and `.foo { .bar {...}}`) isn't as confusing because the `&` only means one thing the whole time; you can't read the latter example and assume that the `&` is acting as a nesting selector (while it's actually just a meaningless prefix in the suggested mandatory-& syntax) because it simply doesn't appear at all.

If we were to go with mandatory prefixing we'd use `@nest` (as in one of the rejected earlier options) or just `@`.

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


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

Received on Tuesday, 3 January 2023 19:28:54 UTC