diff --git a/cocos2d/core/components/CCLabel.js b/cocos2d/core/components/CCLabel.js index 0fb83f157c..89b2e75b4f 100644 --- a/cocos2d/core/components/CCLabel.js +++ b/cocos2d/core/components/CCLabel.js @@ -134,18 +134,14 @@ function debounce (func, wait, immediate) { if (callNow) func.apply(context, args); } : function () { var context = this; - var args = new Array(arguments.length); - for (var i = 0; i < arguments.length; i++) { - args[i] = arguments[i]; - } var later = function() { timeout = null; - if (!immediate) func.apply(context, args); + if (!immediate) func.apply(context, arguments); }; var callNow = immediate && !timeout; clearTimeout(timeout); timeout = setTimeout(later, wait); - if (callNow) func.apply(context, args); + if (callNow) func.apply(context, arguments); }; } diff --git a/cocos2d/core/components/CCRichText.js b/cocos2d/core/components/CCRichText.js index 4ef0be0231..55fa13a377 100644 --- a/cocos2d/core/components/CCRichText.js +++ b/cocos2d/core/components/CCRichText.js @@ -47,18 +47,14 @@ function debounce (func, wait, immediate) { if (callNow) func.apply(context, args); } : function () { var context = this; - var args = new Array(arguments.length); - for (var i = 0; i < arguments.length; i++) { - args[i] = arguments[i]; - } var later = function() { timeout = null; - if (!immediate) func.apply(context, args); + if (!immediate) func.apply(context, arguments); }; var callNow = immediate && !timeout; clearTimeout(timeout); timeout = setTimeout(later, wait); - if (callNow) func.apply(context, args); + if (callNow) func.apply(context, arguments); }; }