mirror of
https://github.com/jquery/jquery.git
synced 2025-01-10 18:24:24 +00:00
Fix #13819: .parent sort direction
This commit is contained in:
parent
7723012e11
commit
6a816ec95f
@ -201,7 +201,7 @@ jQuery.each({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reverse order for parents* and prev*
|
// Reverse order for parents* and prev*
|
||||||
if ( name.charAt(0) === "p" ) {
|
if ( name.charAt(0) === "p" && name !== "parent" ) {
|
||||||
ret = ret.reverse();
|
ret = ret.reverse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -673,6 +673,32 @@ test("contents()", function() {
|
|||||||
equal( c[0].nodeValue, "hi", "Check node,textnode,comment contents is just the one from span" );
|
equal( c[0].nodeValue, "hi", "Check node,textnode,comment contents is just the one from span" );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("sort direction", function() {
|
||||||
|
expect( 12 );
|
||||||
|
|
||||||
|
var elems = jQuery("#ap, #select1 > *, #moretests > form"),
|
||||||
|
methodDirections = {
|
||||||
|
parent: false,
|
||||||
|
parents: true,
|
||||||
|
parentsUntil: true,
|
||||||
|
next: false,
|
||||||
|
prev: true,
|
||||||
|
nextAll: false,
|
||||||
|
prevAll: true,
|
||||||
|
nextUntil: false,
|
||||||
|
prevUntil: true,
|
||||||
|
siblings: false,
|
||||||
|
children: false,
|
||||||
|
contents: false
|
||||||
|
};
|
||||||
|
|
||||||
|
jQuery.each( methodDirections, function( method, reversed ) {
|
||||||
|
var actual = elems[ method ]().get(),
|
||||||
|
forward = jQuery.unique( [].concat( actual ) );
|
||||||
|
deepEqual( actual, reversed ? forward.reverse() : forward, "Correct sort direction for " + method );
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test("add(String|Element|Array|undefined)", function() {
|
test("add(String|Element|Array|undefined)", function() {
|
||||||
expect( 15 );
|
expect( 15 );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user