From 9b12b53ee7a4c2c0fb0a476f74aa9f741a390e5e Mon Sep 17 00:00:00 2001 From: pandamicro Date: Thu, 14 Jan 2016 19:01:19 +0800 Subject: [PATCH] Fixed indexOf issue on Baidu browser, damn you baidu browser guys ! --- cocos2d/core/platform/callbacks-invoker.js | 4 ++-- cocos2d/core/platform/js.js | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cocos2d/core/platform/callbacks-invoker.js b/cocos2d/core/platform/callbacks-invoker.js index 17e62e82ee..ae304688cc 100644 --- a/cocos2d/core/platform/callbacks-invoker.js +++ b/cocos2d/core/platform/callbacks-invoker.js @@ -76,7 +76,7 @@ CallbacksHandler.prototype.has = function (key, callback, target) { if (callbackTarget === target) { return true; } - index = list.indexOf(callback, index + 1); + index = cc.js.array.indexOf.call(list, callback, index + 1); } // callback given but not found return false; @@ -131,7 +131,7 @@ CallbacksHandler.prototype.remove = function (key, callback, target) { break; } - index = list.indexOf(callback, index + 1); + index = cc.js.array.indexOf.call(list, callback, index + 1); } return true; } diff --git a/cocos2d/core/platform/js.js b/cocos2d/core/platform/js.js index 1bb5289d85..25e6a43fd0 100644 --- a/cocos2d/core/platform/js.js +++ b/cocos2d/core/platform/js.js @@ -628,7 +628,9 @@ js.array = { for (i = 0; i < len; i += 1) arr_clone[i] = array[i]; return arr_clone; - } + }, + + indexOf: Array.prototype.indexOf, }; cc.js = js;