Hi,
as stated here http://api.jquery.com/jQuery.proxy/
-
- additionalArguments
- Type: Anything
- Any number of arguments to be passed to the function referenced in the
function
argument.
I understand ... the arguments are added after (additional) the already existing ones, i.e.
- var fn = $.proxy(function(a, b, c, extra) {
- alert(a + ' ' + b + ' ' + c + ' ' + extra);
- }, this, 'x');
- fn('a', 'b', 'c');
I would expect to see the alert box with 'a b c x' inside, but I get 'x a b c' because the additionalArguments are added before the ones used to call the function in the first place.
This can be seen in the source code (where `args` are the arguments {2,} as passed to the .proxy method, so they are passed first...):
- return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) );
Is this the expected behavior or a bug? cause it's not really clear
in the docs what is the resulting argument order.