mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb/DOM: Stop adding duplicates to the agent's signal_slots
We use a Vector for this, but its spec definition is an ordered set. That means we need to ensure we don't add duplicates. This fixes issues where we would send slotchange events multiple times to the same HTMLSlotElement.
This commit is contained in:
parent
6e17503423
commit
e691f0e10f
Notes:
github-actions[bot]
2025-11-21 15:21:07 +00:00
Author: https://github.com/AtkinsSJ
Commit: e691f0e10f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6897
Reviewed-by: https://github.com/awesomekling
2 changed files with 21 additions and 19 deletions
|
|
@ -256,7 +256,10 @@ void assign_a_slot(Slottable const& slottable)
|
|||
void signal_a_slot_change(GC::Ref<HTML::HTMLSlotElement> slottable)
|
||||
{
|
||||
// 1. Append slot to slot’s relevant agent’s signal slots.
|
||||
HTML::relevant_similar_origin_window_agent(slottable).signal_slots.append(slottable);
|
||||
// NB: signal_slots is supposed to be a set, so ensure the slottable is not already there.
|
||||
auto& signal_slots = HTML::relevant_similar_origin_window_agent(slottable).signal_slots;
|
||||
if (!signal_slots.contains_slow(slottable))
|
||||
signal_slots.append(slottable);
|
||||
|
||||
// 2. Queue a mutation observer microtask.
|
||||
Bindings::queue_mutation_observer_microtask(slottable->document());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue