diff --git a/CHANGELOG b/CHANGELOG index 5f0c3e9..d95b16a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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] diff --git a/src/selector.js b/src/selector.js index 65a52d8..de5d590 100644 --- a/src/selector.js +++ b/src/selector.js @@ -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]); } }, diff --git a/test/unit/selector.html b/test/unit/selector.html index f4e93f9..1d57c1c 100644 --- a/test/unit/selector.html +++ b/test/unit/selector.html @@ -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');