diff --git a/CHANGELOG b/CHANGELOG index 13bce6e..26baf73 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,9 @@ *SVN* +* Add support for brackets in quoted attribute value selectors. Closes #9157. [Ken Snyder] + +* Add some missing semicolons to the source tree. Closes #9140. [jdalton] + * Fix event extensions and custom events firing for Safari 2.0. [Thomas Fuchs] * Add RegExp.escape for escaping regular expression strings. Closes #9094. [Ken Snyder] diff --git a/src/selector.js b/src/selector.js index 3eeeed0..f5ca759 100644 --- a/src/selector.js +++ b/src/selector.js @@ -252,7 +252,7 @@ Object.extend(Selector, { className: /^\.([\w\-\*]+)(\b|$)/, pseudo: /^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|\s|(?=:))/, attrPresence: /^\[([\w]+)\]/, - attr: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\]]*?)\4|([^'"][^\]]*?)))?\]/ + attr: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/ }, // for Selector.match and Element#match diff --git a/test/unit/selector.html b/test/unit/selector.html index 90a33b6..d3a9911 100644 --- a/test/unit/selector.html +++ b/test/unit/selector.html @@ -47,6 +47,11 @@ +
+ + +
+
@@ -176,6 +181,13 @@ testSelectorWithTagNameAndNegatedAttributeValue: function() {with(this) { assertEnumEqual([], $$('a[href!=#]')); }}, + + testSelectorWithBracketAttributeValue: function() {with(this) { + assertEnumEqual($('chk_1', 'chk_2'), $$('#troubleForm2 input[name="brackets[5][]"]')); + assertEnumEqual([$('chk_1')], $$('#troubleForm2 input[name="brackets[5][]"]:checked')); + assertEnumEqual([$('chk_2')], $$('#troubleForm2 input[name="brackets[5][]"][value=2]')); + assertEnumEqual([], $$('#troubleForm2 input[name=brackets[5][]]')); + }}, test$$WithNestedAttributeSelectors: function() {with(this) { assertEnumEqual([$('strong')], $$('div[style] p[id] strong'));