aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2010-11-09 14:03:11 -0500
committerJohn Resig <jeresig@gmail.com>2010-11-09 14:03:11 -0500
commitb0e1e83aa987279dcdb81112ec942c161111be17 (patch)
tree9bfdc7afcd92577d20499b4314a388f3fbf8a040
parent983548f8ebc3fcd1bb4600bc4b740cb8a5d4c48b (diff)
downloadjquery-b0e1e83aa987279dcdb81112ec942c161111be17.tar.gz
jquery-b0e1e83aa987279dcdb81112ec942c161111be17.zip
Ensure that unquoted attribute selectors are quoted (allowing them to go into qSA/matchesSelector properly). Fixes #7216.
-rw-r--r--test/unit/selector.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/test/unit/selector.js b/test/unit/selector.js
index 8f9f56e26..46f787d61 100644
--- a/test/unit/selector.js
+++ b/test/unit/selector.js
@@ -237,7 +237,7 @@ test("child and adjacent", function() {
});
test("attributes", function() {
- expect(35);
+ expect(39);
t( "Attribute Exists", "a[title]", ["google"] );
t( "Attribute Exists", "*[title]", ["google"] );
t( "Attribute Exists", "[title]", ["google"] );
@@ -275,8 +275,16 @@ test("attributes", function() {
t( "Attribute Contains", "a[href *= 'google']", ["google","groups"] );
t( "Attribute Is Not Equal", "#ap a[hreflang!='en']", ["google","groups","anchor1"] );
- var opt = document.getElementById("option1a");
- ok( (window.Sizzle || window.jQuery.find).matchesSelector( opt, "[id*=option1][type!=checkbox]" ), "Attribute Is Not Equal Matches" );
+ var opt = document.getElementById("option1a"),
+ match = (window.Sizzle || window.jQuery.find).matchesSelector;
+
+ opt.setAttribute("test", "");
+
+ ok( match( opt, "[id*=option1][type!=checkbox]" ), "Attribute Is Not Equal Matches" );
+ ok( match( opt, "[id*=option1]" ), "Attribute With No Quotes Contains Matches" );
+ ok( match( opt, "[test=]" ), "Attribute With No Quotes No Content Matches" );
+ ok( match( opt, "[id=option1a]" ), "Attribute With No Quotes Equals Matches" );
+ ok( match( document.getElementById("simon1"), "a[href*=#]" ), "Attribute With No Quotes Href Contains Matches" );
t("Empty values", "#select1 option[value='']", ["option1a"]);
t("Empty values", "#select1 option[value!='']", ["option1b","option1c","option1d"]);