blob: 4cc1d297d2d2e921b88594a78568c9eb6618080a [file] [log] [blame]
<script>
function extractValues()
{
var rows = document.getElementById("table").rows;
for (var i = 0; i< rows.length; i++) {
var row = rows[i];
var element = row.childNodes[1].firstChild;
try {
if (element.value) {
row.childNodes[2].innerHTML = element.value;
}
if (element.getAttribute("value")) {
row.childNodes[3].innerHTML = element.getAttribute("value");
}
} catch (exception) { }
}
}
function test()
{
var e;
document.getElementById("1").value = "after";
document.getElementById("9").value = "after";
document.getElementById("2").value = "after";
document.getElementById("5").value = "after";
document.getElementById("6").value = "after";
document.getElementById("7").value = "after";
document.getElementById("8").value = "after";
document.getElementById("3").setAttribute("value", "after");
document.getElementById("4").setAttribute("value", "after");
try {
e = document.getElementById("12");
e.value = "after";
e.type = "checkbox";
} catch (exception) { }
try {
e = document.getElementById("13");
e.value = "after";
e.type = "text";
} catch (exception) { }
try {
e = document.getElementById("14");
e.setAttribute("value", "after");
e.type = "checkbox";
} catch (exception) { }
try {
e = document.getElementById("15");
e.setAttribute("value", "after");
e.type = "text";
} catch (exception) { }
try {
document.getElementById("10").value = "after";
} catch (exception) { }
extractValues();
document.getElementById("form").reset();
}
</script>
<body onload="test()">
<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>
<p>Results that match Gecko are like WinIE, but with "before" for the attribute in the first two rows and the last row.</p>
<hr>
<form id="form">
<table id="table">
<thead><th align="left">test case</th><th align="left">form element</th><th>property</th><th>attribute</th></thead>
<tr><td>text with value property changed</td><td><input id="1" value="before"></td><td ></td><td></td></tr>
<tr><td>password with value property changed</td><td><input id="9" type="password" value="before"></td><td></td><td></td></tr>
<tr><td>check box with value property changed</td><td><input id="2" type="checkbox" value="before"></td><td></td><td></td></tr>
<tr><td>hidden with value property changed</td><td><input id="5" type="hidden" value="before"></td><td></td><td></td></tr>
<tr><td>button with value property changed</td><td><input id="6" type="button" value="before"></td><td></td><td></td></tr>
<tr><td>image with value property changed</td><td><input id="7" type="image" value="before"></td><td></td><td></td></tr>
<tr><td>radio with value property changed</td><td><input id="8" type="radio" value="before"></td><td></td><td></td></tr>
<tr><td>text with value attribute changed</td><td><input id="3" value="before"></td><td ></td><td></td></tr>
<tr><td>check box with value attribute changed</td><td><input id="4" type="checkbox" value="before"></td><td></td><td></td></tr>
<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>
<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>
<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>
<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>
<tr><td>file with value property changed</td><td><input id="10" type="file" value="before"></td><td></td><td></td></tr>
</table>
</form>
</body>