Skip to content

Commit 005ed5e

Browse files
noxannevk
authored andcommitted
Test inserting a script and a default-style meta
1 parent 074d3e8 commit 005ed5e

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<!doctype html>
2+
<meta charset=utf-8>
3+
<title>Node.appendChild: inserting script and default-style meta from a fragment</title>
4+
<link rel=help href="https://dom.spec.whatwg.org/#dom-node-appendChild">
5+
<link rel=help href="https://dom.spec.whatwg.org/#concept-node-insert">
6+
<link rel=help href="https://github.com/whatwg/dom/issues/575">
7+
<script src=/resources/testharness.js></script>
8+
<script src=/resources/testharnessreport.js></script>
9+
<link rel="stylesheet" href="data:text/css,">
10+
<link rel="alternate stylesheet" title="alternative" href="data:text/css,%23div{display:none}">
11+
</head>
12+
<body>
13+
<div id="log"></div>
14+
<div id="div">hello</div>
15+
<script>
16+
var div = document.getElementById("div");
17+
18+
var meta = document.createElement("meta");
19+
meta.httpEquiv = "default-style";
20+
meta.content = "alternative";
21+
22+
var script = document.createElement("script");
23+
var scriptRan = false;
24+
script.textContent = `
25+
assert_equals(getComputedStyle(div).display, "none", "div is still visible");
26+
scriptRan = true;
27+
`;
28+
29+
var df = document.createDocumentFragment();
30+
df.appendChild(script);
31+
df.appendChild(meta);
32+
33+
assert_equals(getComputedStyle(div).display, "block", "div is not a block");
34+
assert_false(scriptRan, "script ran");
35+
document.head.appendChild(df);
36+
assert_true(scriptRan, "script has not run");
37+
assert_equals(getComputedStyle(div).display, "none", "div is still visible after insertion");
38+
done();
39+
</script>

0 commit comments

Comments
 (0)