Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7693017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:59:12+00:00 2026-05-31T20:59:12+00:00

In jQuery API doc, the jQuery.proxy function usage: jQuery.proxy( function, context ) function The

  • 0

In jQuery API doc, the jQuery.proxy function usage:

jQuery.proxy( function, context )

function The function whose context will be changed.
context The object to which the context (this) of the function should be set.

jQuery.proxy( context, name )

context The object to which the context of the function should be set.
name The name of the function whose context will be changed (should be a property of the context object).

proxy : function(fn, proxy, thisObject){
    if ( arguments.length === 2 ) {
        if (typeof proxy === "string" ) {
        thisObject = fn;
        fn = thisObject[proxy];
        proxy = undefined;
    } else if ( proxy && !jQuery.isFunction( proxy ) ) {
        thisObject = proxy;
        proxy = undefined;
    }
}
   if ( !proxy && fn ) {
   proxy = function() {
   return fn.apply( thisObject || this, arguments );
   };
}
// So proxy can be declared as an argument
return proxy;
}

But when I look into jQuery source code, of function proxy. I found there’re 3 parameters declared.

So I wonder what’s the use of third param, cannot understand the code 🙁

I write a code segment to test the function.

var someObj = { somefnc : function() {} };
function fnc() {
    this.somefnc();
    console.log(arguments);
}
var proxyedFnc = jQuery.proxy(fnc, undefined, someObj, "arg1","arg2");
proxyedFnc();
//output: []

And I wonder why the arguments were not passed to fnc..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T20:59:13+00:00Added an answer on May 31, 2026 at 8:59 pm

    Below is the source comes from jquery-1.7.2.js, Are you sure you check the same version between source and api doc?

    // Bind a function to a context, optionally partially applying any
    // arguments.
    proxy: function( fn, context ) {
        if ( typeof context === "string" ) {
            var tmp = fn[ context ];
            context = fn;
            fn = tmp;
        }
    
        // 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 ) ) {
            return undefined;
        }
    
        // Simulated bind
        var args = slice.call( arguments, 2 ),
            proxy = function() {
                return fn.apply( context, args.concat( slice.call( arguments ) ) );
            };
    
        // Set the guid of unique handler to the same of original handler, so it can be removed
        proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
    
        return proxy;
    },
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

in this page http://api.jquery.com/category/effects/ when you put 'up'(keyboard) and 'down',then put 'enter',it will go
I am trying to use the focusout( http://api.jquery.com/focusout/ ) function in jQuery, to perform
Can someone tell me how to install this? I go here: http://api.jquery.com/browser/ and click
I have this jQuery code that queries an API on a keyup event (via
In the example of jQuery's find() (the doc is at http://api.jquery.com/find/ ) I wonder
from jquery animate doc i found a sample example where multiple animate function is
I'm using the autocomplete jQuery plugin ( api doc ) that calls a service
In script#, I have the following: jQuery.Select(#someId).Trigger(item-added, new object[]{ball} ); This compiles into the
If I look at the JQuery doc @ http://api.jquery.com/jQuery/#jQuery2 , it says ...If a
This is from jQuery API docs: typeString Default: 'GET' The type of request to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.