non-external-no-import.html (753B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>Module scripts with no imports always execute asynchronously</title> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <link rel="help" href="https://github.com/whatwg/html/issues/3746"> 8 </head> 9 <body> 10 <script> 11 async_test(t => { 12 window.results = []; 13 window.logExecution = msg => window.results.push(msg); 14 15 const script = document.createElement('script'); 16 script.type = 'module'; 17 script.textContent = "window.logExecution('module')"; 18 document.body.append(script); 19 window.logExecution('classic'); 20 21 window.onload = t.step_func_done(e => { 22 assert_array_equals(window.results, ['classic', 'module']); 23 }); 24 }); 25 </script> 26 </body> 27 </html>