blob: cac5e7e30b5b00fce5335621f57eb5293c8f5fb6 [file] [log] [blame]
<?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 test runs a script that clones and inserts its script element. The script should run exactly once and print PASS:</text>
<defs>
<script type="text/javascript">
i++;
var script = document.getElementsByTagName('script')[1];
var defs = script.parentNode;
defs.removeChild(script);
defs.appendChild(script.cloneNode(true));
</script></defs>
<defs><script>
if (window.testRunner)
testRunner.dumpAsText();
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>