[w3c/webcomponents] HTMLElement.prototype needs to define the custom element callbacks. (#582)

`HTMLElement.prototype` should define all of `connectedCallback`, `disconnectedCallback`, `adoptedCallback`, and `attributeChangedCallback`. Without them, creating anonymous subclasses ('mixins') is more awkward since you aren't able to safely call the function you are overriding without explicitly checking if the function exists.

```javascript
const AlertOnConnected = Base => class extends Base {
  connectedCallback(name, value) {
    super.connectedCallback(...arguments);
    alert("I was connected!");
  }
};

const TestElement = class extends AlertOnConnected(HTMLElement) {};
customElements.define("test-element", TestElement);

const testElementInstance = document.createElement("test-element");
document.body.appendChild(testElementInstance); // Throws!
```

-- 
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/582

Received on Friday, 7 October 2016 01:49:13 UTC