From f4d68350f3ce3c2d1649312f6db2b61c8470c016 Mon Sep 17 00:00:00 2001 From: Tobie Langel Date: Sun, 3 Feb 2008 19:45:32 +0000 Subject: [PATCH] prototype: Allow Selector to correctly detect the presence of namespaced attributes. Closes #10987. --- CHANGELOG | 2 ++ src/selector.js | 2 +- test/unit/selector.html | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 2b2addb..cd2983d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* Allow Selector to correctly detect the presence of namespaced attributes. Closes #10987. [Samuel Lebeau, Tobie Langel] + * Make Element#absolutize and Element#relativize always return element. Closes #10983. [kangax] * Add deprecation extension. [Tobie Langel] diff --git a/src/selector.js b/src/selector.js index e679356..05789f7 100644 --- a/src/selector.js +++ b/src/selector.js @@ -273,7 +273,7 @@ Object.extend(Selector, { className: /^\.([\w\-\*]+)(\b|$)/, pseudo: /^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/, - attrPresence: /^\[([\w]+)\]/, + attrPresence: /^\[((?:[\w]+:)?[\w]+)\]/, attr: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/ }, diff --git a/test/unit/selector.html b/test/unit/selector.html index bf85d81..2392fc7 100644 --- a/test/unit/selector.html +++ b/test/unit/selector.html @@ -268,6 +268,9 @@ assertUndefined(new Selector('body p[xml:lang]').xpath); } else info("Could not test XPath bypass: no XPath to begin with!"); + + assertElementsMatch($$('[xml:lang]'), 'html', '#item_3'); + assertElementsMatch($$('*[xml:lang]'), 'html', '#item_3'); }}, testSelectorWithChild: function() { with(this) {