Fixed a bug in .dir() where it would return non-element nodes.
[jquery.git] / src / selector.js
index 1fbbe9b..f746fe1 100644 (file)
@@ -404,7 +404,8 @@ jQuery.extend({
                var matched = [];
                var cur = elem[dir];
                while ( cur && cur != document ) {
-                       matched.push( cur );
+                       if ( cur.nodeType == 1 )
+                               matched.push( cur );
                        cur = cur[dir];
                }
                return matched;