RESOLVED CONFIGURATION CHANGED Bug 188083
The instanceof operator does not work as expected for classes that extend CustomEvent or Event
https://bugs.webkit.org/show_bug.cgi?id=188083
Summary The instanceof operator does not work as expected for classes that extend Cus...
Eugene Kashida
Reported 2018-07-26 15:47:17 PDT
Overview: class FooEvent extends CustomEvent { constructor() { super('foo'); } }; var foo = new FooEvent(); console.log('This evaluates to "false" which is unexpected', foo instanceof FooEvent); console.log('This evaluates to "true" which is expected', foo instanceof CustomEvent); console.log('This evaluates to "true" which is expected', foo instanceof Event); Expected Results: The instanceof operator, when given an instance of FooEvent which extends CustomEvent, and the FooEvent constructor, should evaluate to "true". Build Date & Hardware: Release 61 (Safari 12.0, WebKit 13606.1.25.1) Mac OS 10.13.6
Attachments
Ryosuke Niwa
Comment 1 2018-07-31 19:06:50 PDT
I don't think class inheritance ever worked with Event's.
Eugene Kashida
Comment 2 2018-08-01 15:12:28 PDT
It seems to be working as expected in Firefox and Chrome, and Edge has the following open issue: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11923584/
Alexey Shvayka
Comment 3 2020-03-22 10:24:58 PDT
(In reply to Eugene Kashida from comment #0) > Expected Results: > > The instanceof operator, when given an instance of FooEvent which extends > CustomEvent, and the FooEvent constructor, should evaluate to "true". As of https://trac.webkit.org/changeset/256716, extending CustomEvent (as well as other DOM constructors) works as expected.
Radar WebKit Bug Importer
Comment 4 2020-03-22 10:25:17 PDT
Note You need to log in before you can comment on or make changes to this bug.