Re: [webcomponents] Define the behavior of '::slotted' (the former name is '::content'). (#331)

On Tue, Jan 12, 2016 at 2:53 AM, Hayato Ito <notifications@github.com>
wrote:

> Good question. I've never thought this case. :)
>
> ::slotted(div.foo::before)
>
> This should not behave *as intended*, IMO. We might not want to support
> this because a pseudo element, which "::before" *matches*, is not a
> member of a distributed nodes of SLOT. This should not match.
>
> or ::slotted(div.foo)::before ?
>
> How to support this kind of consecutive pseudo elements is up to each
> pseudo element. In this case, it's up to "::slotted" pseudo element.
>
> In a general rule, selectors have a limitation about what can be followed
> by a pseudo element.
> I'm +1 not to support this until we have a strong use case of this.
>
Not a strong use case perhaps, but:

<list>
  <item label="Name">Rune</item>
</list>

where the shadow tree for <list> is:

<list:shadow>
  <style>
    ::slotted(item)::before { content: attr(label) ":" }
  </style>
  <slot>
</list:shadow>

Fwiw, this currently works with ::content in Blink using "::content
item::before".

Also, this is quite similar to :host and :host-context. They happen to be
pseudo classes, not pseudo elements, but they select real dom elements in a
different (shadow) tree than the selector's origin, just like ::slotted.
:host()/:host-context()::before currently works in Blink.

> In a general rule, the support is poor
>
> Note: Note that, unless otherwise specified in a future specification,
> pseudo-classes other than the user action pseudo-classes are not valid when
> compounded to a pseudo-element; so, for example, ::before:first-child is an
> invalid selector.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/w3c/webcomponents/issues/331#issuecomment-170756648>.
>

-- 
Rune Lillesveen


---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/331#issuecomment-170846047

Received on Tuesday, 12 January 2016 09:11:07 UTC