Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(670)

Unified Diff: Source/core/dom/SelectorQuery.cpp

Issue 1099963003: Support type selector for camel-cased SVG elements in HTML. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Removed stray include Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/SelectorQuery.cpp
diff --git a/Source/core/dom/SelectorQuery.cpp b/Source/core/dom/SelectorQuery.cpp
index 6a5d428934d4258c09430f6dfa83f20f63bad1f4..71f709c09e718db0f1e8167245dc03c09a6fef54 100644
--- a/Source/core/dom/SelectorQuery.cpp
+++ b/Source/core/dom/SelectorQuery.cpp
@@ -175,6 +175,17 @@ void SelectorDataList::collectElementsByClassName(ContainerNode& rootNode, const
}
}
+inline bool tagNameMatches(const QualifiedName& tagName, const Element& element)
esprehn 2015/05/07 02:21:27 Can you add a comment for what this is about? (her
rune 2015/05/07 07:59:48 Done.
+{
+ if (tagName == anyQName())
+ return true;
+ if (element.hasLocalName(tagName.localName()))
+ return true;
+ if (element.isHTMLElement() || !element.document().isHTMLDocument())
+ return false;
+ return equalIgnoringCase(tagName.localName(), element.localName());
+}
+
template <typename SelectorQueryTrait>
void SelectorDataList::collectElementsByTagName(ContainerNode& rootNode, const QualifiedName& tagName, typename SelectorQueryTrait::OutputType& output) const
{
@@ -182,7 +193,7 @@ void SelectorDataList::collectElementsByTagName(ContainerNode& rootNode, const Q
// querySelector*() doesn't allow namespaces and throws before it gets
// here so we can ignore them.
ASSERT(tagName.namespaceURI() == starAtom);
- if (tagName == anyQName() || element.hasLocalName(tagName.localName())) {
+ if (tagNameMatches(tagName, element)) {
SelectorQueryTrait::appendElement(output, element);
if (SelectorQueryTrait::shouldOnlyMatchFirstElement)
return;
« Source/core/css/ElementRuleCollector.cpp ('K') | « Source/core/css/SelectorFilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698