| <html> |
| <head> |
| <script> |
| function debug(str) { |
| var c = document.getElementById('console') |
| c.innerHTML += (str + "<br>") |
| } |
| |
| function runTests() { |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| |
| var input1 = document.getElementById('input1'); |
| input1.value = 'Test'; |
| |
| var input1clone = input1.cloneNode(true); |
| if (input1clone.value != input1.value) { |
| debug('FAILURE: input1clone.value was "' + input1clone.value + '", expected "' + input1.value + '"') |
| return; |
| } |
| |
| var input1imported = document.importNode(input1, true); |
| if (input1imported.value != input1.value) { |
| debug('FAILURE: input1imported.value was "' + input1imported.value + '", expected "' + input1.value + '"') |
| return; |
| } |
| |
| var input2 = document.getElementById('input2'); |
| input2.checked = true; |
| var input2clone = input2.cloneNode(true); |
| if (input2clone.checked != input2.checked) { |
| debug('FAILURE: input2clone.checked was "' + input2clone.checked + '", expected "' + input2.checked + '"') |
| return; |
| } |
| |
| var input2imported = document.importNode(input2, true); |
| if (input2imported.checked != input2.checked) { |
| debug('FAILURE: input2imported.checked was "' + input2imported.checked + '", expected "' + input2.checked + '"') |
| return; |
| } |
| |
| |
| debug('SUCCESS!') |
| } |
| </script> |
| </head> |
| <body onload="runTests();"> |
| <input id="input1" type="text"> |
| <input id="input2" type="checkbox"> |
| <div> |
| This tests that cloneNode and importNode copies the form element properties that aren't stored in values, such as 'value', and 'checked'. If this test is successful, the text SUCCESS should be shown below. |
| </div> |
| <pre id="console"></pre> |
| </body> |
| </html> |