Re: ::part Additions

On Tue, Jul 2, 2013 at 5:00 PM, Bronislav Klučka
<Bronislav.Klucka@bauglir.com> wrote:
> On 2.7.2013 22:19, Tab Atkins Jr. wrote:
>> On Tue, Jul 2, 2013 at 9:16 AM, Bronislav Klučka
>> <Bronislav.Klucka@bauglir.com> wrote:
>>> so
>>> x-video::part(controls)::part(play-button)
>>> would target part="play-button" within part="controls" within x-video?
>>
>> Not quite what I intended.  I was thinking that ::part(controls) would
>> be an <x-controls> element or something, and ::part(play-button) would
>> be in the <x-controls> shadow tree.
>
> so it would select something like
> <x-video>
>    #SHADOW ROOT
>        <x-controls>
>           #SHADOW ROOT
>              <div part=play-button></div>
>        <x-controls>
> </x-video>
>
> how is it, that one time the ::part targets element and other time
> attribute? or is it
>
> <x-video>
>    #SHADOW ROOT
>        <x-controls>
>           #SHADOW ROOT
>              <x-play-button></x-play-button>
>        <x-controls>
> </x-video>

Sorry, this whole time I've been meaning:

<x-video>
  #SHADOW ROOT
    <x-controls part=controls>
      #SHADOW ROOT
        <div part=play-button></div>
    </x-controls>
</x-video>

> x-video::part(controls) ::part(play-button) //with space
> would mean
>
> <x-video>
>    #SHADOW ROOT
>        <x-controls part=controls>
>              <x-play-button part=play-button></x-play-button>
>        <x-controls>
> </x-video>

Yes.

>> Descending into nested shadow trees would just involve adding more
>> ::part pseudos to the correct places.
>
> And that is exactly the problem, TreeView, popup menu, pretty much every
> controls containers (thing about placing tabs into one tab of another tabs,
> that is placed into on tab of the third tabs)
> The shadow nesting could go on and on, there is no way you can style that
> without knowing the exact structure

Right, but the problem you have then is exposing the structure.  If
you want to be able to style parts based on their position in the
tree, you need to start with a consistent tree.  Once you mix in
shadow, you end up with elements having two sets of children, and you
need to be able to distinguish between them.

If you can give up the ability to style based on tree structure, and
accept only styling based on part='' value, then we can just blindly
expose nested things on the uppermost component, so you don't have to
know whether they belong to the component itself or something deeper.

~TJ

Received on Wednesday, 3 July 2013 03:51:12 UTC