Ensure selectors of the form "[href]" (attribute token with no preceding tag name) work properly. Closes #8870. [chao, kangax, Andrew Dupont]
This commit is contained in:
parent
e457edbcf4
commit
8cd85d12a2
|
@ -1,5 +1,7 @@
|
|||
*SVN*
|
||||
|
||||
* Ensure selectors of the form "[href]" (attribute token with no preceding tag name) work properly. Closes #8870. [chao, kangax, Andrew Dupont]
|
||||
|
||||
* Performance optimizations for Element#descendantOf. Costliness should no longer be dependent on the difference in depth between the parent and the child. [Andrew Dupont]
|
||||
|
||||
* Apply the workaround for the Firefox "blinking element" opacity=1 bug only to Firefox 1.5. [Thomas Fuchs]
|
||||
|
|
|
@ -436,6 +436,7 @@ Object.extend(Selector, {
|
|||
},
|
||||
|
||||
attrPresence: function(nodes, root, attr) {
|
||||
if (!nodes) nodes = root.getElementsByTagName("*");
|
||||
var results = [];
|
||||
for (var i = 0, node; node = nodes[i]; i++)
|
||||
if (Element.hasAttribute(node, attr)) results.push(node);
|
||||
|
|
|
@ -173,6 +173,15 @@
|
|||
assertEnumEqual($('link_1', 'link_2'), $$('a[class~=internal]'));
|
||||
}},
|
||||
|
||||
testSelectorWithAttributeAndNoTagName: function() {with(this) {
|
||||
assertEnumEqual($(document.body).select('a[href]'), $(document.body).select('[href]'));
|
||||
assertEnumEqual($$('a[class~="internal"]'), $$('[class~=internal]'));
|
||||
assertEnumEqual($$('*[id]'), $$('[id]'));
|
||||
assertEnumEqual($('checked_radio', 'unchecked_radio'), $$('[type=radio]'));
|
||||
assertEnumEqual($$('*[type=checkbox]'), $$('[type=checkbox]'));
|
||||
assertEnumEqual($('with_title', 'commaParent'), $$('[title]'));
|
||||
}},
|
||||
|
||||
testSelectorWithUniversalAndHyphenTokenizedAttributeValue: function() {with(this) {
|
||||
assertEnumEqual([$('item_3')], $$('*[xml:lang|="es"]'));
|
||||
assertEnumEqual([$('item_3')], $$('*[xml:lang|="ES"]'));
|
||||
|
|
Loading…
Reference in New Issue