- From: Ryosuke Niwa <notifications@github.com>
- Date: Mon, 17 Oct 2016 00:01:52 -0700
- To: w3c/webcomponents <webcomponents@noreply.github.com>
Received on Monday, 17 October 2016 07:02:31 UTC
Note that you can be more sleek with something like this (*although I highly discourage you to override the native `HTMLElement` interface like this but sooner or later someone is gonna realize and do it so I'm gonna leave it here*).
```js
HTMLElement = (function (OriginalHTMLElement) {
function BabelHTMLElement()
{
const newTarget = this.__proto__.constructor;
return Reflect.construct(OriginalHTMLElement, [], newTarget);
}
Object.setPrototypeOf(BabelHTMLElement, OriginalHTMLElement);
Object.setPrototypeOf(BabelHTMLElement.prototype, OriginalHTMLElement.prototype);
return BabelHTMLElement;
})(HTMLElement);
class MyElement extends HTMLElement {
constructor() {
super();
this._id = 1;
}
}
customElements.define('my-element', MyElement);
```
--
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/587#issuecomment-254127883
Received on Monday, 17 October 2016 07:02:31 UTC