Closed noopole closed 8 years ago
I've found a way after all:
var CEo = function ()
{
console.log( "created" )
return Reflect.construct( HTMLElement, [], CEo )
}
CEo.prototype = Object.create( HTMLElement.prototype )
CEo.prototype.connectedCallback = function ()
{
console.log( "connected" )
this.innerHTML = "Hello v1"
}
customElements.define( "object-v1", CEo )
You wrote about v1:
Do you know how to define shuch a custom element (without the
class
notation) ?I've tried but Chrome raise an error and wants a functionas the second parameter. Exemple:
customElements.define( "object-v1", { prototype: Object.create( HTMLElement.prototype ) } )