Bug Tracker

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#12121 closed feature (duplicate)

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

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


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

comment:1 Changed 11 years ago by dmethvin

Resolution: duplicate
Status: newclosed

comment:2 Changed 11 years ago by dmethvin

Duplicate of #12120.

Note: See TracTickets for help on using tickets.