Skip to content

Commit

Permalink
fixed jQuery.dir regression introduced with 1.4 *untils patch that er…
Browse files Browse the repository at this point in the history
…rored when traversing XHTML text nodes with an until test
  • Loading branch information
cowboy committed Jan 23, 2010
1 parent 435772e commit a0d37f8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/traversing.js
Expand Up @@ -235,7 +235,7 @@ jQuery.extend({

dir: function( elem, dir, until ) {
var matched = [], cur = elem[dir];
while ( cur && cur.nodeType !== 9 && (until === undefined || !jQuery( cur ).is( until )) ) {
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
if ( cur.nodeType === 1 ) {
matched.push( cur );
}
Expand Down
4 changes: 3 additions & 1 deletion test/unit/traversing.js
Expand Up @@ -317,7 +317,7 @@ test("prevAll([String])", function() {
});

test("nextUntil([String])", function() {
expect(10);
expect(11);

var elems = jQuery('#form').children().slice( 2, 12 );

Expand All @@ -331,6 +331,8 @@ test("nextUntil([String])", function() {
same( jQuery("#text1").nextUntil("#area1", "button,input").get(), elems.get(), "Multiple-filtered nextUntil check" );
equals( jQuery("#text1").nextUntil("#area1", "div").length, 0, "Filtered nextUntil check, no match" );
same( jQuery("#text1, #hidden1").nextUntil("#area1", "button,input").get(), elems.get(), "Multi-source, multiple-filtered nextUntil check" );

same( jQuery("#text1").nextUntil("[class=foo]").get(), jQuery("#text1").nextAll().get(), "Non-element nodes must be skipped, since they have no attributes" );
});

test("prevUntil([String])", function() {
Expand Down

0 comments on commit a0d37f8

Please sign in to comment.