1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:07:35 +00:00

LibWeb: Add initial support for CustomEvent

This is used surprisingly often. For example, it is used by a core
YouTube library called Structured Page Fragments.

It allows you to manually dispatch an event with arbitrary data
attached to it.

The only thing missing from this implementation is the constructor.
This is because WrapperGenerator is currently missing dictionary
capabilities.
This commit is contained in:
Luke Wilde 2021-09-27 16:10:56 +01:00 committed by Andreas Kling
parent b04fafee74
commit f7ac3545cc
8 changed files with 99 additions and 1 deletions

View file

@ -18,6 +18,7 @@
#include <LibWeb/CSS/StyleComputer.h>
#include <LibWeb/Cookie/ParsedCookie.h>
#include <LibWeb/DOM/Comment.h>
#include <LibWeb/DOM/CustomEvent.h>
#include <LibWeb/DOM/DOMException.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/DocumentFragment.h>
@ -739,7 +740,7 @@ NonnullRefPtr<Event> Document::create_event(const String& interface)
} else if (interface_lowercase == "compositionevent") {
event = Event::create(""); // FIXME: Create CompositionEvent
} else if (interface_lowercase == "customevent") {
event = Event::create(""); // FIXME: Create CustomEvent
event = CustomEvent::create("");
} else if (interface_lowercase == "devicemotionevent") {
event = Event::create(""); // FIXME: Create DeviceMotionEvent
} else if (interface_lowercase == "deviceorientationevent") {