create-module-script.html (778B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <title>Insert non-async module script</title> 4 <script src=/resources/testharness.js></script> 5 <script src=/resources/testharnessreport.js></script> 6 <script> 7 var test = async_test("Create module script") 8 var moduleRan = false; 9 function loadModule() { 10 var script = document.createElement("script"); 11 script.onerror = function() { 12 test.step(() => assert_unreached("Should not get an error")); 13 test.done(); 14 }; 15 script.onload = function() { 16 test.step(() => assert_equals(moduleRan, true)); 17 test.done(); 18 }; 19 script.type = "module"; 20 script.src = "support/module.js"; 21 script.async = false; 22 document.documentElement.appendChild(script); 23 } 24 </script> 25 <body onload='loadModule()'></body>