2009-11-27 Daniel Bates <dbates@webkit.org>
[webkit:qtwebkit.git] / LayoutTests / http / tests / local / style-access-before-stylesheet-loaded.html
1 <html>
2 <head>
3 <script>  
4 if (window.layoutTestController)
5     layoutTestController.dumpAsText();
6             
7 function test() {
8     var start = new Date().getTime();
9     var e = document.getElementById('t');
10     var console = document.getElementById('console');
11     for (n = 0; n < 1000; n++)
12         e.offsetLeft;
13     var time = new Date().getTime() - start;
14     console.innerHTML = ((time < 500) ? "<span style='color:green'>PASS</span> " :  "<span style='color:red'>FAIL</span> ");// + time;
15
16     if (window.layoutTestController)
17         layoutTestController.notifyDone();
18 }
19 </script>
20
21 <link rel=stylesheet href="http://127.0.0.1:8000/local/slow-css-pass.cgi">
22
23 </head>
24 <body>
25 This page has a slow loading external style sheet. Calling offsetLeft shouldn't be slow when stylesheets are loading. 
26 Works as HTTP test only.
27 <div id=console></div>
28 <div id=t></div>
29 <script>
30 if (window.layoutTestController)
31     layoutTestController.waitUntilDone();
32 // increase document complexity a bit
33 for (n = 0; n < 500; n++)
34     document.write("<div><span></span><div><span></span></div></div>");
35 setTimeout(test, 0);
36 </script>
37 </body>
38 </html>