147.html (1378B)
1 <!DOCTYPE html> 2 <html><head> 3 <title>scheduler: insert multiple inline scripts; first script moves subsequent scripts </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 <div id="log"></div> 10 <script> 11 var t = async_test(); 12 </script> 13 <div id="container"></div> 14 <script> 15 t.step(function() { 16 log("inline script #1"); 17 var container = document.getElementById("container"); 18 19 var frag = document.createDocumentFragment(); 20 var frag_script_1 = document.createElement("script"); 21 var frag_script_2 = document.createElement("script"); 22 frag_script_2.id = "movee"; 23 var frag_script_3 = document.createElement("script"); 24 25 frag_script_1.textContent = "t.step(function() {log('inline script #2'); var s = document.getElementById('movee'); s.parentNode.appendChild(s)});"; 26 frag_script_2.textContent = "t.step(function() {log('inline script #3');})"; 27 frag_script_3.textContent = "t.step(function() {log('inline script #4');})"; 28 29 [frag_script_1, frag_script_2, frag_script_3].forEach(function(x) {frag.appendChild(x)}); 30 31 container.appendChild(frag); 32 }); 33 34 onload = t.step_func(function() { 35 assert_array_equals(eventOrder, ["inline script #1", "inline script #2", "inline script #3", "inline script #4"]); 36 t.done(); 37 }); 38 </script> 39 </body> 40 </html>