diff options
author | Luke Wilde <lukew@serenityos.org> | 2021-10-01 01:09:11 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-10-01 02:10:56 +0200 |
commit | 971d60c329cced524ea0e7efc88adb95f5cad64c (patch) | |
tree | 5ceb244e279ac0d3c363ef4224c2c68575a99a24 /Userland | |
parent | de723329205c8242cf78dcc6f028bc9fece85059 (diff) | |
download | serenity-971d60c329cced524ea0e7efc88adb95f5cad64c.zip |
LibWeb: Implement AbortSignal.onabort
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/AbortSignal.cpp | 11 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/AbortSignal.h | 3 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/AbortSignal.idl | 2 |
3 files changed, 15 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/AbortSignal.cpp b/Userland/Libraries/LibWeb/DOM/AbortSignal.cpp index 9f7bcecdd3..94845e93a7 100644 --- a/Userland/Libraries/LibWeb/DOM/AbortSignal.cpp +++ b/Userland/Libraries/LibWeb/DOM/AbortSignal.cpp @@ -8,6 +8,7 @@ #include <LibWeb/DOM/AbortSignal.h> #include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/EventDispatcher.h> +#include <LibWeb/HTML/EventHandler.h> namespace Web::DOM { @@ -50,4 +51,14 @@ void AbortSignal::signal_abort() dispatch_event(Event::create(HTML::EventNames::abort)); } +void AbortSignal::set_onabort(HTML::EventHandler event_handler) +{ + set_event_handler_attribute(HTML::EventNames::abort, event_handler); +} + +HTML::EventHandler AbortSignal::onabort() +{ + return event_handler_attribute(HTML::EventNames::abort); +} + } diff --git a/Userland/Libraries/LibWeb/DOM/AbortSignal.h b/Userland/Libraries/LibWeb/DOM/AbortSignal.h index cca548e985..c3ecfe0dcb 100644 --- a/Userland/Libraries/LibWeb/DOM/AbortSignal.h +++ b/Userland/Libraries/LibWeb/DOM/AbortSignal.h @@ -46,6 +46,9 @@ public: void signal_abort(); + void set_onabort(HTML::EventHandler); + HTML::EventHandler onabort(); + // ^EventTarget virtual void ref_event_target() override { ref(); } virtual void unref_event_target() override { unref(); } diff --git a/Userland/Libraries/LibWeb/DOM/AbortSignal.idl b/Userland/Libraries/LibWeb/DOM/AbortSignal.idl index 6bb9cd81a5..4fda402027 100644 --- a/Userland/Libraries/LibWeb/DOM/AbortSignal.idl +++ b/Userland/Libraries/LibWeb/DOM/AbortSignal.idl @@ -4,5 +4,5 @@ interface AbortSignal : EventTarget { readonly attribute boolean aborted; - // FIXME: attribute EventHandler onabort; + attribute EventHandler onabort; }; |