After discussing it with a number of users I've decided to revert the change to [name!=value]. It is now equal to :not([attr!=value]). Attempting to switch it to [attr]:not([attr!=value]) produced some really non-obvious results and confused users. Fixes jQuery bug #3884.
This commit is contained in:
parent
626961c4a5
commit
9b3804a8ec
|
@ -564,7 +564,7 @@ var Expr = Sizzle.selectors = {
|
||||||
ATTR: function(elem, match){
|
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 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];
|
||||||
return result == null ?
|
return result == null ?
|
||||||
false :
|
type === "!=" :
|
||||||
type === "=" ?
|
type === "=" ?
|
||||||
value === check :
|
value === check :
|
||||||
type === "*=" ?
|
type === "*=" ?
|
||||||
|
|
|
@ -205,7 +205,7 @@ test("child and adjacent", function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
test("attributes", function() {
|
test("attributes", function() {
|
||||||
expect(34);
|
expect(35);
|
||||||
t( "Attribute Exists", "a[title]", ["google"] );
|
t( "Attribute Exists", "a[title]", ["google"] );
|
||||||
t( "Attribute Exists", "*[title]", ["google"] );
|
t( "Attribute Exists", "*[title]", ["google"] );
|
||||||
t( "Attribute Exists", "[title]", ["google"] );
|
t( "Attribute Exists", "[title]", ["google"] );
|
||||||
|
@ -247,6 +247,7 @@ test("attributes", function() {
|
||||||
t( "Attribute Begins With", "a[href ^= 'http://www']", ["google","yahoo"] );
|
t( "Attribute Begins With", "a[href ^= 'http://www']", ["google","yahoo"] );
|
||||||
t( "Attribute Ends With", "a[href $= 'org/']", ["mark"] );
|
t( "Attribute Ends With", "a[href $= 'org/']", ["mark"] );
|
||||||
t( "Attribute Contains", "a[href *= 'google']", ["google","groups"] );
|
t( "Attribute Contains", "a[href *= 'google']", ["google","groups"] );
|
||||||
|
t( "Attribute Is Not Equal", "#ap a[hreflang!='en']", ["google","groups","anchor1"] );
|
||||||
|
|
||||||
t("Select options via :selected", "#select1 option:selected", ["option1a"] );
|
t("Select options via :selected", "#select1 option:selected", ["option1a"] );
|
||||||
t("Select options via :selected", "#select2 option:selected", ["option2d"] );
|
t("Select options via :selected", "#select2 option:selected", ["option2d"] );
|
||||||
|
|
Loading…
Reference in a new issue