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

Unified Diff: third_party/WebKit/Source/core/dom/TagCollection.cpp

Issue 2868823002: getElementsByTagName() should take a qualifiedName in parameter (Closed)
Patch Set: Rebased And Align with review comments Created 3 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: third_party/WebKit/Source/core/dom/TagCollection.cpp
diff --git a/third_party/WebKit/Source/core/dom/TagCollection.cpp b/third_party/WebKit/Source/core/dom/TagCollection.cpp
index fb1ef54cf1108eff9d5da87abc067de8a1b6ca66..e50e6fe475cf94d3ddc0e94264226e35c36f128d 100644
--- a/third_party/WebKit/Source/core/dom/TagCollection.cpp
+++ b/third_party/WebKit/Source/core/dom/TagCollection.cpp
@@ -30,17 +30,32 @@ namespace blink {
TagCollection::TagCollection(ContainerNode& root_node,
CollectionType type,
- const AtomicString& namespace_uri,
- const AtomicString& local_name)
+ const AtomicString& qualified_name)
+ : HTMLCollection(root_node, type, kDoesNotOverrideItemAfter),
+ qualified_name_(qualified_name) {}
+
+TagCollection::~TagCollection() {}
+
+bool TagCollection::ElementMatches(const Element& test_node) const {
+ if (qualified_name_ == g_star_atom)
+ return true;
+
+ return qualified_name_ == test_node.TagQName().ToString();
+}
+
+TagCollectionNS::TagCollectionNS(ContainerNode& root_node,
+ CollectionType type,
+ const AtomicString& namespace_uri,
+ const AtomicString& local_name)
: HTMLCollection(root_node, type, kDoesNotOverrideItemAfter),
namespace_uri_(namespace_uri),
local_name_(local_name) {
DCHECK(namespace_uri_.IsNull() || !namespace_uri_.IsEmpty());
}
-TagCollection::~TagCollection() {}
+TagCollectionNS::~TagCollectionNS() {}
-bool TagCollection::ElementMatches(const Element& test_node) const {
+bool TagCollectionNS::ElementMatches(const Element& test_node) const {
// Implements
// https://dom.spec.whatwg.org/#concept-getelementsbytagnamens
if (local_name_ != g_star_atom && local_name_ != test_node.localName())
« no previous file with comments | « third_party/WebKit/Source/core/dom/TagCollection.h ('k') | third_party/WebKit/Source/core/html/CollectionType.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698