Skip to content

Commit

Permalink
Correct once handling for "nested" events
Browse files Browse the repository at this point in the history
If you have two once listeners and the first one dispatches a second event that invokes both listeners, the second listener would be invoked twice as it had already been cloned before it got removed. As such setting its removed field is important after all.

Fixes #1323.
  • Loading branch information
annevk authored Nov 18, 2024
1 parent 7cacda2 commit c2d5aa3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions dom.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1608,10 +1608,8 @@ and an optional <var>legacyOutputDidListenersThrowFlag</var>, run these steps:
<a for="event listener">capture</a> is true, then <a for=iteration>continue</a>.

<li><p>If <var>listener</var>'s <a for="event listener">once</a> is true, then
<a for=list>remove</a> <var>listener</var> from <var>event</var>'s {{Event/currentTarget}}
attribute value's <a for=EventTarget>event listener list</a>.
<!-- Do this before invocation to avoid reentrancy issues. No need to set removed to true since
each listener in listeners is run once anyway. -->
<a>remove an event listener</a> given <var>event</var>'s {{Event/currentTarget}} attribute value
and <var>listener</var>.

<li><p>Let <var>global</var> be <var>listener</var> <a for="event listener">callback</a>'s
<a>associated realm</a>'s <a for=realm>global object</a>.
Expand Down Expand Up @@ -10387,6 +10385,7 @@ Ahmid <i>snuggs</i>,
Alex Komoroske,
Alex Russell,
Alexey Shvayka,
Andreas Kling<!-- awesomekling; GitHub -->,
Andreu Botella,
Anthony Ramine,
Arkadiusz Michalski,
Expand Down

0 comments on commit c2d5aa3

Please sign in to comment.