-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test inserting a script and a default-style meta
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
dom/nodes/Node-appendChild-script-and-default-style-meta-from-fragment.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title>Node.appendChild: inserting script and default-style meta from a fragment</title> | ||
<link rel=help href="https://dom.spec.whatwg.org/#dom-node-appendChild"> | ||
<link rel=help href="https://dom.spec.whatwg.org/#concept-node-insert"> | ||
<link rel=help href="https://github.com/whatwg/dom/issues/575"> | ||
<script src=/resources/testharness.js></script> | ||
<script src=/resources/testharnessreport.js></script> | ||
<link rel="stylesheet" href="data:text/css,"> | ||
<link rel="alternate stylesheet" title="alternative" href="data:text/css,#div{display:none}"> | ||
</head> | ||
<body> | ||
<div id="log"></div> | ||
<div id="div">hello</div> | ||
<script> | ||
var div = document.getElementById("div"); | ||
|
||
var meta = document.createElement("meta"); | ||
meta.httpEquiv = "default-style"; | ||
meta.content = "alternative"; | ||
|
||
var script = document.createElement("script"); | ||
var scriptRan = false; | ||
script.textContent = ` | ||
assert_equals(getComputedStyle(div).display, "none", "div is still visible"); | ||
scriptRan = true; | ||
`; | ||
|
||
var df = document.createDocumentFragment(); | ||
df.appendChild(script); | ||
df.appendChild(meta); | ||
|
||
assert_equals(getComputedStyle(div).display, "block", "div is not a block"); | ||
assert_false(scriptRan, "script ran"); | ||
document.head.appendChild(df); | ||
assert_true(scriptRan, "script has not run"); | ||
done(); | ||
</script> |