Because it matches elements in the default XHTML namespace, and XHTML now says that this should change, see <http://www.w3.org/Bugs/Public/show_bug.cgi?id=7059>.
Created attachment 42243 [details] proposed patch
Comment on attachment 42243 [details] proposed patch > - if (node->isHTMLElement() && node->document()->isHTMLDocument()) { > - // Paths without namespaces should match HTML elements in HTML documents despite those having an XHTML namespace. Names are compared case-insensitively. > - return equalIgnoringCase(static_cast<Element*>(node)->localName(), name) && (namespaceURI.isNull() || namespaceURI == node->namespaceURI()); > + if (node->document()->isHTMLDocument()) { > + if (node->isHTMLElement()) { > + // Paths without namespaces should match HTML elements in HTML documents despite those having an XHTML namespace. Names are compared case-insensitively. > + return equalIgnoringCase(static_cast<Element*>(node)->localName(), name) && (namespaceURI.isNull() || namespaceURI == node->namespaceURI()); > + } else { > + // An expression without any prefix shouldn't match no-namespace nodes (because HTML5 says so). > + return static_cast<Element*>(node)->hasLocalName(name) && namespaceURI == node->namespaceURI() && !namespaceURI.isNull(); > + } We normally don't do else after return. It would be nice if the test case covered a few more cases than just the bug-fixed one. r=me
> It would be nice if the test case covered a few more cases than just the > bug-fixed one. We've got a number of tests for namespaces in XPath element node tests - these few lines of code have a long history.
Committed <http://trac.webkit.org/changeset/50419>.