Fixed issue where Element#match failed on attribute selectors with single or double quotes. Closes #10067. [Cezary Okupski, Andrew Dupont]

This commit is contained in:
Andrew Dupont 2008-01-23 20:05:17 +00:00
parent a5fe12b9a1
commit 7942a9e5c9
3 changed files with 5 additions and 1 deletions

View File

@ -1,5 +1,7 @@
*SVN*
* Fixed issue where Element#match failed on attribute selectors with single or double quotes. Closes #10067. [Cezary Okupski, Andrew Dupont]
* Add tests for Element#match. [Tobie Langel]
* Fix Element#writeAttribute to work with 'cellspacing' and 'cellpadding' attributes in IE. Closes #9983. [/dev/urandom, Tobie Langel]

View File

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

View File

@ -249,6 +249,8 @@
assert(!$('link_2').match('a[rel^=external]'));
assert($('link_1').match('a[rel^=external]'));
assert($('link_1').match('a[rel^="external"]'));
assert($('link_1').match("a[rel^='external']"));
assert(span.match({ match: function(element) { return true }}), 'custom selector');
assert(!span.match({ match: function(element) { return false }}), 'custom selector');