Skip to content

Commit 19405ca

Browse files
committed
Fix bound functions in IE8
1 parent 5271462 commit 19405ca

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

underscore.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -701,17 +701,18 @@
701701
if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
702702
if (!_.isFunction(func)) throw new TypeError('Bind must be called on a function');
703703
var args = slice.call(arguments, 2);
704-
return function bound() {
704+
var bound = function() {
705705
return executeBound(func, bound, context, this, args.concat(slice.call(arguments)));
706706
};
707+
return bound;
707708
};
708709

709710
// Partially apply a function by creating a version that has had some of its
710711
// arguments pre-filled, without changing its dynamic `this` context. _ acts
711712
// as a placeholder, allowing any combination of arguments to be pre-filled.
712713
_.partial = function(func) {
713714
var boundArgs = slice.call(arguments, 1);
714-
return function bound() {
715+
var bound = function() {
715716
var position = 0, length = boundArgs.length;
716717
var args = Array(length);
717718
for (var i = 0; i < length; i++) {
@@ -720,6 +721,7 @@
720721
while (position < arguments.length) args.push(arguments[position++]);
721722
return executeBound(func, bound, this, this, args);
722723
};
724+
return bound;
723725
};
724726

725727
// Bind a number of an object's methods to that object. Remaining arguments

0 commit comments

Comments
 (0)