summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/dom/nodes/insertion-removing-steps/Node-appendChild-three-scripts.tentative.html
blob: 6ffa35515e765b0a34f4a7656bd2ea55badf44aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<!doctype html>
<meta charset=utf-8>
<title>Node.appendChild: inserting three scripts from a div</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<body>
  <script>
const s1 = document.createElement("script");
const s2 = document.createElement("script");
const s3 = document.createElement("script");
const happened = [];

test(() => {
  s1.textContent = `
    s3.appendChild(new Text("happened.push('s3');"));
    happened.push("s1");
  `;
  s2.textContent = `
    happened.push("s2");
  `;
  const div = document.createElement("div");
  div.appendChild(s1);
  div.appendChild(s2);
  div.appendChild(s3);

  assert_array_equals(happened, []);
  document.body.appendChild(div);
  assert_array_equals(happened, ["s3", "s1", "s2"]);
});
</script>