Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct once handling for "nested" events #1324

Merged
merged 2 commits into from
Nov 18, 2024
Merged

Correct once handling for "nested" events #1324

merged 2 commits into from
Nov 18, 2024

Conversation

annevk
Copy link
Member

@annevk annevk commented Nov 18, 2024

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.

  • At least two implementers are interested (and none opposed):
    • Already implemented.
  • Tests are written and can be reviewed and commented upon at:
    • Already tested, see issue.
  • Implementation bugs are filed:
    • N/A.
  • MDN issue is filed: N/A
  • The top of this comment includes a clear commit message to use.

(See WHATWG Working Mode: Changes for more details.)


Preview | Diff

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.
@annevk annevk merged commit c2d5aa3 into main Nov 18, 2024
2 checks passed
@annevk annevk deleted the fix-once- branch November 18, 2024 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

"inner invoke" of event listener with "once" doesn't mark listener as "removed"
2 participants