Skip to content
This repository was archived by the owner on Sep 20, 2019. It is now read-only.
This repository was archived by the owner on Sep 20, 2019. It is now read-only.

instance.constructor property is wrong in Safari and IE #215

Closed
@lazd

Description

@lazd

I saw today that custom elements created with webcomponents.js have a constructor property of HTMLUnknownElementConstructor in Safari and HTMLUnknownElement in IE.

Is this an unavoidable side-effect of the polyfill? I would expect it to be the same constructor returned by document.registerElement.

Test code:

var ATag = document.registerElement('a-tag', { prototype: HTMLElement });
var aTag = new ATag();
aTag instanceof ATag // true in Safari, Chrome, etc
aTag.constructor === ATag // false in Safari and IE, but true in Firefox, Chrome

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions