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

Wait. When I say "only the `&` should ever be treated 'like' :is()" I mean _exactly_ what you show in your demo – and what the spec says (in section 4). There's only the one 'desugaring' metaphor that you need in order to understand all the examples, and it comes later in the spec:

> The nesting selector can be desugared by replacing it with the parent style rule’s selector, wrapped in an `:is()` selector. For example,
> 
> ```css
> a, b {
>   & c { color: blue; }
> }
> ```
> 
> is equivalent to
> 
> ```css
> :is(a, b) c { color: blue; }
> ```

The `&` being replaced by `:is(<parent-selector>)` _is the same thing as_ the parent selector being wrapped by `:is()`. Because in this metaphor, the `&` is acting as a placeholder for the parent selector.

It seems like you are reading complexity in the examples that doesn't actually exist? In part because they don't distinguish between e.g. `article` vs `:is(article)` unless the distinction matters to the outcome. The extra `:is()` wrapper has been left off where it doesn't impact anything. So that looks like extra magic to learn, but it's not.

I don't mean that all the examples are simple, but they aren't intending to express anything _additional_ with the presence or absence of the `:is()` wrapper. The comments do actually communicate what each example is meant to demonstrate.

I'm always in favor of specs & examples being more clear where possible. But there are a lot of specs, and it can be a lot of work – especially since different people will understand different phrasings. So it's hard to get perfect, and comes down to time & focus & priorities. 

The good news is, if you have ideas for improvements, anyone can submit a PR. :)

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


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

Received on Tuesday, 9 July 2024 07:40:17 UTC