Skip to main content

Bug Tracker

Side navigation

#6457 closed enhancement (invalid)

Opened April 18, 2010 03:51PM UTC

Closed March 21, 2011 09:03PM UTC

Last modified December 12, 2012 01:13PM UTC

Add a param to end() so that it can end multiple levels at once

Reported by: Seldaek Owned by:
Priority: undecided Milestone:
Component: core Version: 1.4.2
Keywords: needsreview end Cc:
Blocked by: Blocking:
Description

I would like to have the possibility when nesting heavily selectors to jump out of many at a time, using .end(3) for example, would be the equivalent of .end().end().end().

Granted, I don't need it too often, but I thought this was typically the kind of feature jQuery should have, so I made a patch.

You can view the patch, and pull it straight if interested, on github: http://github.com/Seldaek/jquery/commit/7bb02a9be24c9ca5b6be150f92b2c09bd4837d0b

Attachments (0)
Change History (6)

Changed November 12, 2010 02:40AM UTC by snover comment:1

milestone: 1.4.3

Resetting milestone to future.

Changed November 15, 2010 04:16AM UTC by dmethvin comment:2

keywords: endneedsreview end
priority: → undecided

This seems like a bad idea to me, the multiple .end() statements syntactically correspond to the filtering method that they end.

Changed January 01, 2011 09:07PM UTC by rmurphey comment:3

I have never loved .end() -- this seems like it would encourage even more difficult-to-decipher and difficult-to-maintain code. If this functionality is really desired, I'd say just do it as a plugin that overrides .end() or defines some other method that accepts an argument.

Changed March 21, 2011 09:03PM UTC by addyosmani comment:4

resolution: → invalid
status: newclosed

I would like to add a final +1 to this being a bad idea. In addition to this likely not being something an extensive number of people in the community would use, rmurphey's comment regarding it's probable encouragement of difficult to interpret code is very much something I agree with here.

Changed December 04, 2011 03:22PM UTC by dmethvin comment:5

#10948 is a duplicate of this ticket.

Changed December 12, 2012 01:13PM UTC by scottgonzalez comment:6

#13038 is a duplicate of this ticket.