Skip to content
Permalink
Browse files

Added a performance improvement to preFilter.CLASS from LosT on the S…

…izzle.js mailing list.
  • Loading branch information
jeresig committed Jan 20, 2009
1 parent aa7616c commit 0468e31bf703815f2d145877280b71e9eadaf6f0
Showing with 5 additions and 4 deletions.
  1. +5 −4 src/selector.js
@@ -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;
}

0 comments on commit 0468e31

Please sign in to comment.
You can’t perform that action at this time.