Skip to content

Commit 9559d88

Browse files
Don't overwrite Function.prototype.bind if it's already defined, whether by the native version of bind or by a pre-existing polyfill.
1 parent 2e82af2 commit 9559d88

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/prototype/lang/function.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,16 +392,20 @@ Object.extend(Function.prototype, (function() {
392392
return __method.apply(null, a);
393393
};
394394
}
395-
396-
return {
395+
396+
var extensions = {
397397
argumentNames: argumentNames,
398-
bind: bind,
399398
bindAsEventListener: bindAsEventListener,
400399
curry: curry,
401400
delay: delay,
402401
defer: defer,
403402
wrap: wrap,
404403
methodize: methodize
405-
}
404+
};
405+
406+
if (!Function.prototype.bind)
407+
extensions.bind = bind;
408+
409+
return extensions;
406410
})());
407411

0 commit comments

Comments
 (0)