Re: [w3c/webcomponents] Allowing CSS combinators postfixed to the ::slotted() selector (#889)

> FWIW, if complex slotted light dom selectors were permitted, I'd expect the selector in the examples above to be `::slotted(.foo .bar)`, not `::slotted(.foo) .bar`. The latter seems to describe a slotted light dom element ".foo" with a descendent shadow element ".bar".

@bathos That is not intuitive because it is impossible. Why would someone be thinking that, when it doesn't exist?

That's like if I said `.foo > .bar` should select any `.foo` elements that have _greater_ amount of text content than the `.bar` element with largest amount of text. But I'd be making things up at that point.

I think a better interpretation is this:

- `::slotted(.foo .bar)` represents an element in the light tree that matches `.foo .bar` in the light tree (it is a descendant of a `.foo` element anywhere in that light tree). I think that's intuitive.
- `::slotted(.foo) .bar` represents the `.bar` element that happens to be a descendant of a slotted `.foo` element. This is also intuitive.

>  I guess `+ ...` also would never match, 

If we think intuitively about this, then: a selector like `::slotted(.foo) + .bar` would style a `.bar` element that happens to be the "adjacent sibling" of a `.foo` element where the `.foo` element is a slotted element. This is intuitive. Also the `.bar` element could very well be distributed to an entirely different slot (but still have the styling specified for that selector). That makes intuitive sense and could be _**totally useful**_.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/889#issuecomment-668932434

Received on Wednesday, 5 August 2020 02:09:25 UTC