summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/dom/nodes/insertion-removing-steps/Node-append-form-and-script-from-fragment.tentative.html
blob: 10351d1645dda6aadf39cfb071f420ea5515870a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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>