From: John Resig Date: Sat, 7 Feb 2009 17:41:30 +0000 (+0000) Subject: Added a fix for empty attribute selection values. Fixes jQuery bug #3990. X-Git-Tag: 1.3.2~55 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f38648c7cd3a37f4070b77b2c92151f68aa66fef;p=jquery.git Added a fix for empty attribute selection values. Fixes jQuery bug #3990. --- diff --git a/src/selector.js b/src/selector.js index 9fb674ec3..d580c5ae5 100644 --- a/src/selector.js +++ b/src/selector.js @@ -6,7 +6,7 @@ */ (function(){ -var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]+['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g, +var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g, done = 0, toString = Object.prototype.toString; diff --git a/test/unit/selector.js b/test/unit/selector.js index e85fce7fd..4c63a7a19 100644 --- a/test/unit/selector.js +++ b/test/unit/selector.js @@ -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"] );