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 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.