Skip to content

Commit

Permalink
events: return currentTarget when dispatching
Browse files Browse the repository at this point in the history
PR-URL: #54642
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Mattias Buelens <mattias@buelens.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
KhafraDev authored and marco-ippolito committed Nov 17, 2024
1 parent 3a682cc commit 453df77
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/internal/event_target.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class Event {
get currentTarget() {
if (!isEvent(this))
throw new ERR_INVALID_THIS('Event');
return this[kTarget];
return this[kIsBeingDispatched] ? this[kTarget] : null;
}

/**
Expand Down

0 comments on commit 453df77

Please sign in to comment.