Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add insertion tests for the new changes with the "deferred steps queue" #15264

Closed
wants to merge 16 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Test inserting a script and a default-style meta
nox authored and annevk committed Apr 2, 2020
commit 4c8ff54df3d42f8231806420fc5f05569cab5c42
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!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,%23div{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");
assert_equals(getComputedStyle(div).display, "none", "div is still visible after insertion");
done();
</script>