[Release] Webkit-EFL Ver. 2.0_beta_118996_0.6.22
[framework/web/webkit-efl.git] / LayoutTests / fast / images / extra-image-in-image-document.html
1 <body onload="test()">
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>
6 <script>
7 if (window.layoutTestController) {
8     layoutTestController.waitUntilDone();
9     layoutTestController.dumpAsText();
10 }
11
12 function loaded()
13 {
14     if (frames[0].document.getElementById("green").naturalWidth == 16)
15         document.getElementById("result").innerHTML = "PASS";
16     if (window.layoutTestController)
17         layoutTestController.notifyDone();
18 }
19
20 function test()
21 {
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';" + 
29         "bg.style.top = 0;" + 
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);" +
35
36         "var img = document.createElement('IMG');" +
37         "img.id = 'green';" +
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);
48 }
49
50 </script>
51 </body>