Subclassing Event/CustomEvent interface breaks prototype chain

Issue #11923584 • Assigned to Travis L.

Details

Author
Kagami R.
Created
May 6, 2017
Privacy
This issue is public.
Found in
  • Microsoft Edge
Found in build #
15.16188
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

class AsyncEvent extends Event { }; new AsyncEvent("name") instanceof AsyncEvent

Expected: true as it is on Firefox and Chrome

Actual: false

This affects Custom Elements defining their own events.

Attachments

0 attachments

    Comments and activity

    • Workaround: Resetting prototype

      class AsyncEvent extends Event { 
        constructor(name) {
          super(name);
          Object.setPrototypeOf(this, AsyncEvent.prototype);
        }
      };
      new AsyncEvent("name") instanceof AsyncEvent // true
      
    • Changed Title from “Subclassing Event interface breaks prototype chain” to “Subclassing Event/CustomEvent interface breaks prototype chain”

    • Microsoft Edge Team

      Changed Assigned To to “James M.”

      Changed Assigned To to “Travis L.”

      Changed Title from “Subclassing Event/CustomEvent interface breaks prototype chain” to “Subclassing Event/CustomEvent interface breaks prototype chain”

      Changed Title from “Subclassing Event/CustomEvent interface breaks prototype chain” to “Subclassing Event/CustomEvent interface breaks prototype chain”

    You need to sign in to your Microsoft account to add a comment.

    Sign in