017.html (1584B)
1 <!DOCTYPE html> 2 <html><head> 3 <title> scheduler: multiple DOM added scripts later in document</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script src="testlib/testlib.js"></script> 7 </head> 8 <body> 9 10 <div id="log">FAILED (This TC requires JavaScript enabled)</div> 11 12 <script>log('inline script #1'); 13 testlib.addScript('log(\'body script #1\')', {}, document.getElementsByTagName('body')[0], false); 14 testlib.addScript('', { 'src':'scripts/include-1.js' }, document.getElementsByTagName('body')[0], false); 15 testlib.addScript('log(\'body script #2\')', {}, document.getElementsByTagName('body')[0], false); 16 log('end script #1'); 17 </script> 18 19 <script type="text/javascript"> 20 log( 'inline script #2' ); 21 var t = async_test() 22 23 //The order of the external script vs the second inline script is undefined because the added script is async by default 24 //But we expect most UAs to have the second order 25 onload = function() {setTimeout(t.step_func(function() { 26 assert_any(assert_array_equals, eventOrder, [ 27 ['inline script #1', 'body script #1', 'body script #2', 'end script #1', 'external script #1', 'inline script #2'], 28 ['inline script #1', 'body script #1', 'body script #2', 'end script #1', 'inline script #2', 'external script #1']]); 29 t.done(); 30 }), 100);} 31 </script> 32 33 </body></html>