From f892d5e6770cb983771e75be019d501fe152dc26 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Tue, 17 Apr 2018 10:31:09 +0800 Subject: [PATCH] Fix event target type check issue --- cocos2d/core/event/event-target.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos2d/core/event/event-target.js b/cocos2d/core/event/event-target.js index 765bf9084a..75934a501d 100644 --- a/cocos2d/core/event/event-target.js +++ b/cocos2d/core/event/event-target.js @@ -239,7 +239,7 @@ proto.hasEventListener = function (type, checkCapture) { */ proto.on = function (type, callback, target, useCapture) { // Accept also patameters like: (type, callback, useCapture) - if (useCapture === undefined) { + if (typeof target === 'boolean') { useCapture = target; target = undefined; } @@ -296,7 +296,7 @@ proto.on = function (type, callback, target, useCapture) { */ proto.off = function (type, callback, target, useCapture) { // Accept also patameters like: (type, callback, useCapture) - if (useCapture === undefined) { + if (typeof target === 'boolean') { useCapture = target; target = undefined; }