Bug 183629

Summary: Allow extending of event objects
Product: WebKit Reporter: Jake Archibald <jaffathecake>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED CONFIGURATION CHANGED    
Severity: Normal CC: ashvayka
Priority: P2    
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=174313

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.