2 <p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=38752">bug 38752</a>:
3 Images cannot be dynamically added to image documents.</p>
4 <p id=result>Onload was not called, which is not good. But is the square below green?</p>
5 <iframe src="resources/test-load.jpg" width=100 height=100 frameborder=0></iframe>
7 if (window.layoutTestController) {
8 layoutTestController.waitUntilDone();
9 layoutTestController.dumpAsText();
14 if (frames[0].document.getElementById("green").naturalWidth == 16)
15 document.getElementById("result").innerHTML = "PASS";
16 if (window.layoutTestController)
17 layoutTestController.notifyDone();
22 var d = frames[0].document;
23 var script = d.createElement("SCRIPT");
24 script.src = "data:text/plain," +
25 "var bg = document.createElement('DIV');" +
26 "bg.style.width = '100px';" +
27 "bg.style.height = '100px';" +
28 "bg.style.position = 'absolute';" +
30 "bg.style.left = 0;" +
31 "bg.style.background = 'red no-repeat';" +
32 "bg.style.overflow = 'visible';" +
33 "bg.style.zIndex = '1000000';" +
34 "document.body.appendChild(bg);" +
36 "var img = document.createElement('IMG');" +
38 "img.src = 'green.jpg';" +
39 "img.style.width = '100px';" +
40 "img.style.height = '100px';" +
41 "img.style.position = 'absolute';" +
42 "img.style.top = 0;" +
43 "img.style.left = 0;" +
44 "img.style.zIndex = '2000000';" +
45 "img.onload = function() { top.loaded() };" +
46 "document.body.appendChild(img);"
47 d.body.appendChild(script);