diff --git a/Userland/Libraries/LibWeb/UIEvents/UIEvent.h b/Userland/Libraries/LibWeb/UIEvents/UIEvent.h index 3393d0b2d6..d410922179 100644 --- a/Userland/Libraries/LibWeb/UIEvents/UIEvent.h +++ b/Userland/Libraries/LibWeb/UIEvents/UIEvent.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Andreas Kling + * Copyright (c) 2020-2022, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ @@ -36,6 +36,13 @@ public: DOM::Window const* view() const { return m_view; } int detail() const { return m_detail; } + void init_ui_event(String const& type, bool bubbles, bool cancelable, DOM::Window* view, int detail) + { + init_event(type, bubbles, cancelable); + m_view = view; + m_detail = detail; + } + protected: explicit UIEvent(FlyString const& event_name) : Event(event_name) diff --git a/Userland/Libraries/LibWeb/UIEvents/UIEvent.idl b/Userland/Libraries/LibWeb/UIEvents/UIEvent.idl index d317d3011a..94431c183f 100644 --- a/Userland/Libraries/LibWeb/UIEvents/UIEvent.idl +++ b/Userland/Libraries/LibWeb/UIEvents/UIEvent.idl @@ -4,6 +4,9 @@ interface UIEvent : Event { constructor(DOMString type, optional UIEventInit eventInitDict = {}); readonly attribute Window? view; readonly attribute long detail; + + // NOTE: This is "deprecated, but supported for backwards-compatibility with widely-deployed implementations." + [ImplementedAs=init_ui_event] undefined initUIEvent(DOMString typeArg, optional boolean bubblesArg = false, optional boolean cancelableArg = false, optional Window? viewArg = null, optional long detailArg = 0); }; dictionary UIEventInit : EventInit {