Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

V1, Internet Explorer, prototype and Reflect.construct() #97

@noopole

Description

@noopole

I'm trying to make my custom elements v1 work with Internet Explorer 11.
Because I cannot use "class" in IE, I use the "prototype" way to define a Custom Element.

function CE () {
    return Reflect.construct( HTMLElement, [], CE )
}
CE.prototype = Object.create( HTMLElement.prototype )
CE.prototype.connectedCallback = function () { console.log( 'connected!' ) }
customElements.define( 'c-e', CE )

That works fine with Chrome with no polyfill, and with Internet Explorer 11 with this polyfill. When I use the polyfill and Chrome in the same time I get the following exception:

TypeError: Cannot read property 'create' of undefined
at new CustomElementsV1 (document-register-element.max.js:1357)
at CE (ce.html:21)
at CustomElementRegistry.define (document-register-element.max.js:1226)
at ce.html:52

I can catch the error and return nothing, then it's fine too but I'll get another exception ("super() should be called in the constructor()").

Is there a way to avoid the (first) error in Chrome?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions