<p>Tests for image elements firing their load events even when they're not in the document. Should say "onload fired" ten times, and then "PASS".</p> | |
<pre id="console"></pre> | |
<script src="../../resources/js-test-pre.js"></script> | |
<script> | |
if (window.testRunner) { | |
testRunner.dumpAsText(); | |
testRunner.waitUntilDone(); | |
} | |
function $(id) | |
{ | |
return document.getElementById(id); | |
} | |
function log(s) | |
{ | |
$("console").appendChild(document.createTextNode(s + "\n")); | |
} | |
var imageCount = 0; | |
function createImage() | |
{ | |
++imageCount; | |
var image = new Image; | |
image.src = "resources/apple.gif"; | |
image.onload = function () { | |
log("onload fired..."); | |
gc(); | |
--imageCount; | |
if (!imageCount) { | |
log("PASS"); | |
if (window.testRunner) | |
testRunner.notifyDone(); | |
} | |
}; | |
image = null; | |
} | |
for (var i = 0; i < 10; ++i) | |
createImage(); | |
</script> |