Index: Source/core/html/HTMLCollection.cpp |
diff --git a/Source/core/html/HTMLCollection.cpp b/Source/core/html/HTMLCollection.cpp |
index a6f239f4b794d5517814a2a9f530e3e66de1a3a2..3a9981764b1c6a96a823e13b8223eaf6fd98ca27 100644 |
--- a/Source/core/html/HTMLCollection.cpp |
+++ b/Source/core/html/HTMLCollection.cpp |
@@ -387,11 +387,17 @@ Element* HTMLCollection::virtualItemAfter(Element*) const |
static inline bool nameShouldBeVisibleInDocumentAll(const HTMLElement& element) |
{ |
+ // http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#dom-htmlallcollection-nameditem: |
// 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) |
+ return element.hasLocalName(aTag) |
+ || element.hasLocalName(appletTag) |
+ || element.hasLocalName(areaTag) |
|| element.hasLocalName(embedTag) |
|| element.hasLocalName(formTag) |
+ || element.hasLocalName(frameTag) |
+ || element.hasLocalName(framesetTag) |
+ || element.hasLocalName(iframeTag) |
|| element.hasLocalName(imgTag) |
|| element.hasLocalName(inputTag) |
|| element.hasLocalName(objectTag) |
@@ -516,7 +522,7 @@ void HTMLCollection::supportedPropertyNames(Vector<String>& names) |
if (!element->isHTMLElement()) |
continue; |
const AtomicString& nameAttribute = element->getNameAttribute(); |
- if (!nameAttribute.isEmpty()) { |
+ if (!nameAttribute.isEmpty() && (type() != DocAll || nameShouldBeVisibleInDocumentAll(toHTMLElement(*element)))) { |
HashSet<AtomicString>::AddResult addResult = existingNames.add(nameAttribute); |
if (addResult.isNewEntry) |
names.append(nameAttribute); |