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

Unified Diff: LayoutTests/fast/forms/form-radio-img-node-list.html

Issue 119063002: Have HTMLFormElement's named getter return a RadioNodeList. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add a RadioImgNodeListType CollectionType and use it + test improvements. Created 7 years 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
Index: LayoutTests/fast/forms/form-radio-img-node-list.html
diff --git a/LayoutTests/fast/forms/form-radio-img-node-list.html b/LayoutTests/fast/forms/form-radio-img-node-list.html
new file mode 100644
index 0000000000000000000000000000000000000000..d7cf6fc4eeb6f76ac002526ab8c80dd29d35c1f0
--- /dev/null
+++ b/LayoutTests/fast/forms/form-radio-img-node-list.html
@@ -0,0 +1,47 @@
+<!doctype html>
+<script src="../../resources/js-test.js"></script>
+<form id="f1">
+ <button id=n1></button>
+ <keygen id=n1></keygen>
+ <output id=n1></output>
+ <object name=n1></object>
+ <select name=n1><option id=n1></option></select>
+ <input name=n1 type=hidden>
+ <input name=n1 type=image>
+ <input name=n1 type=text>
+ <input name=n2 type=image>
+ <img name=n2></img>
+ <img id=n2></img>
+</form>
+<script>
+description("Test RadioNodeLists returned by the HTMLFormElement named-getter.");
+
+var radioNodeList;
+
+function shouldBeImgElement(n) {
+ shouldBeTrue("radioNodeList[" + n + "] instanceof HTMLImageElement");
+}
+
+function verifyLength(n) {
+ shouldBe("radioNodeList.length", n.toString());
+ for (var i = 0; i < n; i++)
+ shouldBeImgElement(i);
+}
+
+debug("Check that if no 'listed elements' match by name, img elements are picked instead.");
+
+var form = document.getElementById("f1");
+radioNodeList = form["n2"];
+verifyLength(2);
+
+var button = document.createElement("button");
+button.name = "n2";
+form.appendChild(button);
+verifyLength(2);
+
+var img = document.createElement("img");
+img.name = "n2";
+form.appendChild(img);
+verifyLength(3);
+</script>
+<p id="description"></p>
tkent 2013/12/20 00:18:11 nit: You don't need to write #description element.
sof 2013/12/20 07:02:12 Aha - top tip, thanks :) Thoroughly gone. (I assu

Powered by Google App Engine
This is Rietveld 408576698