| <?xml version="1.0"?> |
| <svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xhtml="http://www.w3.org/1999/xhtml"> |
| <defs> |
| <script> |
| var i = 0; |
| </script> |
| </defs> |
| <text x="15" y="30" font-size="15">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:</text> |
| <defs><script> i++; </script></defs> |
| <defs> |
| <script type="text/javascript"> |
| |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| |
| var script = document.getElementsByTagName('script')[1]; |
| var defs = script.parentNode; |
| defs.removeChild(script); |
| defs.appendChild(script.cloneNode(true)); |
| |
| result = 'PASS'; |
| if (i == 2) |
| result = 'FAIL: script ran twice'; |
| else if (i > 2) |
| result = 'FAIL: script ran ' + i + ' times'; |
| |
| var textElement = document.createElementNS("http://www.w3.org/2000/svg", "text"); |
| textElement.textContent = result; |
| textElement.setAttribute('x', 15); |
| textElement.setAttribute('y', 45+10); |
| textElement.setAttribute('font-size', 15); |
| document.getElementsByTagName('svg')[0].appendChild(textElement); |
| |
| </script> |
| </defs> |
| </svg> |