mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibWeb: Fire slotchange events when a slot is changed
This commit is contained in:
parent
84ecaaa75c
commit
b543523717
Notes:
github-actions[bot]
2025-03-10 18:38:25 +00:00
Author: https://github.com/shannonbooth
Commit: b543523717
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3871
Reviewed-by: https://github.com/trflynn89 ✅
7 changed files with 717 additions and 5 deletions
|
@ -28,6 +28,7 @@
|
|||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/HTML/CustomElements/CustomElementDefinition.h>
|
||||
#include <LibWeb/HTML/EventNames.h>
|
||||
#include <LibWeb/HTML/HTMLSlotElement.h>
|
||||
#include <LibWeb/HTML/Location.h>
|
||||
#include <LibWeb/HTML/PromiseRejectionEvent.h>
|
||||
#include <LibWeb/HTML/Scripting/Agent.h>
|
||||
|
@ -677,9 +678,9 @@ void queue_mutation_observer_microtask(DOM::Document const& document)
|
|||
for (auto& observer : surrounding_agent.mutation_observers)
|
||||
notify_set.append(&observer);
|
||||
|
||||
// FIXME: 3. Let signalSet be a clone of the surrounding agent’s signal slots.
|
||||
|
||||
// FIXME: 4. Empty the surrounding agent’s signal slots.
|
||||
// 3. Let signalSet be a clone of the surrounding agent’s signal slots.
|
||||
// 4. Empty the surrounding agent’s signal slots.
|
||||
auto signal_set = move(surrounding_agent.signal_slots);
|
||||
|
||||
// 5. For each mo of notifySet:
|
||||
for (auto& mutation_observer : notify_set) {
|
||||
|
@ -716,7 +717,12 @@ void queue_mutation_observer_microtask(DOM::Document const& document)
|
|||
}
|
||||
}
|
||||
|
||||
// FIXME: 6. For each slot of signalSet, fire an event named slotchange, with its bubbles attribute set to true, at slot.
|
||||
// 6. For each slot of signalSet, fire an event named slotchange, with its bubbles attribute set to true, at slot.
|
||||
for (auto& slot : signal_set) {
|
||||
DOM::EventInit event_init;
|
||||
event_init.bubbles = true;
|
||||
slot->dispatch_event(DOM::Event::create(slot->realm(), HTML::EventNames::slotchange, event_init));
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue