Bug 183629 - Allow extending of event objects
Summary: Allow extending of event objects
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-14 05:56 PDT by Jake Archibald
Modified: 2020-04-17 15:03 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jake Archibald 2018-03-14 05:56:38 PDT
class Foo extends Event {}
console.log(new Foo('bar').constructor);

Chrome & Firefox say Foo, Edge & Safari say Event.

The Chrome/Firefox behaviour is preferable, as it allows you to create custom event objects, which is especially useful when developing custom elements.
Comment 2 Lucas Forschler 2019-02-06 09:19:17 PST
Mass move bugs into the DOM component.
Comment 3 Alexey Shvayka 2020-04-17 15:03:38 PDT
(In reply to Jake Archibald from comment #1)
> Tests: http://w3c-test.org/dom/events/Event-subclasses-constructors.html

As of r256716, extending Event (as well as other DOM constructors) works as expected.
Provided test file is 100% passing.