X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fselector.js;h=7c0bf4082cbdc1cde73ce5f9e06c68a7f41cb1fb;hb=0ae78024c23dd3ef4bcea883338d975dcf843597;hp=3dc87659fbdddfc41a504af7ba8d941d06b05ea3;hpb=ab74ce7b57f2baa297723416573c2cf6ca67f936;p=jquery.git diff --git a/src/selector.js b/src/selector.js index 3dc8765..7c0bf40 100644 --- a/src/selector.js +++ b/src/selector.js @@ -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 === "=" ? @@ -574,7 +583,7 @@ var Expr = Sizzle.selectors = { type === "~=" ? (" " + value + " ").indexOf(check) >= 0 : !check ? - result : + value && result !== false : type === "!=" ? value != check : type === "^=" ?