From 7cdddebe047302f51c4fd30823565f3ac1553d60 Mon Sep 17 00:00:00 2001 From: David Serduke Date: Wed, 5 Dec 2007 21:23:07 +0000 Subject: [PATCH] A partial rollback of the refactoring done in [4032]. It was causing a 4-6% speed decrease on certain hierarchy selectors ( > + and ~ ) since it did an extra .toUpperCase() which wasn't required. The part left in was moving one of the .toUpperCase() calls to the var nodeName instead of having it in the loop. This appears to be giving a speed boost of a couple percent for those same hierarchy selectors. --- src/selector.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/selector.js b/src/selector.js index 70e988db0..da2724530 100644 --- a/src/selector.js +++ b/src/selector.js @@ -104,7 +104,7 @@ jQuery.extend({ context = context || document; // Initialize the search - var ret = [context], done = [], last; + var ret = [context], done = [], last, nodeName; // Continue while a selector expression exists, and while // we're no longer looping upon ourselves @@ -122,12 +122,12 @@ jQuery.extend({ var m = re.exec(t); if ( m ) { - var nodeName = m[1]; + nodeName = m[1].toUpperCase(); // Perform our own iteration and filter for ( var i = 0; ret[i]; i++ ) for ( var c = ret[i].firstChild; c; c = c.nextSibling ) - if ( c.nodeType == 1 && (nodeName == "*" || jQuery.nodeName(c, nodeName)) ) + if ( c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName) ) r.push( c ); ret = r; @@ -140,7 +140,7 @@ jQuery.extend({ if ( (m = re.exec(t)) != null ) { r = []; - var nodeName = m[2], merge = {}; + nodeName = m[2].toUpperCase(), merge = {}; m = m[1]; for ( var j = 0, rl = ret.length; j < rl; j++ ) { @@ -151,7 +151,7 @@ jQuery.extend({ if ( m == "~" && merge[id] ) break; - if (!nodeName || jQuery.nodeName(n, nodeName)) { + if (!nodeName || n.nodeName.toUpperCase() == nodeName ) { if ( m == "~" ) merge[id] = true; r.push( n ); } @@ -436,3 +436,4 @@ jQuery.extend({ return r; } }); + -- 2.39.5