Skip to content
Permalink
Browse files

Added a fix for empty attribute selection values. Fixes jQuery bug #3990

.
  • Loading branch information
jeresig committed Feb 7, 2009
1 parent 31597b7 commit f38648c7cd3a37f4070b77b2c92151f68aa66fef
Showing with 5 additions and 2 deletions.
  1. +1 −1 src/selector.js
  2. +4 −1 test/unit/selector.js
@@ -6,7 +6,7 @@
*/
(function(){

var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]+['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g,
var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g,
done = 0,
toString = Object.prototype.toString;

@@ -215,7 +215,7 @@ test("child and adjacent", function() {
});

test("attributes", function() {
expect(35);
expect(37);
t( "Attribute Exists", "a[title]", ["google"] );
t( "Attribute Exists", "*[title]", ["google"] );
t( "Attribute Exists", "[title]", ["google"] );
@@ -252,6 +252,9 @@ test("attributes", function() {
t( "Attribute Ends With", "a[href $= 'org/']", ["mark"] );
t( "Attribute Contains", "a[href *= 'google']", ["google","groups"] );
t( "Attribute Is Not Equal", "#ap a[hreflang!='en']", ["google","groups","anchor1"] );

t("Empty values", "#select1 option[value='']", ["option1a"]);
t("Empty values", "#select1 option[value!='']", ["option1b","option1c","option1d"]);

t("Select options via :selected", "#select1 option:selected", ["option1a"] );
t("Select options via :selected", "#select2 option:selected", ["option2d"] );

0 comments on commit f38648c

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