LibWeb/HTML: Add source field to ToggleEventInit

Corresponds to:
95131eec8f

As we now have a field in that dictionary, I removed the separate
`source` parameter from ToggleEvent::create(). Also updated the
relevant test.
This commit is contained in:
Sam Atkins 2025-11-27 16:55:34 +00:00 committed by Tim Ledbetter
parent 99bef81d09
commit e5ea4f9bdf
Notes: github-actions[bot] 2025-12-01 14:59:29 +00:00
7 changed files with 47 additions and 22 deletions

View file

@ -17,6 +17,7 @@ namespace Web::HTML {
struct ToggleEventInit : public DOM::EventInit {
String old_state;
String new_state;
GC::Ptr<DOM::Element> source;
};
class ToggleEvent : public DOM::Event {
@ -24,7 +25,7 @@ class ToggleEvent : public DOM::Event {
GC_DECLARE_ALLOCATOR(ToggleEvent);
public:
[[nodiscard]] static GC::Ref<ToggleEvent> create(JS::Realm&, FlyString const& event_name, ToggleEventInit = {}, GC::Ptr<DOM::Element> source = {});
[[nodiscard]] static GC::Ref<ToggleEvent> create(JS::Realm&, FlyString const& event_name, ToggleEventInit = {});
static WebIDL::ExceptionOr<GC::Ref<ToggleEvent>> construct_impl(JS::Realm&, FlyString const& event_name, ToggleEventInit);
// https://html.spec.whatwg.org/multipage/interaction.html#dom-toggleevent-oldstate
@ -43,7 +44,7 @@ public:
virtual void visit_edges(Cell::Visitor&) override;
private:
ToggleEvent(JS::Realm&, FlyString const& event_name, ToggleEventInit event_init, GC::Ptr<DOM::Element> source);
ToggleEvent(JS::Realm&, FlyString const& event_name, ToggleEventInit event_init);
virtual void initialize(JS::Realm&) override;