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

Re: [webcomponents] How about let's go with slots?

From: Elliott Sprehn <esprehn@chromium.org>
Date: Mon, 18 May 2015 19:10:29 -0700
Message-ID: <CAO9Q3i+xHeXa6ouLfQP+yTTcf7gVamGVkVxZaaAhuDun6XVzLg@mail.gmail.com>
To: Domenic Denicola <d@domenic.me>
Cc: Justin Fagnani <justinfagnani@google.com>, "philip@philipwalton.com" <philip@philipwalton.com>, "dfreedm@google.com" <dfreedm@google.com>, "dglazkov@google.com" <dglazkov@google.com>, "sjmiles@google.com" <sjmiles@google.com>, "rniwa@apple.com" <rniwa@apple.com>, "eoconnor@apple.com" <eoconnor@apple.com>, "annevk@annevk.nl" <annevk@annevk.nl>, "travis.leithead@microsoft.com" <travis.leithead@microsoft.com>, "mjs@apple.com" <mjs@apple.com>, "arronei@microsoft.com" <arronei@microsoft.com>, "slightlyoff@google.com" <slightlyoff@google.com>, "public-webapps@w3.org" <public-webapps@w3.org>
On Mon, May 18, 2015 at 6:34 PM, Domenic Denicola <d@domenic.me> wrote:

> From: Justin Fagnani [mailto:justinfagnani@google.com]
> > They're not equivalent, because any element can have the right
> content-slot value, but with tag names, only one (or maybe N) names would
> be supported.
> Hmm, I don't understand, and fear we might be talking past each other. Can
> you give an example where content-slot works but tag names do not? For
> example
> https://github.com/w3c/webcomponents/blob/gh-pages/proposals/Proposal-for-changes-to-manage-Shadow-DOM-content-distribution.md#proposal-part-1-syntax-for-named-insertion-points
> gets translated from
> <combo-box>
>   <icon></icon>
>   <dropdown>
>     … Choices go here …
>   </dropdown>
> </combo-box>
> Your stated sentence doesn't make much sense to me; you can have multiple
> elements with the same tag name. Literally, just take any example you can
> write <x content-slot="y"> ... </x> and replace those with <y> and </y>.

Given the widget <ui-collapsible> that expects a ui-collapsible-header in
the content model, with slots I can write:

  <my-header-v1 slot="ui-collapsible-header"> ... </...>

  <my-header-v2 slot="ui-collapsible-header"> ... </...>

within the same application. It also means the library can ship with an
implementation of the header widget, but you can replace it with your own.
This is identical to the common usage today in polymer apps where you
annotate your own element with classes. There's no restriction on the type
of the input.

With tag names I must write:

  <ui-collapsible-header> ... </...>

which means I can't replace the header with any widget I choose, I must use
that custom element. This is identical to using a tag name with <content
select> and it restricts the type of input. There's no way to have both an
implementation in the library and one in your application, or multiple

- E
Received on Tuesday, 19 May 2015 02:11:39 UTC

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