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

Could you clarify what you are trying to achieve? If we don't support,
everything would be weird.

I guess you are proposing the alternative of the current pool population
algorithm and pool distribution algorithm.
I appreciate you could explain what are expected result using algorithms.



On Tue, Apr 28, 2015 at 6:58 AM Ryosuke Niwa <rniwa@apple.com> wrote:

> On Apr 27, 2015, at 2:38 PM, Hayato Ito <hayato@chromium.org> wrote:
>
> On Tue, Apr 28, 2015 at 6:18 AM Ryosuke Niwa <rniwa@apple.com> wrote:
>
>>
>> > 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.
>>
>>
> x-button can select.
> You might want to take a look at the distribution algorithm [1], where
> the behavior is well defined.
>
>
> I know we can in the current spec but should we support it?  What are
> concrete use cases in which x-button or other components need to select
> nodes in nested shadow DOM case?
>
> - R. Niwa
>
>

Received on Monday, 27 April 2015 22:17:10 UTC