Re: [csswg-drafts] [css-nesting-1] Invalid nested selectors (#7503)

Following latest spec edits and after carefully re-reading all related issues, I have a better understanding of how a nest-containing selector is desugared. Basically, `&` can be considered as being replaced by `:is()` containing the selector of the parent rule.

First, I think an example showing that there is no difference between `div { &:hover {} }` and `div { :hover& {} }` would be usefull (whereas only `div:hover` is valid).

Second, it is still not clear to me if this resolution with `:is()` implies that for: 

```css
:root { ::before&, .valid {} }   /* `::before:is(:root)` is invalid */
span { ::before + &, .valid {} } /* `::before + :is(span)` is invalid */
```

   1. nested rules are valid but `::before + &` and `::before + &` do not match any element
   2. nested rules are invalid

I intentionally used `::before` in the selector of the nested style rules, because I do not know if desugaring with `:is()` is slightly more complex than I defined it in the introduction of this comment, which would mean the answer is 1.

But more importantly and put more explicitly, I would like to know if desugaring `&` with `:is()` implies forgiving parsing for `<relative-selector-list>`.

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


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

Received on Thursday, 16 February 2023 14:09:47 UTC