Re: [csswg-drafts] [css-nesting] How to resolve nested CSS with pseudo elements in the parent (#7433)

@LeaVerou The difference is that `.something_else > .anything::before` means: select the `before` pseudo-elements originated by an element with class `anything` which is a child of an element with class `something_else`.

And `.anything::before { .something_else > &` means: select the things which are children of an element with class `something_else` if they also happen to be `before` pseudo-elements originated by an element with class `anything`. And it's not possible for a `before` pseudo-element to be a child of an element in the DOM (since the pseudo-element doesn't exist in the DOM), so this won't match anything.

I think `.anything::before { &:hover {` seems doable (basically a matter of letting `&` select whatever matches the parent selector, regardless of whether it's an element or a pseudo-element. But I don't see how `.anything::before { .something_else > &` can work in a sane way without fully expanding the selectors.

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


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

Received on Friday, 21 October 2022 19:39:19 UTC