-
Notifications
You must be signed in to change notification settings - Fork 20.5k
[1.9] Change proxy to allow arguments currying without overwriting context #866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Is there a ticket associated to this? If not, please file at http://bugs.jquery.com. Additionally, you'll need to provide test cases that support the change. Thanks! |
|
I wonder if there are people intentionally passing |
|
What @scottgonzalez says. It's a breaking change so what @rwldrn says, let's start with a ticket to discuss this and get a clear view at what it entails ;) |
|
Thanks for your replies. I hope it wasn't rude to create this pull request. |
|
How could a pull request be rude? Don't worry, we love pull requests! :) We're just trying to ensure no one works hard on a pull request just to see it rejected. The idea is to create a ticket to get proper and extensive discussion then to see the idea green-lighted or rejected. Then, if the idea is accepted, code can be safely produced and reviewed. We're just trying to avoid a lot of frustrations here ;) |
|
+1 @jaubourg Tickets also give us a history, so if something is no good, we can point the next person to the ticket, instead of re-explaining from scratch. |
Since the |
|
Should this "new signature" be backed up by a unit test? |
|
@dmethvin : I signed the CLA yesterday. Just tell me if you need anything else!? |
jQuery currently does not have a curry function. Proxy does support arguments currying but will always overwrite the context. Sometimes I would like to only curry some arguments without setting an explicit context.
I'm not sure if this already has been suggested, as the change is very small and quite obvious. This enables me to use it to only curry arguments without an explicit context:
var cb = jQuery.proxy(fn, null, 'arg1', 'arg2');
cb.call(myobject, 'arg3');
The patch is very small and will not overwrite the context if it evaluates to false. Maybe this check should be more strict (typeof context == 'undefined' ? this : context)? I don't see a valid reason to set the context to something that evaluates to false!? What do you think?
Thanks for consideration and your time!
Have a nice day!