Perf. improvement based on fearphage's suggestion (direct vs call vs apply).

This commit is contained in:
Gianni Chiappetta 2010-12-18 19:17:37 -05:00
parent 1ebb5ab3e1
commit 6bc9fc7c10

View file

@ -754,7 +754,11 @@ jQuery.extend({
if ( jQuery.support.nativeBind ) { if ( jQuery.support.nativeBind ) {
// Native bind // Native bind
args = slice.call( arguments, 1 ); args = slice.call( arguments, 1 );
proxy = Function.prototype.bind.apply( fn, args ); if ( args.length ) {
proxy = Function.prototype.bind.apply( fn, args );
} else {
proxy = fn.bind( context );
}
} else { } else {
// Simulated bind // Simulated bind
args = slice.call( arguments, 2 ); args = slice.call( arguments, 2 );