Skip to content

Commit c4dc4d9

Browse files
committed
Fix legacy Function.prototype.bind support
The current legacy support was throwing errors on some mobile devices (specifically an HTC Sense running Android 2.3.4). The value of args should be determined by the arguments passed to bind, not to the bound function. Several places throughout the codebase bind is used in this manner, so the legacy function should support it.
1 parent c45c867 commit c4dc4d9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cocos2d/core/platform/CCClass.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,9 @@ ClassManager.compileSuper.ClassManager = ClassManager;
183183

184184
Function.prototype.bind = Function.prototype.bind || function (bind) {
185185
var self = this;
186+
var args = Array.prototype.slice.call(arguments, 1);
186187
return function () {
187-
var args = Array.prototype.slice.call(arguments);
188-
return self.apply(bind || null, args);
188+
return self.apply(bind || null, args.concat(Array.prototype.slice.call(arguments)));
189189
};
190190
};
191191

0 commit comments

Comments
 (0)