1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 11:47:46 +00:00

LibWeb: Implement the EventTarget constructor

This is typically used as `class A extends EventTarget`. It's usage can
be found on websites such as https://loadout.tf/

This has the quirk that we don't do set the EventTarget prototype for
HTML::Window, as it would cause a null deref on startup. However, given
it wasn't doing this before, I don't think it should cause any issues.
This commit is contained in:
Luke Wilde 2023-05-03 21:10:26 +01:00 committed by Andreas Kling
parent 1127bdb65c
commit 344785ae3a
3 changed files with 24 additions and 0 deletions

View file

@ -24,6 +24,8 @@ class EventTarget : public Bindings::PlatformObject {
public:
virtual ~EventTarget() override;
static WebIDL::ExceptionOr<JS::NonnullGCPtr<EventTarget>> construct_impl(JS::Realm&);
virtual bool is_focusable() const { return false; }
void add_event_listener(FlyString const& type, IDLEventListener* callback, Variant<AddEventListenerOptions, bool> const& options);
@ -62,6 +64,7 @@ protected:
void element_event_handler_attribute_changed(FlyString const& local_name, Optional<String> const& value);
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
private: