Re: [webcomponents] Should HTML parser instantiate custom elements inside a template element? (#406)

> In the v0 spec, if the document has no registry, you can't register new elements. Would something like that work?

Ah, I see.  I think instead of making the document not having a registry, it's probably better for `defineElement` to exit early if the context object is the document for the a `template` element.

> What is the problem with simply allowing this for `template` element documents (and other documents)?

I don't have any problem with instantiating custom elements inside template elements so that authors can make `instanceof` check would on nodes inside a template element.  All builtin elements inside a template are "real" elements so it's rather odd for custom elements to not work that way.  (Note that I'm not saying that registry of template element's document should be shared with that of template's document).

There is an extra cognitive stress for authors to notice this case and avoid doing expensive work or start fetching stuff over network inside custom elements created for a template.  But if the authors are calling `defineElement` on `template.content.ownerDocument`, then they better know what they're doing.

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/406#issuecomment-191357306

Received on Wednesday, 2 March 2016 18:19:55 UTC