Skip to content

Remove context and selector properties #1908

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

Closed
gibson042 opened this issue Dec 7, 2014 · 7 comments
Closed

Remove context and selector properties #1908

gibson042 opened this issue Dec 7, 2014 · 7 comments
Assignees
Milestone

Comments

@gibson042
Copy link
Member

Originally reported for jQuery 2.0.3 by anonymous at http://bugs.jquery.com/ticket/14341

I was lurking a few months ago and just remembered now, but it looks like both these properties are still present.

Selector has been deprecated since 1.7, and context since 2.0. Can they be removed now? I'd attempt myself however I am not able to sign the CLA due to weird moonlighting policies of my employer.

http://bugs.jquery.com/ticket/9469 http://bugs.jquery.com/ticket/13801

Both properties have been deprecated since 1.10/2.0, the former courtesy http://bugs.jquery.com/ticket/13801

3.0 strikes me as the right time. Pre-1.10 #1249 probably can't be applied directly anymore, but I'll bet it's pretty close.

@gibson042 gibson042 added the Core label Dec 7, 2014
@mgol
Copy link
Member

mgol commented Dec 7, 2014

Both of them are still in the code only because Migrate needs them to restore .live/.die methods.

@dmethvin, what do you think?

@dmethvin
Copy link
Member

dmethvin commented Dec 7, 2014

I haven't thought about it lately, but when I was doing this earlier I couldn't figure out a simple way to expose it for Migrate. We could move it to another property like _context I suppose, just to be sure it was not inadvertently used?

@gibson042
Copy link
Member Author

I'd rather have Migrate duckpunch .init/.find/etc. than carry around cruft in the mainline just to support it.

@dmethvin
Copy link
Member

dmethvin commented Dec 8, 2014

Hmmm, since we already mess with .init that might just work. We could poke the selector property in there.

@dmethvin
Copy link
Member

dmethvin commented Jan 8, 2015

Ref jquery/jquery-migrate#79

dmethvin added a commit to jquery/jquery-migrate that referenced this issue Jan 9, 2015
dmethvin added a commit to jquery/jquery-migrate that referenced this issue Jan 11, 2015
dmethvin added a commit that referenced this issue Jan 12, 2015
@thdoan
Copy link

thdoan commented Jun 14, 2017

How can we get the original selector string that was used to invoke a plugin from within the plugin? Example:

(function($) {
  $.fn.plugin = function() {
    // This no longer works in jQuery 3.x
    console.log(this.selector);
    return this;
  };
}(jQuery));

I would like this.selector to return "#some-div" when $('#some-div').plugin() is called.

@dmethvin
Copy link
Member

A closed ticket isn't the right place to look for support, but in general there is no string that represents the collection a plugin receives, e.g. $(this).plugin() or $("p").children("span").plugin().

@lock lock bot locked as resolved and limited conversation to collaborators Jun 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging a pull request may close this issue.

5 participants