Skip to content
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

Deprecate jQuery.proxy #2958

Closed
markelog opened this issue Feb 29, 2016 · 19 comments
Closed

Deprecate jQuery.proxy #2958

markelog opened this issue Feb 29, 2016 · 19 comments
Assignees
Milestone

Comments

@markelog
Copy link
Member

@markelog markelog commented Feb 29, 2016

It seems their use is mostly fulfilled with Function#bind and other signatures has limited use

@markelog markelog added this to the 3.1.0 milestone Feb 29, 2016
@markelog markelog added the Core label Mar 3, 2016
@r3wt
Copy link

@r3wt r3wt commented Apr 18, 2016

It's used extensively to call prototype functions with context for event bindings in many jquery plugins, notably in bootstrap's plugins. I don't think it should be deprecated, though its easy enough to roll your own.

@markelog
Copy link
Member Author

@markelog markelog commented Apr 18, 2016

Proposal here for deprecation only, not for removal, if it would be removed, it would happen in major version.

As you said you it is easy to supplement, which what jquery-migrate would do anyway

@timmywil
Copy link
Member

@timmywil timmywil commented Apr 18, 2016

It's small enough that if it's getting wide usage, I don't see the need for deprecation.

@mgol
Copy link
Member

@mgol mgol commented Apr 18, 2016

@markelog
Copy link
Member Author

@markelog markelog commented Apr 18, 2016

@timmywil would you recommend to use jQuery#proxy over Function#bind?

@timmywil
Copy link
Member

@timmywil timmywil commented Apr 18, 2016

@markelog I still use proxy over bind when I think it's cleaner to pass a function name rather than the function.

@markelog
Copy link
Member Author

@markelog markelog commented Apr 18, 2016

If we still recommend to use jQuery#proxy and not es6 version, that then this indeed should be closed.

But i don't think that refusal from deprecation should came from "used a lot" place, if that is the only reason, then we should discourage people from using it, which is what deprecation is, which doesn't mean we would need to remove it at 4.0, it could be the next or next after next.

@dmethvin
Copy link
Member

@dmethvin dmethvin commented Apr 19, 2016

Carrying over our discussion about breaking things from yesterday's meeting, it seems like there is not a lot of benefit from deprecating this or eventually removing it. It isn't a lot of code inside jQuery and removing it will just make someone rewrite code that works perfectly well today. That's in contrast to something like the Deferred changes which, although potentially more disruptive, are driven by our desire to align with Promise standards.

I started this wiki page that's similar to our Adding page where we can try to outline our practices.
https://github.com/jquery/jquery/wiki/Changing-existing-features

@jzaefferer
Copy link
Member

@jzaefferer jzaefferer commented Apr 19, 2016

Deprecating in favour Function#bind with no intention to remove seems like a pretty good idea. Pushing users towards standards if worth it.

@markelog
Copy link
Member Author

@markelog markelog commented Apr 19, 2016

Pushing users towards standards if worth it.

Precisely

@dmethvin
Copy link
Member

@dmethvin dmethvin commented Apr 19, 2016

If we put a deprecation warning in Migrate about it, people will feel compelled to get rid of that warning or complain to us about it. If we have a schedule for removal that makes sense, but if it's eternal deprecation I don't know if it does.

@markelog
Copy link
Member Author

@markelog markelog commented Apr 19, 2016

If we put a deprecation warning in Migrate about it, people will feel compelled to get rid of that warning or complain to us about it

Yeah, that would be consequences of deprecation, also adding note about deprecation to the documentation.

Frankly, i'm not sure why we wouldn't want to promote Function#bind over jQuery#proxy in the same way i don't think we would need to recommend jQuery.now over Date.now.

@jzaefferer
Copy link
Member

@jzaefferer jzaefferer commented Apr 19, 2016

Then don't put a warning in migrate.

@timmywil
Copy link
Member

@timmywil timmywil commented Apr 19, 2016

I only want to deprecate things that are slated for eventual removal. I'm fine promoting bind over proxy, but I think we should do it in documentation. Deprecation is not the right tool.

@markelog
Copy link
Member Author

@markelog markelog commented Apr 19, 2016

If no one would used because we discourage it, it would be logical to eventually remove it, besides definition of deprecation is -

Deprecation is the discouragement of use of some feature, design or practice

What term do you prefer?

@jzaefferer
Copy link
Member

@jzaefferer jzaefferer commented Apr 20, 2016

I only want to deprecate things that are slated for eventual removal

Why? Also what Oleg said.

@dmethvin dmethvin mentioned this issue Aug 14, 2016
5 of 8 tasks complete
@dmethvin dmethvin self-assigned this Sep 26, 2016
@timmywil timmywil modified the milestones: 3.2.0, 3.3.0 Mar 6, 2017
This was referenced Apr 2, 2017
@shanimal
Copy link

@shanimal shanimal commented Apr 5, 2017

Im guessing Im not understanding something obvious, and this may be a really dumb question, but Im wondering if native bind can be used to stub $.proxy when it's available.

Calling proxied functions is roughly 80% slower than calling the same function using bind. In Firefox it was 114% slower.
https://jsperf.com/native-bind-vs-proxy

@dmethvin
Copy link
Member

@dmethvin dmethvin commented Apr 6, 2017

We've deprecated this method, so we aren't planning to do any other implementation.

@dmethvin dmethvin closed this Apr 6, 2017
@mgol
Copy link
Member

@mgol mgol commented Apr 6, 2017

@dmethvin Did you close it by accident? We haven't deprecated it yet so I'll reopen...

@mgol mgol reopened this Apr 6, 2017
@timmywil timmywil added the Blocker label Jun 19, 2017
@timmywil timmywil assigned timmywil and unassigned dmethvin Dec 11, 2017
timmywil added a commit to timmywil/jquery that referenced this issue Dec 11, 2017
@timmywil timmywil closed this in 3a8e447 Jan 8, 2018
timmywil added a commit that referenced this issue Jan 8, 2018
Ref gh-2958
@lock lock bot locked as resolved and limited conversation to collaborators Jul 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

7 participants