Index: Source/core/html/HTMLCollection.cpp |
diff --git a/Source/core/html/HTMLCollection.cpp b/Source/core/html/HTMLCollection.cpp |
index 46350053705dcac07eea661a6ea0e57f2e920095..953de84d8d8cf3afb6af6fbad4a7c09846d58b01 100644 |
--- a/Source/core/html/HTMLCollection.cpp |
+++ b/Source/core/html/HTMLCollection.cpp |
@@ -30,6 +30,7 @@ |
#include "core/dom/NodeList.h" |
#include "core/dom/NodeRareData.h" |
#include "core/dom/NodeTraversal.h" |
+#include "core/html/HTMLAllCollection.h" |
#include "core/html/HTMLElement.h" |
#include "core/html/HTMLObjectElement.h" |
#include "core/html/HTMLOptionElement.h" |
@@ -385,19 +386,6 @@ Element* HTMLCollection::virtualItemAfter(Element*) const |
return 0; |
} |
-static inline bool nameShouldBeVisibleInDocumentAll(const HTMLElement& element) |
-{ |
- // The document.all collection returns only certain types of elements by name, |
- // although it returns any type of element by id. |
- return element.hasLocalName(appletTag) |
- || element.hasLocalName(embedTag) |
- || element.hasLocalName(formTag) |
- || element.hasLocalName(imgTag) |
- || element.hasLocalName(inputTag) |
- || element.hasLocalName(objectTag) |
- || element.hasLocalName(selectTag); |
-} |
- |
inline Element* firstMatchingChildElement(const HTMLCollection& nodeList, const ContainerNode& root) |
{ |
Element* element = ElementTraversal::firstWithin(root); |
@@ -542,7 +530,7 @@ void HTMLCollection::updateNameCache() const |
if (!element->isHTMLElement()) |
continue; |
const AtomicString& nameAttrVal = element->getNameAttribute(); |
- if (!nameAttrVal.isEmpty() && idAttrVal != nameAttrVal && (type() != DocAll || nameShouldBeVisibleInDocumentAll(toHTMLElement(*element)))) |
+ if (!nameAttrVal.isEmpty() && idAttrVal != nameAttrVal && (type() != DocAll || HTMLAllCollection::elementNameShouldBeVisible(toHTMLElement(*element)))) |
appendNameCache(nameAttrVal, element); |
} |