
I can't imagine how this happened, but it seems we've managed to conflate the "event listener" and "EventListener" concepts from the DOM specification in some parts of the code. We previously had two things: - DOM::EventListener - DOM::EventTarget::EventListenerRegistration DOM::EventListener was roughly the "EventListener" IDL type, and DOM::EventTarget::EventListenerRegistration was roughly the "event listener" concept. However, they were used interchangeably (and incorrectly!) in many places. After this patch, we now have: - DOM::IDLEventListener - DOM::DOMEventListener DOM::IDLEventListener is the "EventListener" IDL type, and DOM::DOMEventListener is the "event listener" concept. This patch also updates the addEventListener() and removeEventListener() functions to follow the spec more closely, along with the "inner invoke" function in our EventDispatcher.
35 lines
1.4 KiB
C++
35 lines
1.4 KiB
C++
/*
|
|
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibJS/Interpreter.h>
|
|
#include <LibJS/Parser.h>
|
|
#include <LibWeb/DOM/Document.h>
|
|
#include <LibWeb/DOM/IDLEventListener.h>
|
|
#include <LibWeb/HTML/EventHandler.h>
|
|
#include <LibWeb/HTML/EventNames.h>
|
|
#include <LibWeb/HTML/GlobalEventHandlers.h>
|
|
#include <LibWeb/UIEvents/EventNames.h>
|
|
|
|
namespace Web::HTML {
|
|
|
|
#undef __ENUMERATE
|
|
#define __ENUMERATE(attribute_name, event_name) \
|
|
void GlobalEventHandlers::set_##attribute_name(Optional<Bindings::CallbackType> value) \
|
|
{ \
|
|
global_event_handlers_to_event_target().set_event_handler_attribute(event_name, move(value)); \
|
|
} \
|
|
Bindings::CallbackType* GlobalEventHandlers::attribute_name() \
|
|
{ \
|
|
return global_event_handlers_to_event_target().event_handler_attribute(event_name); \
|
|
}
|
|
ENUMERATE_GLOBAL_EVENT_HANDLERS(__ENUMERATE)
|
|
#undef __ENUMERATE
|
|
|
|
GlobalEventHandlers::~GlobalEventHandlers()
|
|
{
|
|
}
|
|
|
|
}
|