Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /dom/nodes/insertion-removing-steps/Node-append-form-and-script-from-fragment.tentative.html - WPT Dashboard Interop Dashboard
<!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>