Fix Selector to match elements with attributes containing hyphens. [#285 state:resolved] (leiyou, jddalton, kangax)
This commit is contained in:
parent
dc9d274d89
commit
8fe518719e
|
@ -1,3 +1,5 @@
|
|||
* Fix Selector to match elements with attributes containing hyphens. [#285 state:resolved] (leiyou, jddalton, kangax)
|
||||
|
||||
* Make sure Form.reset always returns a reference to the receiver element. [#309 state:resolved] (Phil, kangax)
|
||||
|
||||
* Escape ":" and "." characters when doing contextual CSS selection in browsers that support querySelectorAll. [#559 state:resolved] (fxtentacle, Andrew Dupont)
|
||||
|
|
|
@ -340,7 +340,7 @@ Object.extend(Selector, {
|
|||
{ name: 'id', re: /^#([\w\-\*]+)(\b|$)/ },
|
||||
{ name: 'className', re: /^\.([\w\-\*]+)(\b|$)/ },
|
||||
{ name: 'pseudo', re: /^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/ },
|
||||
{ name: 'attrPresence', re: /^\[((?:[\w]+:)?[\w]+)\]/ },
|
||||
{ name: 'attrPresence', re: /^\[((?:[\w-]+:)?[\w]+)\]/ },
|
||||
{ name: 'attr', re: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/ }
|
||||
],
|
||||
|
||||
|
|
|
@ -66,4 +66,6 @@
|
|||
<input type="hidden" id="commaTwo" name="foo2" value="oops" />
|
||||
</form>
|
||||
<div id="counted_container"><div class="is_counted"></div></div>
|
||||
|
||||
<div foo-bar="baz" id="attr_with_dash">blah</div>
|
||||
</div>
|
||||
|
|
|
@ -87,6 +87,10 @@ new Test.Unit.Runner({
|
|||
this.assertEnumEqual($$('#troubleForm *[type]'), $$('#troubleForm [type]'));
|
||||
},
|
||||
|
||||
testSelectorWithAttributeContainingDash: function() {
|
||||
this.assertEnumEqual([$('attr_with_dash')], $$('[foo-bar]'));
|
||||
},
|
||||
|
||||
testSelectorWithUniversalAndHyphenTokenizedAttributeValue: function() {
|
||||
this.assertEnumEqual([$('item_3')], $$('*[xml:lang|="es"]'));
|
||||
this.assertEnumEqual([$('item_3')], $$('*[xml:lang|="ES"]'));
|
||||
|
|
Loading…
Reference in New Issue