Re: [webcomponents] defineElement should not cache lifecycle callbacks and prototype of a custom element class (#417)

I don't feel too strongly about this, and would like to defer to @esprehn and others he thinks are best to consult. But:

> This behavior precludes authors from overriding method on a particular instance of a custom element. In order to change even a single instance's behavior, you would have to define a new custom element or make the element call its own delegate method which is unnecessary boilerplate.

I think this is actually a desirable property. A given class of elements is supposed to have fixed behavior. Just like overriding `myEl.click = ...` does not change the behavior when an element is clicked, overriding `myEl.attributeChangedCallback = ...` should not change the behavior when an element is changed. Per-element runtime customization should not be a goal of custom element callbacks, IMO.

If an element is specifically designed to be extensible in this way, and have per-instance customizability, then I think an opt-in via `attributeChangedCallback(...args) { onAttributeChanged(...args) }` or similar makes a lot of sense, and doesn't count as unnecessary boilerplate.

What do you think?

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

Received on Saturday, 5 March 2016 06:43:11 UTC