Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / input-value.html
blob4cc1d297d2d2e921b88594a78568c9eb6618080a
1 <script>
3 function extractValues()
5 var rows = document.getElementById("table").rows;
6 for (var i = 0; i< rows.length; i++) {
7 var row = rows[i];
8 var element = row.childNodes[1].firstChild;
9 try {
10 if (element.value) {
11 row.childNodes[2].innerHTML = element.value;
13 if (element.getAttribute("value")) {
14 row.childNodes[3].innerHTML = element.getAttribute("value");
16 } catch (exception) { }
20 function test()
22 var e;
24 document.getElementById("1").value = "after";
25 document.getElementById("9").value = "after";
26 document.getElementById("2").value = "after";
27 document.getElementById("5").value = "after";
28 document.getElementById("6").value = "after";
29 document.getElementById("7").value = "after";
30 document.getElementById("8").value = "after";
32 document.getElementById("3").setAttribute("value", "after");
33 document.getElementById("4").setAttribute("value", "after");
35 try {
36 e = document.getElementById("12");
37 e.value = "after";
38 e.type = "checkbox";
39 } catch (exception) { }
41 try {
42 e = document.getElementById("13");
43 e.value = "after";
44 e.type = "text";
45 } catch (exception) { }
47 try {
48 e = document.getElementById("14");
49 e.setAttribute("value", "after");
50 e.type = "checkbox";
51 } catch (exception) { }
53 try {
54 e = document.getElementById("15");
55 e.setAttribute("value", "after");
56 e.type = "text";
57 } catch (exception) { }
59 try {
60 document.getElementById("10").value = "after";
61 } catch (exception) { }
63 extractValues();
65 document.getElementById("form").reset();
68 </script>
70 <body onload="test()">
72 <p>Results that match WinIE are two columns on the right that say "after" every time, except for the last row which should have nothing in either column.</p>
73 <p>Results that match Gecko are like WinIE, but with "before" for the attribute in the first two rows and the last row.</p>
75 <hr>
77 <form id="form">
79 <table id="table">
81 <thead><th align="left">test case</th><th align="left">form element</th><th>property</th><th>attribute</th></thead>
83 <tr><td>text with value property changed</td><td><input id="1" value="before"></td><td ></td><td></td></tr>
84 <tr><td>password with value property changed</td><td><input id="9" type="password" value="before"></td><td></td><td></td></tr>
85 <tr><td>check box with value property changed</td><td><input id="2" type="checkbox" value="before"></td><td></td><td></td></tr>
86 <tr><td>hidden with value property changed</td><td><input id="5" type="hidden" value="before"></td><td></td><td></td></tr>
87 <tr><td>button with value property changed</td><td><input id="6" type="button" value="before"></td><td></td><td></td></tr>
88 <tr><td>image with value property changed</td><td><input id="7" type="image" value="before"></td><td></td><td></td></tr>
89 <tr><td>radio with value property changed</td><td><input id="8" type="radio" value="before"></td><td></td><td></td></tr>
91 <tr><td>text with value attribute changed</td><td><input id="3" value="before"></td><td ></td><td></td></tr>
92 <tr><td>check box with value attribute changed</td><td><input id="4" type="checkbox" value="before"></td><td></td><td></td></tr>
94 <tr><td>text with value property changed, then turned into check box</td><td><input id="12" value="before"></td><td ></td><td></td></tr>
95 <tr><td>check box with value property changed, then turned into text</td><td><input id="13" type="checkbox" value="before"></td><td></td><td></td></tr>
97 <tr><td>text with value attribute changed, then turned into check box</td><td><input id="14" value="before"></td><td ></td><td></td></tr>
98 <tr><td>check box with value attribute changed, then turned into text</td><td><input id="15" type="checkbox" value="before"></td><td></td><td></td></tr>
100 <tr><td>file with value property changed</td><td><input id="10" type="file" value="before"></td><td></td><td></td></tr>
102 </table>
104 </form>
106 </body>