mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:47:45 +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
3 changed files with 29 additions and 0 deletions
|
@ -56,4 +56,27 @@ void Event::set_cancelled_flag()
|
||||||
m_cancelled = true;
|
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;
|
m_stop_immediate_propagation = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void init_event(const String&, bool, bool);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit Event(const FlyString& type)
|
explicit Event(const FlyString& type)
|
||||||
: m_type(type)
|
: m_type(type)
|
||||||
|
@ -161,6 +163,8 @@ protected:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void initialize(const String&, bool, bool);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FlyString m_type;
|
FlyString m_type;
|
||||||
RefPtr<EventTarget> m_target;
|
RefPtr<EventTarget> m_target;
|
||||||
|
|
|
@ -23,4 +23,6 @@ interface Event {
|
||||||
|
|
||||||
readonly attribute boolean isTrusted;
|
readonly attribute boolean isTrusted;
|
||||||
|
|
||||||
|
undefined initEvent(DOMString type, optional boolean bubbles = false, optional boolean cancelable = false);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue