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 targos committed Oct 4, 2024
1 parent e1f36d0 commit cb47e16
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 @@ -196,7 +196,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 cb47e16

Please sign in to comment.