[Release] Webkit-EFL Ver. 2.0_beta_118996_0.6.22
[framework/web/webkit-efl.git] / LayoutTests / fast / images / image-load-event-in-fragment.html
1 <body onload="test()">
2 <p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=31660">bug 31660</a>:
3 Image load event fires before the document fragment is attached.</p>
4 <div id=result>FAIL - script did not run</div>
5 <div id=target></div>
6 <!-- Preload an image, possibly making second load synchronous -->
7 <img src="resources/boston.gif" style="visibility:hidden">
8 <script>
9 if (window.layoutTestController) {
10     layoutTestController.waitUntilDone();
11     layoutTestController.dumpAsText();
12 }
13 function test()
14 {
15     // Parsing a fragment immediately triggers image load. This is true in WebKit and Firefox even
16     // if a fragment created with Range.createContextualFragment() does not get attached.
17     var r = document.createRange();
18     r.setStartAfter(document.body);
19     r.setEndAfter(document.body);
20     var frag = r.createContextualFragment('<img style="visibility:hidden" src="resources/boston.gif" onload="loaded()" id="new">');
21     
22     document.getElementById("target").appendChild(frag);
23 }
24 function loaded()
25 {
26     // There is code on the Web expecting that an image is in the document by the time its load event fires.
27     document.getElementById("result").innerHTML = (document.getElementById("new")) ? "PASS" : "FAIL";
28     if (window.layoutTestController)
29         layoutTestController.notifyDone();
30 }
31 </script>
32 </body>