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..6f8f9e2fcd2eb211eca6a8f20832f227b60fdc4d |
--- /dev/null |
+++ b/LayoutTests/fast/forms/form-radio-img-node-list.html |
@@ -0,0 +1,46 @@ |
+<!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> |