equal
deleted
inserted
replaced
|
1 <p>This test ensures that document.write after page load is synchronous.</p> |
|
2 <p>You will get a PASS or FAIL alert message after a few seconds.</p> |
|
3 <script> |
|
4 window.onload = function() { |
|
5 |
|
6 // Build a very long string to write. |
|
7 var LIMIT = 17; |
|
8 var str = '<p style="display:none">x</p>'; |
|
9 for (var i=0; i<LIMIT; ++i) |
|
10 str += str; |
|
11 |
|
12 // Write the string and check the DOM immediately and after a small delay. |
|
13 var doc = document.implementation.createHTMLDocument(); |
|
14 doc.write(str); |
|
15 var immediateElementCount = doc.getElementsByTagName('*').length; |
|
16 setTimeout(function() { |
|
17 var delayedElementCount = doc.getElementsByTagName('*').length; |
|
18 var passOrFail = (immediateElementCount === delayedElementCount ? "PASS" : "FAIL"); |
|
19 alert(passOrFail); |
|
20 }, 100); |
|
21 |
|
22 } |
|
23 </script> |