Don't fire slotchange events when there's already a pending event for the same slot (#35222)

* Don't fire slotchange events if there is already a pending event for the same slot

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Update WPT expectations

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2025-01-30 14:57:04 +01:00 committed by GitHub
parent 5e9de2cb61
commit 64b40ea700
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 33 additions and 49 deletions

View file

@ -529,6 +529,9 @@ impl ScriptThread {
.signal_slots
.take()
.into_iter()
.inspect(|slot| {
slot.remove_from_signal_slots();
})
.map(|slot| slot.as_rooted())
.collect()
})
@ -3746,15 +3749,6 @@ impl ScriptThread {
)
}
}
/// <https://dom.spec.whatwg.org/#signal-a-slot-change>
pub(crate) fn signal_a_slot_change(slot: &HTMLSlotElement) {
// Step 1. Append slot to slots relevant agents signal slots.
ScriptThread::add_signal_slot(slot);
// Step 2. Queue a mutation observer microtask.
MutationObserver::queue_mutation_observer_microtask();
}
}
impl Drop for ScriptThread {