W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2015

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

From: Ryosuke Niwa <rniwa@apple.com>
Date: Mon, 27 Apr 2015 14:58:37 -0700
Cc: Olli Pettay <olli@pettay.fi>, WebApps WG <public-webapps@w3.org>
Message-id: <FC1A525D-8D74-43AB-83DA-6FFC9B958219@apple.com>
To: Hayato Ito <hayato@chromium.org>

> 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 <mailto:rniwa@apple.com>> wrote:
> 
> > On Apr 26, 2015, at 6:11 PM, Hayato Ito <hayato@chromium.org <mailto: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 21:59:05 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:27:31 UTC