Added a performance improvement to .hide()/.show() that helps to prevent constant...
[jquery.git] / src / selector.js
index 9fb674e..7c0bf40 100644 (file)
@@ -6,7 +6,7 @@
  */
 (function(){
 
-var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]+['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g,
+var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g,
        done = 0,
        toString = Object.prototype.toString;
 
@@ -564,7 +564,16 @@ var Expr = Sizzle.selectors = {
                        return match.test( elem.className );
                },
                ATTR: function(elem, match){
-                       var result = Expr.attrHandle[ match[1] ] ? Expr.attrHandle[ match[1] ]( elem ) : elem[ match[1] ] || elem.getAttribute( match[1] ), value = result + "", type = match[2], check = match[4];
+                       var name = match[1],
+                               result = Expr.attrHandle[ name ] ?
+                                       Expr.attrHandle[ name ]( elem ) :
+                                       elem[ name ] != null ?
+                                               elem[ name ] :
+                                               elem.getAttribute( name ),
+                               value = result + "",
+                               type = match[2],
+                               check = match[4];
+
                        return result == null ?
                                type === "!=" :
                                type === "=" ?
@@ -573,8 +582,8 @@ var Expr = Sizzle.selectors = {
                                value.indexOf(check) >= 0 :
                                type === "~=" ?
                                (" " + value + " ").indexOf(check) >= 0 :
-                               !match[4] ?
-                               result :
+                               !check ?
+                               value && result !== false :
                                type === "!=" ?
                                value != check :
                                type === "^=" ?