Re: [csswg-drafts] [css-nesting-1] Clarify when nested rules are equivalents to `:is()` (#10523)

> The big difference here is that Sass does literal string replacement, which can change the selector meaning based on context – `.foo { &bar {}}` becomes `.foobar`. But CSS does not do any replacement, so the `&` selector has the same meaning no matter how you combine it with other things. It means: _the same elements as above_. In that case the direct `:is()` replacement doesn't work (`:is(.foo)bar`) – but the same meaning still holds. We just have to turn it around to get the equivalent `bar:is(.foo)`.

@mirisuzanne I'm wondering why the specification here restricts the `&` operator to only follow `bar`. In other words, why must `bar&` be written explicitly to achieve the effect of `&bar` in nested contexts?

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


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

Received on Sunday, 1 March 2026 08:44:39 UTC