Bug Tracker

Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#6178 closed bug (wontfix)

.parents() reverses element order

Reported by: RF Owned by:
Priority: Milestone: 1.4.2
Component: traversing Version: 1.4.1
Keywords: Cc:
Blocked by: Blocking:

Description

Since jQuery 1.4, the parents() function reverses the order of the elements.

Example:

<html>
<head>
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script language="JavaScript">
$(function(){
	$("div span").parents("div").each( function() {
		alert( $(this).text() );
	} );
});
</script>
</head>
<body>
	<div><span>eins</span></div>
	<div><span>zwei</span></div>
	<div><span>drei</span></div>
</body>
</html>

Change History (2)

comment:1 Changed 10 years ago by john

Resolution: wontfix
Status: newclosed

Yep, this is intended - as with prevAll and prevUntil. Having them be reversed makes it much easier to access the intended value (for example, doing .parents(":first") will be equivalent to .parent()).

comment:2 Changed 9 years ago by jitter

#5994 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.