summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/dom/nodes/insertion-removing-steps/Node-appendChild-three-scripts-from-fragment.tentative.html
blob: a7b7405b64b794dc6981d2ce7977d7c27e7deb74 (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 document fragment</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 df = document.createDocumentFragment();
  df.appendChild(s1);
  df.appendChild(s2);
  df.appendChild(s3);

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