Re: [webcomponents] Change registries to be per document and never shared between documents (#369)

In IRC @jakearchibald mentioned a third alternative which has been floating around in my brain for a while:

3. Maintain a per-event loop (really per unit of related similar-origin browsing contexts, since workers aren't relevant) mapping table of custom element constructors to documents. This could ensure that `new CustomElement()` always knows what document to work in.
  - This is similar to (1) but means there are separate registries for `createDocument()`-documents, instead of sharing them with the parent or prohibiting registration there.
  - This breaks the connection `document.createElement("x-tag")` <-> `new XTag()`.
  - But on the other hand if you do `someOtherDoc.defineElement("x-tag", XTag)` and then `new XTag()` you probably know what you're doing and will understand that the equivalent is `someOtherDoc.createElement("x-tag")`.

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

Received on Thursday, 3 March 2016 13:57:25 UTC