| <!DOCTYPE> |
| <html> |
| <head> |
| <script> |
| var i = 0; |
| </script> |
| </head> |
| <body> |
| <p>This tests cloning a script element that has already started and inserting it into the document does not re-run the script. You should see PASS:</p> |
| <div><script> i++ </script></div> |
| <script> |
| |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| |
| var script = document.getElementsByTagName('script')[1]; |
| var div = script.parentNode; |
| div.removeChild(script); |
| div.appendChild(script.cloneNode(true)); |
| |
| result = 'PASS'; |
| if (i == 2) |
| result = 'FAIL: script ran twice'; |
| else if (i > 2) |
| result = 'FAIL: script ran ' + i + ' times'; |
| document.body.appendChild(document.createTextNode(result)); |
| |
| </script> |
| </body> |
| </html> |