summaryrefslogtreecommitdiffstats
path: root/WebCore/xml/XPathStep.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/xml/XPathStep.cpp')
-rw-r--r--WebCore/xml/XPathStep.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/WebCore/xml/XPathStep.cpp b/WebCore/xml/XPathStep.cpp
index 411b616..e5f2048 100644
--- a/WebCore/xml/XPathStep.cpp
+++ b/WebCore/xml/XPathStep.cpp
@@ -193,9 +193,13 @@ static inline bool nodeMatchesBasicTest(Node* node, Step::Axis axis, const Step:
if (name == starAtom)
return namespaceURI.isEmpty() || namespaceURI == node->namespaceURI();
- 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());
+ }
+ // 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();
}
return static_cast<Element*>(node)->hasLocalName(name) && namespaceURI == node->namespaceURI();
}