| var f = window.document.forms[0]; |
| var e = document.createElement('input'); |
| 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); |
| <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 |
| <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> |
| <input type='text' name='x' value='x'> |
| <input type='text' name='y' value='y'> |
| <input type='text' name='z' value='z'> |