Bug Tracker

Modify

Ticket #12121 (closed feature: duplicate)

Opened 10 months ago

Last modified 10 months ago

Inconsistency of .end() with respect to .after()

Reported by: anonymous Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: git
Keywords: Cc:
Blocking: Blocked by:

Description

.after() only changes the stack if the first element in the set is disconnected. This is unfortunate, because .end() cannot be used with the same result if .after() is called on an empty set vs a non-empty set. You don't always know whether there are elements in the set, and more importantly, it should not matter.

Fiddle:  http://jsfiddle.net/3qqXG/

The second div doesn't turn red because it doesn't have any children. The fiddle is contrived, of course, but in real cases you don't know whether there are any children - I'd expect both .end() calls to select the div again.

I did note that the docs state that .after() acts differently on a set of disconnected nodes. However, jQuery thinks an empty set is disconnected as well, causing this issue.

Change History

comment:1 Changed 10 months ago by dmethvin

  • Status changed from new to closed
  • Resolution set to duplicate

comment:2 Changed 10 months ago by dmethvin

Duplicate of #12120.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.