Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / form-radio-img-node-list.html
blob1f4d6282234d696ded5b75193ba2f5ae8cbed667
1 <!doctype html>
2 <script src="../../resources/js-test.js"></script>
3 <img name=outside1></img>
4 <form id="f1">
5 <button id=n1></button>
6 <keygen id=n1></keygen>
7 <output id=n1></output>
8 <object name=n1></object>
9 <select name=n1><option id=n1></option></select>
10 <input name=n1 type=hidden>
11 <input name=n1 type=image>
12 <input name=n1 type=text>
13 <input name=n2 type=image>
14 <img name=n2></img>
15 <img id=n2></img>
16 <img id=n3></img>
17 </form>
18 <!-- The img element isn't 'reassociatable'; add @form to verify it is so. -->
19 <img name=n2 form=f1></img>
20 <script>
21 description("Test RadioNodeLists returned by the HTMLFormElement named-getter.");
23 var radioNodeList;
25 function shouldBeImgElement(n) {
26 shouldBeTrue("radioNodeList[" + n + "] instanceof HTMLImageElement");
29 function verifyLength(n) {
30 shouldBe("radioNodeList.length", n.toString());
31 for (var i = 0; i < n; i++)
32 shouldBeImgElement(i);
35 debug("Check that if no 'listed elements' match by name, img elements are picked instead.");
37 var form = document.getElementById("f1");
38 radioNodeList = form["n2"];
39 verifyLength(2);
41 var button = document.createElement("button");
42 button.name = "n2";
43 form.appendChild(button);
44 verifyLength(2);
46 var img = document.createElement("img");
47 img.name = "n2";
48 form.appendChild(img);
49 verifyLength(3);
50 </script>