Re: [w3c/webcomponents] The is="" attribute is confusing? Maybe we should encourage only ES6 class-based extension. (#509)

We won't be supporting `extends` either.

One fundamental problem is that subclassing a subclass of `HTMLInputElement` or `HTMLImageElement` often leads to a violation of the [Liskov substitution principle](https://en.wikipedia.org/wiki/Liskov_substitution_principle) over time.  Because they're builtin elements, they're very likely to be extended in the future.  Imagine that we had this feature supported before `type=date` was added.  Then your subclass of `HTMLInputElement` must also support `type=date` in order to satisfy the substitution principle.  Similarly, imagine we had added this feature before `srcset` was added to `HTMLImageElement` and you wrote a subclass of `HTMLImageElement`.  Then not supporting `srcset` results in the violation of the principle again.

In addition, none of the builtin elements are designed to be subclassed, and in fact, we don't have builtin subclasses of `HTMLElement` that are also builtins.  This limits the usefulness of any sort of subclassing.  Furthermore, we don't have any hooks for the processing models and internal states of builtin elements such as the dirtiness of `HTMLImageElement`'s value and when and how `HTMLInputElement` picks the appropriate image.

Finally, the whole design of `is=` is a [hack](https://wiki.whatwg.org/wiki/Custom_Elements#Subclassing_existing_elements), and it would harm the long term health of the Web platform.

---
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/509#issuecomment-230700060

Received on Wednesday, 6 July 2016 07:38:40 UTC