On Dec 6, 2013, at 7:41 PM, Elliott Sprehn <[email protected]> wrote:
> On Thu, Dec 5, 2013 at 5:37 PM, Ryosuke Niwa <[email protected]> wrote:
> Given that many important/natural use cases of custom elements involve shadow 
> DOM,
> can we add a flag to auto-create shadow DOM for custom elements?
> 
> In particular, can we add "template" as the third argument to 
> document.register so that
> when a custom element is "instantiated", the specified template is 
> automatically closed
> and inserted into a shadow DOM of the custom element.
> 
> 
> Can you explain the advantage of this? It saves one line of code:
> 
> this.createShadowRoot().appendChild(document.importNode(template.contents));
> 
> I don't see how pushing that one line down into the browser is helping anyone.

It'll be insane for force hundreds of thousands of authors to write that same 
line.

> Supporting <template> in document.register is easily done in script, so I 
> believe it's better left to developers as they're better at building 
> frameworks than we are.

Why would adding an optional argument to support the most common use case 
prevent developers from building frameworks?

Also, I don't consider adding an optional argument to document.register not to 
force authors having to write the same boilerplate every time they use custom 
elements as "building frameworks" even if your promise, authors are better at 
building frameworks, were true.

- R. Niwa

Reply via email to