Re: Imperative API for Node Distribution in Shadow DOM (Revisited)

> On Apr 26, 2015, at 6:11 PM, Hayato Ito <hayato@chromium.org> wrote:
> 
> I think Polymer folks will answer the use case of re-distribution.
> 
> So let me just show a good analogy so that every one can understand intuitively what re-distribution *means*.
> Let me use a pseudo language and define XComponent's constructor as follows:
> 
> XComponents::XComponents(Title text, Icon icon) {
>   this.text = text;
>   this.button = new XButton(icon);
>   ...
> }
> 
> Here, |icon| is *re-distributed*.
> 
> In HTML world, this corresponds the followings:
> 
> The usage of <x-component> element:
>   <x-components>
>     <x-text>Hello World</x-text>
>     <x-icon>My Icon</x-icon>
>   </x-component>
> 
> XComponent's shadow tree is:
> 
>   <shadow-root>
>     <h1><content select="x-text"></content></h1><!-- (1) -->
>     <x-button><content select="x-icon"></content></x-button><!-- (2) -->
>   </shadow-root>

I have a question as to whether x-button then has to select which nodes to use or not.  In this particular example at least, x-button will put every node distributed into (2) into a single insertion point in its shadow DOM.

If we don't have to support filtering of nodes at re-distribution time, then the whole discussion of re-distribution is almost a moot because we can just treat a content element like any other element that gets distributed along with its distributed nodes.

- R. Niwa

Received on Monday, 27 April 2015 21:18:54 UTC