| <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" checked="checked"> |
| <div> |
| This tests that cloneNode and importNode copy 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. |
| This is a variation on the base test that has the checked attribute already set, which at one point |
| caused a crash (see <a href="https://bugs.webkit.org/show_bug.cgi?id=6617">Bugzilla bug 6617</a>). |
| </div> |
| <pre id="console"></pre> |
| </body> |
| </html> |