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

Unified Diff: LayoutTests/fast/dom/htmlformcontrolscollection-enumerated-properties.html

Issue 157013006: Update HTMLFormControlsCollection's named getter to behave according to spec (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove legacycaller 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 | « no previous file | LayoutTests/fast/dom/htmlformcontrolscollection-enumerated-properties-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/dom/htmlformcontrolscollection-enumerated-properties.html
diff --git a/LayoutTests/fast/dom/htmlformcontrolscollection-enumerated-properties.html b/LayoutTests/fast/dom/htmlformcontrolscollection-enumerated-properties.html
new file mode 100644
index 0000000000000000000000000000000000000000..766151af04181c2fedd41aadaffcdb9e30306d8d
--- /dev/null
+++ b/LayoutTests/fast/dom/htmlformcontrolscollection-enumerated-properties.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src="../../resources/js-test.js"></script>
+<form id="testForm">
+<input id="id1" name="name1"></input>
+<input id="id2" name="name1"></input>
+<input id="id3"></input>
+<input id="id4" name="name4"></input>
+<input name="name5"></input>
+<input id="id4" name="name6"></input>
+</form>
+
+<script>
+description("This tests verifies the enumerated properties on HTMLFormControlsCollection and their order.");
+
+var testForm = document.getElementById("testForm");
+var htmlFormControlsCollection = testForm.elements;
+shouldBe("htmlFormControlsCollection.__proto__", "HTMLFormControlsCollection.prototype");
+shouldBe("htmlFormControlsCollection.__proto__.__proto__", "HTMLCollection.prototype");
+shouldBe("htmlFormControlsCollection.length", "6");
+
+// As per http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#htmlformcontrolscollection-0:
+// - The object's supported property indices are as defined for HTMLCollection objects.
+// - The supported property names consist of the non-empty values of all the id and name attributes of all the elements
+// represented by the collection, in tree order, ignoring later duplicates, with the id of an element preceding its name if
+// it contributes both, they differ from each other, and neither is the duplicate of an earlier entry.
+var expectedEnumeratedProperties = ["0", "1" , "2", "3", "4", "5", "length", "id1", "name1", "id2", "id3", "id4", "name4", "name5", "name6", "namedItem", "item"];
+
+var enumeratedProperties = [];
+for (var property in htmlFormControlsCollection) {
+ enumeratedProperties[enumeratedProperties.length] = property;
+}
+shouldBe("enumeratedProperties", "expectedEnumeratedProperties");
+</script>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/fast/dom/htmlformcontrolscollection-enumerated-properties-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698