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

So in IRC @rniwa and I discovered this really doesn't work. You want basically one registry per window, not one registry per document, now that we have the constructor setup.

The reason is basically that, when doing `new CustomElement()`, you don't have any of the information necessary to figure out where that element was registered. You only have the global object of the function. That's, in fact, what we *use* to figure out the registry to do tagname lookup in.

We could fix this in theory by mandating a `document` argument to all custom element constructors (and defaulting it to the current realm's document). But that's pretty frustrating to use for people who are trying to use new createDocument() documents. And we couldn't agree on whether the argument would be a dictionary or not. So instead we think we should just go back to disallowing multiple registries per window.

That means either sharing the registry with the parent (per the current spec) or just saying that they have no registry (and disallowing defineElement in them too).

Side note: we need to check how document.open() affects this since it creates a 1-document to many-windows mapping.

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

Received on Thursday, 3 March 2016 04:11:40 UTC