blob: 92a6d1def0252f8bf7f299bf40c870cf7646d3f0 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<script>
var i = 0;
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
</script>
</head>
<body>
<p>This test runs a script that clones and inserts its script element. The script should run exactly once and print PASS:</p>
<div><script src="resources/script-clone-rerun-src.js"></script></div>
<script>
var script = document.getElementsByTagName('script')[1];
var div = script.parentNode;
div.removeChild(script);
var clone = script.cloneNode(true);
clone.addEventListener("load", function() { document.body.appendChild(document.createTextNode("FAIL: load event fired on clone")); }, false);
div.appendChild(clone);
setTimeout(function() {
result = 'FAIL: script never ran';
if (i == 1)
result = 'PASS';
else if (i > 1)
result = 'FAIL: script ran ' + i + ' times';
document.body.appendChild(document.createTextNode(result));
if (window.testRunner)
testRunner.notifyDone();
}, 0);
</script>
</body>
</html>