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

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

Issue 2868823002: getElementsByTagName() should take a qualifiedName in parameter (Closed)
Patch Set: Added new file AllDescendantsCollection.h 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..642818660d8d1c90498171480367968db80e0b9a 100644
--- a/third_party/WebKit/Source/core/dom/TagCollection.cpp
+++ b/third_party/WebKit/Source/core/dom/TagCollection.cpp
@@ -30,17 +30,31 @@ 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) {
+ DCHECK_NE(qualified_name, g_star_atom);
+}
+
+TagCollection::~TagCollection() {}
+
+bool TagCollection::ElementMatches(const Element& test_node) const {
+ return qualified_name_ == test_node.TagQName().ToString();
fs 2017/05/08 14:20:36 See comment in HTMLTagCollection.
+}
+
+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())

Powered by Google App Engine
This is Rietveld 408576698