Re: [Custom Elements] They are globals.

> On Apr 11, 2016, at 9:02 AM, /#!/JoePea <trusktr@gmail.com> wrote:
> 
> Is it possible to take an approach more similar to React where Custom Elements aren't registered in a global pool? What if two libraries we'd like to use define elements of the same name, and we wish to import these via `import` and not modify the source code of our dependencies?
> 
> I don't really see the solution yet (if any), since the browser needs to know about the elements in order to make them work.
> 
> Any thoughts? Is a more encapsulated approach possible?

We discussed a similar issue related to having multiple documents per global object: https://github.com/w3c/webcomponents/issues/369 <https://github.com/w3c/webcomponents/issues/369>

The problem here is that HTMLElement constructor, which is involved as a super call in a custom element constructor, cannot determine which set of custom elements to use because it doesn't get any contextual information about where the element is constructed.

- R. Niwa

Received on Monday, 11 April 2016 17:35:32 UTC