Commit 0468e31b authored by John Resig's avatar John Resig

Added a performance improvement to preFilter.CLASS from LosT on the Sizzle.js mailing list.

parent aa7616cf
......@@ -332,11 +332,12 @@ var Expr = Sizzle.selectors = {
CLASS: function(match, curLoop, inplace, result, not){
match = " " + match[1].replace(/\\/g, "") + " ";
for ( var i = 0; curLoop[i] != null; i++ ) {
if ( curLoop[i] ) {
if ( not ^ (" " + curLoop[i].className + " ").indexOf(match) >= 0 ) {
var elem;
for ( var i = 0; (elem = curLoop[i]) != null; i++ ) {
if ( elem ) {
if ( not ^ (" " + elem.className + " ").indexOf(match) >= 0 ) {
if ( !inplace )
result.push( curLoop[i] );
result.push( elem );
} else if ( inplace ) {
curLoop[i] = false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment