Re: [w3c/webcomponents] Can't reuse custom element constructors? (#618)

There was [some discussion in a separate issue](https://github.com/w3c/webcomponents/issues/509#issuecomment-230703725) about the ambiguity of having the same constructor used for different elements being something that should be moved away from.

It was in reference to how it'd be nice to be able to infer the customised built-in using the extended HTML element, such as `HTMLParagraphElement` - instead of using the `is` attribute. However, this is *not* possible across the board because `HTMLQuoteElement` serves both `<blockquote>` and `<q>`, so there's no way to actually tell which one the custom element author wanted to customise. If the spec were to allow for the same constructor to be used for multiple custom elements, this would perpetuate that problem.

I don't see much of an issue with this as you can just do the following:

```js
class A extends HTMLElement {}
class B extends A {}

customElements.define('x-a', A);
customElements.define('x-b', A);
```

-- 
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/618#issuecomment-268668469

Received on Wednesday, 21 December 2016 23:11:47 UTC