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

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

Issue 143453010: Have getElementsByClassName() / getElementsByTagName*() return an HTMLCollection (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Null HTMLCollection handling Created 6 years, 11 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/ContainerNode.cpp
diff --git a/Source/core/dom/ContainerNode.cpp b/Source/core/dom/ContainerNode.cpp
index 2f162a0cb0305a279256f431cf7689ece6d524c5..f815d00ca673edfd37b2cbcca3cec3c000e6e0f6 100644
--- a/Source/core/dom/ContainerNode.cpp
+++ b/Source/core/dom/ContainerNode.cpp
@@ -25,7 +25,7 @@
#include "bindings/v8/ExceptionState.h"
#include "core/dom/ChildListMutationScope.h"
-#include "core/dom/ClassNodeList.h"
+#include "core/dom/ClassCollection.h"
#include "core/dom/ContainerNodeAlgorithms.h"
#include "core/dom/ElementTraversal.h"
#include "core/dom/ExceptionCode.h"
@@ -999,17 +999,17 @@ void ContainerNode::updateTreeAfterInsertion(Node& child)
dispatchChildInsertionEvents(child);
}
-PassRefPtr<NodeList> ContainerNode::getElementsByTagName(const AtomicString& localName)
+PassRefPtr<HTMLCollection> ContainerNode::getElementsByTagName(const AtomicString& localName)
{
if (localName.isNull())
return 0;
if (document().isHTMLDocument())
- return ensureRareData().ensureNodeLists().addCacheWithAtomicName<HTMLTagNodeList>(this, HTMLTagNodeListType, localName);
- return ensureRareData().ensureNodeLists().addCacheWithAtomicName<TagNodeList>(this, TagNodeListType, localName);
+ return ensureRareData().ensureNodeLists().addCacheWithAtomicName<HTMLTagCollection>(this, HTMLTagCollectionType, localName);
+ return ensureRareData().ensureNodeLists().addCacheWithAtomicName<TagCollection>(this, TagCollectionType, localName);
}
-PassRefPtr<NodeList> ContainerNode::getElementsByTagNameNS(const AtomicString& namespaceURI, const AtomicString& localName)
+PassRefPtr<HTMLCollection> ContainerNode::getElementsByTagNameNS(const AtomicString& namespaceURI, const AtomicString& localName)
{
if (localName.isNull())
return 0;
@@ -1029,9 +1029,9 @@ PassRefPtr<NodeList> ContainerNode::getElementsByName(const AtomicString& elemen
// Takes an AtomicString in argument because it is common for elements to share the same set of class names.
// Therefore, the ClassNodeList factory function expects an AtomicString type.
-PassRefPtr<NodeList> ContainerNode::getElementsByClassName(const AtomicString& classNames)
+PassRefPtr<HTMLCollection> ContainerNode::getElementsByClassName(const AtomicString& classNames)
{
- return ensureRareData().ensureNodeLists().addCacheWithAtomicName<ClassNodeList>(this, ClassNodeListType, classNames);
+ return ensureRareData().ensureNodeLists().addCacheWithAtomicName<ClassCollection>(this, ClassCollectionType, classNames);
}
PassRefPtr<RadioNodeList> ContainerNode::radioNodeList(const AtomicString& name, bool onlyMatchImgElements)

Powered by Google App Engine
This is Rietveld 408576698