Skip to content

Commit 9c8d1ab

Browse files
committedFeb 19, 2019
Test inserting a script and a default-style meta
1 parent 54d4ba6 commit 9c8d1ab

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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,#div{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+
done();
38+
</script>

0 commit comments

Comments
 (0)
Please sign in to comment.