Node-appendChild-three-scripts.tentative.html (804B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <title>Node.appendChild: inserting three scripts from a div</title> 4 <script src=/resources/testharness.js></script> 5 <script src=/resources/testharnessreport.js></script> 6 <body> 7 <script> 8 const s1 = document.createElement("script"); 9 const s2 = document.createElement("script"); 10 const s3 = document.createElement("script"); 11 const happened = []; 12 13 test(() => { 14 s1.textContent = ` 15 s3.appendChild(new Text("happened.push('s3');")); 16 happened.push("s1"); 17 `; 18 s2.textContent = ` 19 happened.push("s2"); 20 `; 21 const div = document.createElement("div"); 22 div.appendChild(s1); 23 div.appendChild(s2); 24 div.appendChild(s3); 25 26 assert_array_equals(happened, []); 27 document.body.appendChild(div); 28 assert_array_equals(happened, ["s3", "s1", "s2"]); 29 }); 30 </script>