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

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

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/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..5ce6950b859a8efb1a421313557c022553da4554 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,9 @@ 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 (test_element.IsHTMLElement())
tkent 2017/05/09 00:28:01 The specification says "if root’s node document is
Shanmuga Pandi 2017/05/10 06:35:45 I have tried to replace the if condition with belo
fs 2017/05/10 08:34:15 FWIW, I think this "IsHTMLElement" check correspon
tkent 2017/05/11 04:14:02 You're right. "if root’s node document is an HTML
+ return lowered_qualified_name_ == test_element.TagQName().ToString();
+ return qualified_name_ == test_element.TagQName().ToString();
fs 2017/05/08 14:20:36 This creates a temporary string for each compariso
Shanmuga Pandi 2017/05/10 06:35:45 I think initially webkit tried this approach and l
Shanmuga Pandi 2017/05/10 07:05:28 Can we use Document::ParseQualifiedName() and stor
fs 2017/05/10 08:34:15 Fair enough. We could add a "CompareQualifiedName(
Shanmuga Pandi 2017/05/10 09:03:12 Ok. I will keep the current comparision as it is a
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698