blob: ca83fe7cf093c77b019b65be0abb0a902d310fdc [file] [log] [blame]
<html>
<head>
<script>
function test() {
if (window.testRunner)
testRunner.dumpAsText();
var f = window.document.forms[0];
var e = document.createElement('input');
e.type = 'text'
e.name = 'y';
e.value = 'y';
f.replaceChild(e, f.y);
for (var i = 0; i < f.elements.length; i++) {
var line = document.createElement("div");
line.appendChild(document.createTextNode(f.elements[i].name));
document.getElementById("result").appendChild(line);
}
}
</script>
<body onload="test()">
<p>This test checks that the elements array of a form element returns the elements in document order
rather than order of insertion into the document. Older versions of WebKit returned the elements in
order of insertion.</p>
<p>If the test works properly, the text at the bottom will most likely say "x" then "y" then "z" in that order.
If it fails, it will most likely say "x", then "z", then "y".</p>
<hr>
<p>
<form>
<input type='text' name='x' value='x'>
<input type='text' name='y' value='y'>
<input type='text' name='z' value='z'>
</form>
</p>
<hr>
<p id="result"></p>
</body>
</html>