]> source.dussan.org Git - jquery.git/commitdiff
Syncing Sizzle codebase.
authorJohn Resig <jeresig@gmail.com>
Sat, 20 Dec 2008 22:45:11 +0000 (22:45 +0000)
committerJohn Resig <jeresig@gmail.com>
Sat, 20 Dec 2008 22:45:11 +0000 (22:45 +0000)
src/selector.js

index c89b92eea0df9edc26a5f83f37632c66e194cd34..a749740420ca4f62045bc9a0975d23e62235c6ab 100644 (file)
@@ -12,7 +12,7 @@ var done = 0;
 
 if ( document.addEventListener && !document.querySelectorAll ) {
        cache = {};
-       function invalidate(){ cache = {}; }
+       var invalidate = function(){ cache = {}; };
        document.addEventListener("DOMAttrModified", invalidate, false);
        document.addEventListener("DOMNodeInserted", invalidate, false);
        document.addEventListener("DOMNodeRemoved", invalidate, false);
@@ -59,24 +59,24 @@ var Sizzle = function(selector, context, results, seed) {
                                selector = selector.replace( Expr.match.POS, "" );
                        }
 
-                       checkSet = Sizzle.filter( later, Sizzle( selector, context, results ) );
+                       set = Sizzle.filter( later, Sizzle( selector, context ) );
                } else {
-                       checkSet = Expr.relative[ parts[0] ] ?
+                       set = Expr.relative[ parts[0] ] ?
                                [ context ] :
                                Sizzle( parts.shift(), context );
 
                        while ( parts.length ) {
-                               set = [];
+                               var tmpSet = [];
 
                                selector = parts.shift();
                                if ( Expr.relative[ selector ] )
                                        selector += parts.shift();
 
-                               for ( var i = 0, l = checkSet.length; i < l; i++ ) {
-                                       Sizzle( selector, checkSet[i], set );
+                               for ( var i = 0, l = set.length; i < l; i++ ) {
+                                       Sizzle( selector, set[i], tmpSet );
                                }
 
-                               checkSet = set;
+                               set = tmpSet;
                        }
                }
        } else {
@@ -104,10 +104,10 @@ var Sizzle = function(selector, context, results, seed) {
 
                        Expr.relative[ cur ]( checkSet, pop );
                }
+       }
 
-               if ( !checkSet ) {
-                       checkSet = set;
-               }
+       if ( !checkSet ) {
+               checkSet = set;
        }
 
        if ( !checkSet ) {