Clean up Event#currentTarget handlig.

This commit is contained in:
Jürg Lehni 2016-06-19 10:55:04 +02:00
parent cc55991b66
commit 739788b67e

View file

@ -81,8 +81,9 @@ var Emitter = {
if (!handlers)
return false;
var args = [].slice.call(arguments, 1),
setTarget = event && typeof event === 'object' && 'target' in event
&& !('currentTarget' in event);
// Set the current target to `this` if the event object defines
// #target but not #currentTarget.
setTarget = event && event.target && !event.currentTarget;
// Create a clone of the handlers list so changes caused by on / off
// won't throw us off track here:
handlers = handlers.slice();