6 testRunner
.dumpAsText();
8 var f
= window
.document
.forms
[0];
10 var e
= document
.createElement('input');
14 f
.replaceChild(e
, f
.y
);
16 for (var i
= 0; i
< f
.elements
.length
; i
++) {
17 var line
= document
.createElement("div");
18 line
.appendChild(document
.createTextNode(f
.elements
[i
].name
));
19 document
.getElementById("result").appendChild(line
);
23 <body onload=
"test()">
24 <p>This test checks that the elements array of a form element returns the elements in document order
25 rather than order of insertion into the document. Older versions of WebKit returned the elements in
26 order of insertion.
</p>
27 <p>If the test works properly, the text at the bottom will most likely say
"x" then
"y" then
"z" in that order.
28 If it fails, it will most likely say
"x", then
"z", then
"y".
</p>
32 <input type='text' name='x' value='x'
>
33 <input type='text' name='y' value='y'
>
34 <input type='text' name='z' value='z'
>