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

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

Issue 157813013: Update the order of named properties on HTMLCollection objects (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Reup 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 | « LayoutTests/fast/dom/htmlcollection-enumerated-properties.html ('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 46350053705dcac07eea661a6ea0e57f2e920095..a6f239f4b794d5517814a2a9f530e3e66de1a3a2 100644
--- a/Source/core/html/HTMLCollection.cpp
+++ b/Source/core/html/HTMLCollection.cpp
@@ -500,27 +500,27 @@ void HTMLCollection::supportedPropertyNames(Vector<String>& names)
// The supported property names are the values from the list returned by these steps:
// 1. Let result be an empty list.
// 2. For each element represented by the collection, in tree order, run these substeps:
- // 1. If element is in the HTML namespace and has a name attribute whose value is neither the empty string
+ // 1. If element has an ID which is neither the empty string nor is in result, append element's ID to result.
+ // 2. If element is in the HTML namespace and has a name attribute whose value is neither the empty string
// nor is in result, append element's name attribute value to result.
- // 2. If element has an ID which is neither the empty string nor is in result, append element's ID to result.
// 3. Return result.
HashSet<AtomicString> existingNames;
ContainerNode& root = rootNode();
for (Element* element = traverseToFirstElement(root); element; element = traverseNextElement(*element, root)) {
- if (element->isHTMLElement()) {
- const AtomicString& nameAttribute = element->getNameAttribute();
- if (!nameAttribute.isEmpty()) {
- HashSet<AtomicString>::AddResult addResult = existingNames.add(nameAttribute);
- if (addResult.isNewEntry)
- names.append(nameAttribute);
- }
- }
const AtomicString& idAttribute = element->getIdAttribute();
if (!idAttribute.isEmpty()) {
HashSet<AtomicString>::AddResult addResult = existingNames.add(idAttribute);
if (addResult.isNewEntry)
names.append(idAttribute);
}
+ if (!element->isHTMLElement())
+ continue;
+ const AtomicString& nameAttribute = element->getNameAttribute();
+ if (!nameAttribute.isEmpty()) {
+ HashSet<AtomicString>::AddResult addResult = existingNames.add(nameAttribute);
+ if (addResult.isNewEntry)
+ names.append(nameAttribute);
+ }
}
}
« no previous file with comments | « LayoutTests/fast/dom/htmlcollection-enumerated-properties.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698