proxy: function( fn, context ) {
var args, proxy;
+ // XXX BACKCOMPAT: Support old string method.
+ if ( typeof context === "string" ) {
+ fn = fn[ context ];
+ context = arguments[0];
+ }
+
// Quick check to determine if target is callable, in the spec
// this throws a TypeError, but we will just return undefined.
if ( ! jQuery.isFunction( fn ) ) {
});
test("jQuery.proxy", function(){
- expect(5);
+ expect(6);
var test = function(){ equals( this, thisObject, "Make sure that scope is set properly." ); };
var thisObject = { foo: "bar", method: test };
// Partial application w/ normal arguments
var test3 = function( a, b ){ equals( b, "normal", "Ensure arguments can be pre-applied and passed as usual." ); };
jQuery.proxy( test3, null, "pre-applied" )( "normal" );
+
+ // Test old syntax
+ var test4 = { meth: function( a ){ equals( a, "boom", "Ensure old syntax works." ); } };
+ jQuery.proxy( test4, "meth" )( "boom" );
});
test("jQuery.parseJSON", function(){