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 <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Mattias Buelens <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Ethan Arrowood <[email protected]>
Reviewed-By: Chemi Atlow <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • 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.