Skip to content Skip to sidebar Skip to footer

Webcomponents-lite With Es6 Doesn't Work In Ie 11 And 10

We are using WebComponents with ES6 syntax. WebComponents polyfill webcomponents-lite.js (which doesn't include ShadowDOM) is not working in IE 11 whereas the webcomponents.js (whi

Solution 1:

Yes, you can declare a Custom Element v1 with the original prototype notation.

This works with another polyfill from Web Reflection:

var CEo = function ()
{
    console.log( "created" )
    returnReflect.construct( HTMLElement, [], CEo )
}

CEo.prototype = Object.create( HTMLElement.prototype )
CEo.prototype.constructor = CEo

CEo.prototype.connectedCallback = function ()
{
    console.log( "connected" )
    this.innerHTML = "Hello v1"
} 

customElements.define( "object-v1", CEo ) 

Note: you'll need to use a polyfill like the one of Babel to get Reflect.construct method.

Post a Comment for "Webcomponents-lite With Es6 Doesn't Work In Ie 11 And 10"