]> source.dussan.org Git - jquery.git/commitdiff
Fix formatting and switch to using the new matchesSelector method in Sizzle.
authorjeresig <jeresig@gmail.com>
Sun, 10 Oct 2010 17:37:36 +0000 (13:37 -0400)
committerjeresig <jeresig@gmail.com>
Sun, 10 Oct 2010 17:37:36 +0000 (13:37 -0400)
src/traversing.js

index 1633e2e162d6fea779ef680355a2edd0d22a618b..cfb344b9ceb647484bb5d737f3ece832662f7abf 100644 (file)
@@ -100,23 +100,24 @@ jQuery.fn.extend({
                var pos = POS.test( selectors ) ? 
                        jQuery( selectors, context || this.context ) : null;
 
-    var ret = [];
+               var ret = [];
 
-    for ( var i=0,j=this.length; i<j; i++ ) {
-      var cur = this[i];
+               for ( var i = 0, j = this.length; i < j; i++ ) {
+                       var cur = this[i];
 
-      while ( cur ) {
-        if ( pos ? pos.index(cur) > -1 : jQuery.find.matches(selectors, [cur]).length ) {
+                       while ( cur ) {
+                               if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
                                        ret.push( cur );
-          break;
+                                       break;
+
                                } else {
-          cur = cur.parentNode;
-          if ( !cur.ownerDocument || cur === context ) {
-            break;
-          }
-        }
-      }
-    }
+                                       cur = cur.parentNode;
+                                       if ( !cur.ownerDocument || cur === context ) {
+                                               break;
+                                       }
+                               }
+                       }
+               }
 
                ret = ret.length > 1 ? jQuery.unique(ret) : ret;