Fixing $.proxy to work like (and use) Function.prototype.bind

Description

As it stands currently, $.proxy is in a weird place. It's likely too advanced of a tool for the average user, and crippled for advanced users. It lacks the ability to partially apply arguments and doesn't take advantage of native implementations where available. As well, $.proxy is being used internally to set matching guids (in $.fn.bind and $.fn.toggle), which is an unnecessary performance hit as well as reliance on an indirect side-effect of $.proxy.

I am fully in favour of this landing - partial application is worth it alone, and I agree - the stringy syntax is really not necessary and kinda feels yucky, so I am not averse to losing it. If people have used it in the past year since 1.4 came out, I think we can guide them toward the proper syntax...

I’m not sure what the project’s outlook has been with regards to removing things outright like that in a new version without deprecating it for a release.

(Unrelatedly, I also kind of feel like the method signature should be (thisObj, fn, args…) since that matches other functions that rebind this like Function.call and Function.apply, but that probably won’t happen since it is an even more extreme bc break.)

Back when this was in discussion on the jQuery Core google group, I had argued the same points - and ultimately $.proxy was the outcome - so I'm gladly in favor of this change, I also think (thisObj, fn, args…) should be used - however the function def would be nasty overloaded with ugly argument manipulation.

Back when this was in discussion on the jQuery Core google group, I had argued the same points - and ultimately $.proxy was the outcome - so I'm gladly in favor of this change, I also think (thisObj, fn, args…) should be used - however the function def would be nasty overloaded with ugly argument manipulation.

(Unrelatedly, I also kind of feel like the method signature should be (thisObj, fn, args…) since that matches other functions that rebind this like Function.call and Function.apply, but that probably won’t happen since it is an even more extreme bc break.)

I've followed the style of $.map et al, where the instance which would normally be acted upon is the first argument. E.g.:

ar.map( fn ) → $.map( ar, fn )

fn.bind( context ) → $.proxy( fn, context )

fn.bind( context, arg1, arg2 ) → $.proxy( fn, context, arg1, arg2 )

I think if Function#call were implemented in jQuery it would have the following signature: $.call( fn, context, arg1, argN).