- From: Ibrahim Tanyalcin <notifications@github.com>
- Date: Fri, 05 Oct 2018 09:44:23 -0700
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Friday, 5 October 2018 16:52:12 UTC
@justinfagnani, your example works as well if we remove the <code>Object.setPrototypeOf(MyEl, HTMLElement);</code> Why is it necessary anyway? This works: ```js function MyEl() { return Reflect.construct(HTMLElement,[], this.constructor); } MyEl.prototype = Object.create(HTMLElement.prototype); MyEl.prototype.constructor = MyEl; Object.setPrototypeOf(MyEl, HTMLElement); MyEl.prototype.connectedCallback = function() { console.log('my-el connected'); }; customElements.define('my-el', MyEl); document.body.appendChild(document.createElement('my-el')); ``` _Originally posted by @justinfagnani in https://github.com/w3c/webcomponents/issues/587#issuecomment-378684197_ -- 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/766
Received on Friday, 5 October 2018 16:52:12 UTC