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

Unified Diff: Source/core/html/HTMLCollection.cpp

Issue 158563004: Make HTMLAllCollection named property getter behave more according to spec (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase and get rid of code duplication Created 6 years, 10 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
« no previous file with comments | « Source/core/html/HTMLAllCollection.idl ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « Source/core/html/HTMLAllCollection.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698