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) {