js-timers-beneath-modal-dialog.html   [plain text]


<p>JS timers should be paused while a modal dialog (or alert) is displayed.</p>
<p>Please disable popup blocker for this test.</p>
<div>0</div>
<script>
function f()
{
    var d = document.getElementsByTagName("div")[0];
    d.innerHTML = parseInt(d.innerHTML) + 1;
}

var timerId = setInterval(f, 100);

alert("Numbers in main window should not increase while this alert is displayed");
showModalDialog("data:text/html,<p>Numbers in main window should not increase while this modal dialog is displayed</p>");
document.getElementsByTagName("div")[0].innerHTML = "DONE";

clearInterval(timerId);

</script>