mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 12:08:14 +00:00
LibWeb: Make document.createEvent("UIEvent") actually create a UIEvent
There were two things preventing this from working right: - UIEvents::UIEvent::create() was actually just DOM::Event::create() - We didn't return the right JavaScript wrapper type for UIEvent
This commit is contained in:
parent
31508b2788
commit
093e66afc0
2 changed files with 8 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2020-2022, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
|
@ -42,6 +42,8 @@ EventWrapper* wrap(JS::GlobalObject& global_object, DOM::Event& event)
|
|||
return static_cast<MouseEventWrapper*>(wrap_impl(global_object, static_cast<UIEvents::MouseEvent&>(event)));
|
||||
if (is<XHR::ProgressEvent>(event))
|
||||
return static_cast<ProgressEventWrapper*>(wrap_impl(global_object, static_cast<XHR::ProgressEvent&>(event)));
|
||||
if (is<UIEvents::UIEvent>(event))
|
||||
return static_cast<UIEventWrapper*>(wrap_impl(global_object, static_cast<UIEvents::UIEvent&>(event)));
|
||||
return static_cast<EventWrapper*>(wrap_impl(global_object, event));
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,11 @@ class UIEvent : public DOM::Event {
|
|||
public:
|
||||
using WrapperType = Bindings::UIEventWrapper;
|
||||
|
||||
static NonnullRefPtr<UIEvent> create(FlyString const& type)
|
||||
{
|
||||
return adopt_ref(*new UIEvent(type));
|
||||
}
|
||||
|
||||
static NonnullRefPtr<UIEvent> create_with_global_object(Bindings::WindowObject&, FlyString const& event_name, UIEventInit const& event_init)
|
||||
{
|
||||
return adopt_ref(*new UIEvent(event_name, event_init));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue