Fixed selector parsing so that "#foo [bar=baz]" is treated the same way as "#foo *[bar=baz]". Closes #10734. [jlukas, kangax, Andrew Dupont]
This commit is contained in:
parent
4753cc82ec
commit
c67fe0b2f3
|
@ -1,5 +1,7 @@
|
|||
*SVN*
|
||||
|
||||
* Fixed selector parsing so that "#foo [bar=baz]" is treated the same way as "#foo *[bar=baz]". Closes #10734. [jlukas, kangax, Andrew Dupont]
|
||||
|
||||
* Fix Element#descendantOf logic in IE. Closes #10413. [martymix, kamil.szot]
|
||||
|
||||
* Fix missing "var" in Element#insert. Closes #10838. [Lantash]
|
||||
|
|
|
@ -241,13 +241,13 @@ Object.extend(Selector, {
|
|||
},
|
||||
|
||||
criteria: {
|
||||
tagName: 'n = h.tagName(n, r, "#{1}", c); c = false;',
|
||||
className: 'n = h.className(n, r, "#{1}", c); c = false;',
|
||||
id: 'n = h.id(n, r, "#{1}", c); c = false;',
|
||||
attrPresence: 'n = h.attrPresence(n, r, "#{1}"); c = false;',
|
||||
tagName: 'n = h.tagName(n, r, "#{1}", c); c = false;',
|
||||
className: 'n = h.className(n, r, "#{1}", c); c = false;',
|
||||
id: 'n = h.id(n, r, "#{1}", c); c = false;',
|
||||
attrPresence: 'n = h.attrPresence(n, r, "#{1}", c); c = false;',
|
||||
attr: function(m) {
|
||||
m[3] = (m[5] || m[6]);
|
||||
return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}"); c = false;').evaluate(m);
|
||||
return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m);
|
||||
},
|
||||
pseudo: function(m) {
|
||||
if (m[6]) m[6] = m[6].replace(/"/g, '\\"');
|
||||
|
@ -457,16 +457,18 @@ Object.extend(Selector, {
|
|||
return results;
|
||||
},
|
||||
|
||||
attrPresence: function(nodes, root, attr) {
|
||||
attrPresence: function(nodes, root, attr, combinator) {
|
||||
if (!nodes) nodes = root.getElementsByTagName("*");
|
||||
if (nodes && combinator) nodes = this[combinator](nodes);
|
||||
var results = [];
|
||||
for (var i = 0, node; node = nodes[i]; i++)
|
||||
if (Element.hasAttribute(node, attr)) results.push(node);
|
||||
return results;
|
||||
},
|
||||
|
||||
attr: function(nodes, root, attr, value, operator) {
|
||||
attr: function(nodes, root, attr, value, operator, combinator) {
|
||||
if (!nodes) nodes = root.getElementsByTagName("*");
|
||||
if (nodes && combinator) nodes = this[combinator](nodes);
|
||||
var handler = Selector.operators[operator], results = [];
|
||||
for (var i = 0, node; node = nodes[i]; i++) {
|
||||
var nodeValue = Element.readAttribute(node, attr);
|
||||
|
|
|
@ -184,6 +184,8 @@
|
|||
assertEnumEqual($('checked_radio', 'unchecked_radio'), $$('[type=radio]'));
|
||||
assertEnumEqual($$('*[type=checkbox]'), $$('[type=checkbox]'));
|
||||
assertEnumEqual($('with_title', 'commaParent'), $$('[title]'));
|
||||
assertEnumEqual($$('#troubleForm *[type=radio]'), $$('#troubleForm [type=radio]'));
|
||||
assertEnumEqual($$('#troubleForm *[type]'), $$('#troubleForm [type]'));
|
||||
}},
|
||||
|
||||
testSelectorWithUniversalAndHyphenTokenizedAttributeValue: function() {with(this) {
|
||||
|
|
Loading…
Reference in New Issue