Re: [w3c/webcomponents] Non-class based example of customElement.define() (#587)

I've verified that both the ES6 and the [Babel transpiled version works](https://babeljs.io/repl/#?babili=false&evaluate=true&lineWrap=false&presets=es2015%2Creact%2Cstage-2&code=HTMLElement%20%3D%20(function%20(OriginalHTMLElement)%20%7B%0A%20%20function%20BabelHTMLElement()%0A%20%20%7B%0A%20%20%20%20if%20(typeof%20Reflect%20%3D%3D%20'undefined'%20%7C%7C%20typeof%20Reflect.construct%20!%3D%20'function'%20%7C%7C%20typeof%20customElements%20%3D%3D%20'undefined')%20%7B%0A%20%20%20%20%20%20%2F%2F%20Use%20your%20favorite%20polyfill.%0A%20%20%20%20%7D%0A%20%20%20%20const%20newTarget%20%3D%20this.__proto__.constructor%3B%0A%20%20%20%20return%20Reflect.construct(OriginalHTMLElement%2C%20%5B%5D%2C%20newTarget)%3B%0A%20%20%7D%0A%20%20Object.setPrototypeOf(BabelHTMLElement%2C%20OriginalHTMLElement)%3B%0A%20%20Object.setPrototypeOf(BabelHTMLElement.prototype%2C%20OriginalHTMLElement.prototype)%3B%0A%20%20return%20BabelHTMLElement%3B%0A%7D)(HTMLElement)%3B%0A%0Aclass%20MyElement%20extends%20HTMLElement%20%7B%0A%20%20constructor()%20%7B%0A%20%20%20%20super()%3B%0A%20%20%20%20this._id%20%3D%201%3B%0A%20%20%7D%0A%7D%0A%0AcustomElements.define('my-element'%2C%20MyElement)%3B).

-- 
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-254148324

Received on Monday, 17 October 2016 08:46:08 UTC