-
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.
rewrite first four files to work again
- Loading branch information
Showing
4 changed files
with
72 additions
and
88 deletions.
There are no files selected for viewing
37 changes: 15 additions & 22 deletions
37
dom/nodes/Node-appendChild-script-and-button-from-div.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 |
---|---|---|
@@ -1,34 +1,27 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title>Node.appendChild: inserting script and button from a div</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> | ||
<div id="log"></div> | ||
</head> | ||
<body> | ||
<form id="form"></form> | ||
<script> | ||
var form = document.getElementById("form"); | ||
|
||
var script = document.createElement("script"); | ||
var scriptRan = false; | ||
script.textContent = ` | ||
assert_equals(button.form, form, "button does not have a form owner"); | ||
scriptRan = true; | ||
let button = null; | ||
let buttonForm = null; | ||
test(() => { | ||
const form = document.getElementById("form"); | ||
const script = document.createElement("script"); | ||
script.textContent = ` | ||
buttonForm = button.form; | ||
`; | ||
|
||
var button = document.createElement("button"); | ||
|
||
var div = document.createElement("div"); | ||
div.appendChild(script); | ||
div.appendChild(button); | ||
|
||
|
||
assert_false(scriptRan, "script ran"); | ||
form.appendChild(div); | ||
assert_true(scriptRan, "script has not run"); | ||
done(); | ||
button = document.createElement("button"); | ||
const div = document.createElement("div"); | ||
div.appendChild(script); | ||
div.appendChild(button); | ||
assert_equals(buttonForm, null); | ||
form.appendChild(div); | ||
assert_equals(buttonForm, form); | ||
}); | ||
</script> |
40 changes: 18 additions & 22 deletions
40
dom/nodes/Node-appendChild-script-and-custom-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 |
---|---|---|
@@ -1,36 +1,32 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title>Node.appendChild: inserting script and custom element from a DocumentFragment</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> | ||
<div id="log"></div> | ||
<script> | ||
var script = document.createElement("script"); | ||
var scriptRan = false; | ||
script.textContent = ` | ||
customElements.define("custom-element", CustomElement); | ||
assert_true(customConstructed, "custom element was not constructed"); | ||
scriptRan = true; | ||
`; | ||
|
||
var custom = document.createElement("custom-element"); | ||
var customConstructed = false; | ||
let customConstructed = false; | ||
let isCustomConstructed = false; | ||
class CustomElement extends HTMLElement { | ||
constructor() { | ||
super(); | ||
customConstructed = true; | ||
} | ||
} | ||
|
||
var df = document.createDocumentFragment(); | ||
df.appendChild(script); | ||
df.appendChild(custom); | ||
|
||
assert_false(scriptRan, "script ran"); | ||
document.head.appendChild(df); | ||
assert_true(scriptRan, "script has not run"); | ||
done(); | ||
test(() => { | ||
const script = document.createElement("script"); | ||
script.textContent = ` | ||
customElements.define("custom-element", CustomElement); | ||
isCustomConstructed = customConstructed; | ||
`; | ||
const custom = document.createElement("custom-element"); | ||
const df = document.createDocumentFragment(); | ||
df.appendChild(script); | ||
df.appendChild(custom); | ||
assert_false(customConstructed); | ||
assert_false(isCustomConstructed); | ||
document.head.appendChild(df); | ||
assert_true(customConstructed); | ||
assert_true(isCustomConstructed); | ||
}); | ||
</script> |
45 changes: 20 additions & 25 deletions
45
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 |
---|---|---|
@@ -1,39 +1,34 @@ | ||
<!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"); | ||
let scriptRan = false; | ||
let computedStyle = null; | ||
test(() => { | ||
const div = document.getElementById("div"); | ||
const meta = document.createElement("meta"); | ||
meta.httpEquiv = "default-style"; | ||
meta.content = "alternative"; | ||
const script = document.createElement("script"); | ||
script.textContent = ` | ||
computedStyle = getComputedStyle(div).display; | ||
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(); | ||
const 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(computedStyle, "none", "div is still visible"); | ||
assert_equals(getComputedStyle(div).display, "none", "div is still visible after insertion"); | ||
}); | ||
</script> |
38 changes: 19 additions & 19 deletions
38
dom/nodes/Node-appendChild-script-and-div-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 |
---|---|---|
@@ -1,28 +1,28 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title>Node.appendChild: inserting script and div from a DocumentFragment</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> | ||
<div id="log"></div> | ||
<script> | ||
var script = document.createElement("script"); | ||
var div = document.createElement("div"); | ||
|
||
var scriptRan = false; | ||
script.textContent = ` | ||
assert_equals(div.parentNode, script.parentNode, "div does not have same parent as script"); | ||
scriptRan = true; | ||
let script = null; | ||
let scriptParent = null; | ||
let div = null; | ||
let divParent = null; | ||
test(() => { | ||
script = document.createElement("script"); | ||
div = document.createElement("div"); | ||
script.textContent = ` | ||
divParent = div.parentNode; | ||
scriptParent = script.parentNode; | ||
`; | ||
|
||
var df = document.createDocumentFragment(); | ||
df.appendChild(script); | ||
df.appendChild(div); | ||
|
||
assert_false(scriptRan, "script ran"); | ||
document.head.appendChild(df); | ||
assert_true(scriptRan, "script did not run"); | ||
done(); | ||
const df = document.createDocumentFragment(); | ||
df.appendChild(script); | ||
df.appendChild(div); | ||
assert_equals(divParent, null); | ||
assert_equals(scriptParent, null); | ||
document.head.appendChild(df); | ||
assert_equals(divParent, scriptParent); | ||
assert_equals(divParent, document.head); | ||
}); | ||
</script> |