Bug Tracker

Opened 13 years ago

Closed 12 years ago

Last modified 10 years ago

#6457 closed enhancement (invalid)

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:


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

Change History (6)

comment:1 Changed 12 years ago by snover

Milestone: 1.4.3

Resetting milestone to future.

comment:2 Changed 12 years ago by dmethvin

Keywords: needsreview added
Priority: undecided

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

comment:3 Changed 12 years ago by rmurphey

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.

comment:4 Changed 12 years ago by addyosmani

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.

comment:5 Changed 11 years ago by dmethvin

#10948 is a duplicate of this ticket.

comment:6 Changed 10 years ago by scottgonzalez

#13038 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.