Commit cde4c326 authored by Dave Methvin's avatar Dave Methvin

Fix #11969. Never a null moment when checking siblings.

parent 53eb2305
...@@ -158,7 +158,7 @@ function isDisconnected( node ) { ...@@ -158,7 +158,7 @@ function isDisconnected( node ) {
function sibling( cur, dir ) { function sibling( cur, dir ) {
do { do {
cur = cur[ dir ]; cur = cur[ dir ];
} while ( cur.nodeType !== 1 ); } while ( cur && cur.nodeType !== 1 );
return cur; return cur;
} }
......
...@@ -467,11 +467,12 @@ test("parentsUntil([String])", function() { ...@@ -467,11 +467,12 @@ test("parentsUntil([String])", function() {
}); });
test("next([String])", function() { test("next([String])", function() {
expect(4); expect(5);
equal( jQuery("#ap").next()[0].id, "foo", "Simple next check" ); equal( jQuery("#ap").next()[0].id, "foo", "Simple next check" );
equal( jQuery("#ap").next("div")[0].id, "foo", "Filtered next check" ); equal( jQuery("#ap").next("div")[0].id, "foo", "Filtered next check" );
equal( jQuery("#ap").next("p").length, 0, "Filtered next check, no match" ); equal( jQuery("#ap").next("p").length, 0, "Filtered next check, no match" );
equal( jQuery("#ap").next("div, p")[0].id, "foo", "Multiple filters" ); equal( jQuery("#ap").next("div, p")[0].id, "foo", "Multiple filters" );
equal( jQuery("body").next().length, 0, "Simple next check, no match" );
}); });
test("prev([String])", function() { test("prev([String])", function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment