Node-append-form-and-script-from-fragment.tentative.html (918B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <title>Node.appendChild: inserting script and associated form</title> 4 <script src=/resources/testharness.js></script> 5 <script src=/resources/testharnessreport.js></script> 6 <button id="someButton" form="someForm"></button> 7 <script> 8 test(() => { 9 const script = document.createElement("script"); 10 const form = document.createElement("form"); 11 form.id = "someForm"; 12 const fragment = new DocumentFragment(); 13 script.textContent = ` 14 window.buttonAssociatedForm = document.querySelector("#someButton").form; 15 `; 16 fragment.append(script, form); 17 document.body.append(fragment); 18 assert_equals(window.buttonAssociatedForm, form); 19 }, "When adding a script+form in a fragment and the form matches an associated element, " + 20 "the script that checks whether the button is associated to the form should run after " + 21 "inserting the form"); 22 </script>