fixed jQuery.dir regression introduced with 1.4 *untils patch that errored when trave...
[jquery.git] / src / traversing.js
index d0dd52d..bf17b8a 100644 (file)
@@ -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 );
                        }