Skip to content

Commit 0de1cf0

Browse files
KhafraDevaduh95
authored andcommitted
events: return currentTarget when dispatching
PR-URL: nodejs#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]>
1 parent c6ae161 commit 0de1cf0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/internal/event_target.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ class Event {
196196
get currentTarget() {
197197
if (!isEvent(this))
198198
throw new ERR_INVALID_THIS('Event');
199-
return this[kTarget];
199+
return this[kIsBeingDispatched] ? this[kTarget] : null;
200200
}
201201

202202
/**

0 commit comments

Comments
 (0)