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

Unified Diff: third_party/WebKit/Source/core/html/HTMLTagCollection.h

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/html/HTMLTagCollection.h
diff --git a/third_party/WebKit/Source/core/html/HTMLTagCollection.h b/third_party/WebKit/Source/core/html/HTMLTagCollection.h
index 3c493ad0f6ced2a6ab74f8af8fb51cea34a85511..045aaf48977fd19145decfa7b769d9575acd4cd0 100644
--- a/third_party/WebKit/Source/core/html/HTMLTagCollection.h
+++ b/third_party/WebKit/Source/core/html/HTMLTagCollection.h
@@ -36,17 +36,18 @@ class HTMLTagCollection final : public TagCollection {
public:
static HTMLTagCollection* Create(ContainerNode& root_node,
CollectionType type,
- const AtomicString& local_name) {
+ const AtomicString& qualified_name) {
DCHECK_EQ(type, kHTMLTagCollectionType);
- return new HTMLTagCollection(root_node, local_name);
+ return new HTMLTagCollection(root_node, qualified_name);
}
bool ElementMatches(const Element&) const;
private:
- HTMLTagCollection(ContainerNode& root_node, const AtomicString& local_name);
+ HTMLTagCollection(ContainerNode& root_node,
+ const AtomicString& qualified_name);
- AtomicString lowered_local_name_;
+ AtomicString lowered_qualified_name_;
};
DEFINE_TYPE_CASTS(HTMLTagCollection,
@@ -57,16 +58,11 @@ DEFINE_TYPE_CASTS(HTMLTagCollection,
inline bool HTMLTagCollection::ElementMatches(
const Element& test_element) const {
- // Implements
- // https://dom.spec.whatwg.org/#concept-getelementsbytagname
- if (local_name_ != g_star_atom) {
- const AtomicString& local_name =
- test_element.IsHTMLElement() ? lowered_local_name_ : local_name_;
- if (local_name != test_element.localName())
- return false;
- }
- DCHECK_EQ(namespace_uri_, g_star_atom);
- return true;
+ if (qualified_name_ == g_star_atom)
+ return true;
+ if (test_element.IsHTMLElement())
+ return lowered_qualified_name_ == test_element.TagQName().ToString();
+ return qualified_name_ == test_element.TagQName().ToString();
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLCollection.cpp ('k') | third_party/WebKit/Source/core/html/HTMLTagCollection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698