Re: [webcomponents] Auto-creating shadow DOM for custom elements

On Dec 8, 2013, at 12:19 PM, Daniel Freedman <> wrote:
> Developers want data-binding, and the auto cloning <template> does not give them a favorable timing model.
> They want to set those up before the ShadowDOM is stamped, on a per-instance level.
> If they were to use the automatic template, it would be far too late, and there could be unnecessary network requests or FOUC.

Indeed.  This is why we've included a data binding feature in our original proposal:

We can refine it further to make it more library/framework friendly.  In fact, I'm already in contact with Rafael. W. about this.

> To remove a bit of vaguness from this scenario, Polymer elements use data-binding in almost all cases.
> Event handlers, computed properties, MVC, everywhere.
> As such, no Polymer element would use the automatic <template> registration argument.
> I doubt that elements created with other libraries like Ember or Angular would make much use of it either.

Sure, but that doesn't mean non-framework authors wouldn't use this feature for simple use cases to stamp out the shadow DOM with a static template.

> However, if some low level data-binding primitives were introduced to the platform, there would be some real merit in an automatic template argument. There would have to be some modifications to the proposal, such as adding hooks for data-binding information to be given to the template instance, but I think those details can be discussed when such a data-binding spec arrives.

That seems entirely reasonable, and we're indeed interesting in spec'ing such a feature.

> Until data-binding primitives arise, I think this automatic template is a premature discussion.

Let us spec that automatic template mechanism then.

- R. Niwa

Received on Tuesday, 10 December 2013 09:19:47 UTC