Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / script-clone-rerun.html
blob66f26dff5a60ca2075a2e13ca99b34fc5a0b0c2f
1 <!DOCTYPE>
2 <html>
3 <head>
4 <script>
5 var i = 0;
6 </script>
7 </head>
8 <body>
9 <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>
10 <div><script> i++ </script></div>
11 <script>
13 if (window.testRunner)
14 testRunner.dumpAsText();
16 var script = document.getElementsByTagName('script')[1];
17 var div = script.parentNode;
18 div.removeChild(script);
19 div.appendChild(script.cloneNode(true));
21 result = 'PASS';
22 if (i == 2)
23 result = 'FAIL: script ran twice';
24 else if (i > 2)
25 result = 'FAIL: script ran ' + i + ' times';
26 document.body.appendChild(document.createTextNode(result));
28 </script>
29 </body>
30 </html>