Re: [w3c/webcomponents] Scoped Custom Element Registries (#716)

@matthewp While this proposal removes the 1-1 relationship between a tagname and a constructor, it preserves a 1-1 relationship between a constructor and a registration, so for any given constructor call we know what tagname to create, and what registry to associate with the instance. This doesn't require putting constructors into a global set.

In other words:
```js
class MyElement extends HTMLElement {}
customRegistry.define('my-element', MyElement);
const el = new MyElement();
```
would just work. And further:

```js
el.innerHTML = '<my-element></my-element>';
```

would also create a MyElement instance.

For the second question: once upgraded, an element is never downgraded or re-upgraded. Creating an element in one scope and moving it to another should neither change it's prototype, nor the scope associated with the element.

This could conceivably lead to some weird situations where after moving elements around, two elements in the same container produce different results (different prototypes) when setting their `innerHTML` to the same text. I think this is a very edge case, so it'll be really rare (how often are elements initially appended to ShadowRoot, then moved outside that root?) and at least this behavior is consistent.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/716#issuecomment-370286297

Received on Monday, 5 March 2018 01:41:58 UTC