Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/scripting-1/the-script-element/execution-timing/101.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html><head>
<title> scheduler: defer script after initial onload event</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="testlib/testlib.js"></script>
</head>
<body>
<div id="log">FAILED (This TC requires JavaScript enabled)</div>
<iframe id="myFrame"></iframe>
<script>
var t = async_test();
onload = t.step_func(
function() {
var doc = document.getElementById("myFrame").contentDocument;
var win = document.getElementById("myFrame").contentWindow;
doc.open();
doc.write("<title> scheduler: defer script after initial onload event</title><script src='testlib/testlib.js'><\/script><div id='log'>document.written content</div><script>log('inline script #1');<\/script><script src='scripts/include-1.js'><\/script><script defer src='scripts/include-2.js'><\/script>");
doc.close();
//Note that the *window* object has changed but the *global scope* of the script has not.
var run_t = window.t.step_func(function() {
if (!win.eventOrder || win.eventOrder.length != 3) {
window.setTimeout(run_t, 100);
return;
}
window.assert_array_equals(win.eventOrder, ['inline script #1', 'external script #1', 'external script #2']);
window.t.done();
});
run_t();
});
</script>
</body>
</html>