- From: Russell Bicknell <notifications@github.com>
- Date: Thu, 06 Oct 2016 18:48:35 -0700
- To: w3c/webcomponents <webcomponents@noreply.github.com>
Received on Friday, 7 October 2016 01:49:13 UTC
`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