mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-15 04:13:11 +00:00
LibWeb: Add Event.initEvent
Used by YouTube after creating an event with Document.createEvent
This commit is contained in:
parent
8da14bf880
commit
fc9abee84b
|
@ -56,4 +56,27 @@ void Event::set_cancelled_flag()
|
|||
m_cancelled = true;
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-event-initialize
|
||||
void Event::initialize(const String& type, bool bubbles, bool cancelable)
|
||||
{
|
||||
m_initialized = true;
|
||||
m_stop_propagation = false;
|
||||
m_stop_immediate_propagation = false;
|
||||
m_cancelled = false;
|
||||
m_is_trusted = false;
|
||||
m_target = nullptr;
|
||||
m_type = type;
|
||||
m_bubbles = bubbles;
|
||||
m_cancelable = cancelable;
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-event-initevent
|
||||
void Event::init_event(const String& type, bool bubbles, bool cancelable)
|
||||
{
|
||||
if (m_dispatch)
|
||||
return;
|
||||
|
||||
initialize(type, bubbles, cancelable);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -154,6 +154,8 @@ public:
|
|||
m_stop_immediate_propagation = true;
|
||||
}
|
||||
|
||||
void init_event(const String&, bool, bool);
|
||||
|
||||
protected:
|
||||
explicit Event(const FlyString& type)
|
||||
: m_type(type)
|
||||
|
@ -161,6 +163,8 @@ protected:
|
|||
{
|
||||
}
|
||||
|
||||
void initialize(const String&, bool, bool);
|
||||
|
||||
private:
|
||||
FlyString m_type;
|
||||
RefPtr<EventTarget> m_target;
|
||||
|
|
|
@ -23,4 +23,6 @@ interface Event {
|
|||
|
||||
readonly attribute boolean isTrusted;
|
||||
|
||||
undefined initEvent(DOMString type, optional boolean bubbles = false, optional boolean cancelable = false);
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue