<!DOCTYPE html>
<title>Test that when images are moved to a new document, a new load fires.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<body>
<script type="text/javascript">
if (window.testRunner)
testRunner.setPluginsEnabled(false);
for (var elementType of [ "img", "input", "object", "embed" ]) {
async_test(function(t) {
var subframe = document.createElement("iframe");
document.body.appendChild(subframe);
var subdocument = subframe.contentDocument;
var element = document.createElement(elementType);
if (elementType == "input")
element.type = "image";
element.data = "resources/test-load.jpg";
element.src = "resources/test-load.jpg";
document.body.appendChild(element);
element.onload = t.step_func(function() {
document.body.removeChild(element);
subdocument.body.appendChild(element);
element.onload = t.step_func_done(function() {
subdocument.body.removeChild(element);
});
});
}, document.title + ', ' + elementType);
}
</script>