prototype: Add support for brackets in quoted attribute value selectors. Closes #9157.
This commit is contained in:
parent
c9a0485b60
commit
c488384f90
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -47,6 +47,11 @@
|
|||
<input type="radio" name="radiobuttons" id="unchecked_radio" value="Unchecked" />
|
||||
</form>
|
||||
|
||||
<form id="troubleForm2">
|
||||
<input type="checkbox" name="brackets[5][]" id="chk_1" checked="checked" value="1" />
|
||||
<input type="checkbox" name="brackets[5][]" id="chk_2" value="2" />
|
||||
</form>
|
||||
|
||||
<div id="level1">
|
||||
<span id="level2_1">
|
||||
<span id="level3_1"></span>
|
||||
|
@ -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'));
|
||||
|
|
Loading…
Reference in New Issue