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

Remove context and selector properties #1908

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

Comments

Projects
None yet
5 participants
@gibson042
Member

gibson042 commented Dec 7, 2014

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

This comment has been minimized.

Show comment
Hide comment
@mgol

mgol Dec 7, 2014

Member

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

@dmethvin, what do you think?

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

This comment has been minimized.

Show comment
Hide comment
@dmethvin

dmethvin Dec 7, 2014

Member

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?

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

This comment has been minimized.

Show comment
Hide comment
@gibson042

gibson042 Dec 7, 2014

Member

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

Member

gibson042 commented Dec 7, 2014

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

@dmethvin

This comment has been minimized.

Show comment
Hide comment
@dmethvin

dmethvin Dec 8, 2014

Member

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

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

This comment has been minimized.

Show comment
Hide comment
Member

dmethvin commented Jan 8, 2015

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

@dmethvin dmethvin closed this in 0ea8c32 Jan 12, 2015

@thdoan

This comment has been minimized.

Show comment
Hide comment
@thdoan

thdoan 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.

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

This comment has been minimized.

Show comment
Hide comment
@dmethvin

dmethvin Jun 14, 2017

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().

Member

dmethvin commented Jun 14, 2017

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.