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 a few missing post-insertion-step tests #44906

Merged
merged 4 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!doctype html>
<meta charset=utf-8>
<title>Node.appendChild: inserting script and associated form</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<button id="someButton" form="someForm"></button>
<script>
test(() => {
const script = document.createElement("script");
const form = document.createElement("form");
form.id = "someForm";
const fragment = new DocumentFragment();
script.textContent = `
window.buttonAssociatedForm = document.querySelector("#someButton").form;
`;
fragment.append(script, form);
document.body.append(fragment);
assert_equals(window.buttonAssociatedForm, form);
}, "When adding a script+form in a fragment and the form matches an associated element, " +
"the script that checks whether the button is associated to the form should run after " +
"inserting the form");
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!doctype html>
<meta charset=utf-8>
<title>Node.appendChild: inserting script and meta-referrer from a div</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
promise_test(async t => {
const script = document.createElement("script");
const meta = document.createElement("meta");
meta.name = "referrer";
meta.content = "no-referrer";
const fragment = new DocumentFragment();
const done = new Promise(resolve => {
window.didFetch = resolve;
});
script.textContent = `
(async function() {
const response = await fetch("/html/infrastructure/urls/terminology-0/resources/echo-referrer-text.py")
const text = await response.text();
window.didFetch(text);
})();
`;
fragment.append(script, meta);
document.head.append(fragment);
const result = await done;
assert_equals(result, "");
}, "<meta name=referrer> should apply before script, as it is an insertion step " +
"and not a post-insertion step");
</script>