blob: f62fd68c1c2a1602b47254e481e2b0bc7efd1d9c [file] [log] [blame]
<p>This test ensures that document.write after page load is synchronous.</p>
<p>You will get a PASS or FAIL alert message after a few seconds.</p>
<script>
window.onload = function() {
// Build a very long string to write.
var LIMIT = 17;
var str = '<p style="display:none">x</p>';
for (var i=0; i<LIMIT; ++i)
str += str;
// Write the string and check the DOM immediately and after a small delay.
var doc = document.implementation.createHTMLDocument();
doc.write(str);
var immediateElementCount = doc.getElementsByTagName('*').length;
setTimeout(function() {
var delayedElementCount = doc.getElementsByTagName('*').length;
var passOrFail = (immediateElementCount === delayedElementCount ? "PASS" : "FAIL");
alert(passOrFail);
}, 100);
}
</script>