mirror of
https://github.com/jquery/jquery.git
synced 2026-01-26 10:58:05 -05:00
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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user