Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix #11969. Never a null moment when checking siblings.
  • Loading branch information
dmethvin committed Jun 26, 2012
1 parent 53eb230 commit cde4c32
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/traversing.js
Expand Up @@ -158,7 +158,7 @@ function isDisconnected( node ) {
function sibling( cur, dir ) {
do {
cur = cur[ dir ];
} while ( cur.nodeType !== 1 );
} while ( cur && cur.nodeType !== 1 );

return cur;
}
Expand Down
3 changes: 2 additions & 1 deletion test/unit/traversing.js
Expand Up @@ -467,11 +467,12 @@ test("parentsUntil([String])", function() {
});

test("next([String])", function() {
expect(4);
expect(5);
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("p").length, 0, "Filtered next check, no match" );
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() {
Expand Down

2 comments on commit cde4c32

@FlashJunior
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx!

@richstokoe
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hahaha, love the commit comment.

Please sign in to comment.