prototype: Test for attribute existence before applying more complex CSS3 selectors. Closes #10870.

This commit is contained in:
Tobie Langel 2008-01-23 00:33:04 +00:00
parent c200c27f48
commit dcada47c6d
3 changed files with 7 additions and 2 deletions

View File

@ -1,6 +1,8 @@
*SVN*
* Fix "function $A" declaration inside of a conditional (confuses IE). Fixes #10882. [Jacco, Andrew Dupont]
* Test for attribute existence before applying more complex CSS3 selectors. Closes #10870. [arty, Tobie Langel]
* Fix "function $A" declaration inside of a conditional (confuses IE). Closes #10882. [Jacco, Andrew Dupont]
* Fixed selector parsing so that "#foo [bar=baz]" is treated the same way as "#foo *[bar=baz]". Closes #10734. [jlukas, kangax, Andrew Dupont]

View File

@ -297,7 +297,7 @@ Object.extend(Selector, {
attr: function(element, matches) {
var nodeValue = Element.readAttribute(element, matches[1]);
return Selector.operators[matches[2]](nodeValue, matches[3]);
return nodeValue && Selector.operators[matches[2]](nodeValue, matches[3]);
}
},

View File

@ -245,6 +245,9 @@
assert(!span.match('span span'), 'different ancestry');
assert(!span.match('span > span'), 'different parent');
assert(!span.match('span:nth-child(5)'), 'different pseudoclass');
assert(!$('link_2').match('a[rel^=external]'));
assert($('link_1').match('a[rel^=external]'));
}},
testSelectorWithSpaceInAttributeValue: function() {with(this) {