Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /inert/inert-form-control.html - WPT Dashboard Interop Dashboard
<!doctype html>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<title>Inert doesn't prevent initiated click from changing form control</title>
<style>
label {
display: block
}
</style>
<div id="ancestor">
<label>
<input type=radio name=foo value=1 checked> Something
</label>
<label id="target">
<input type=radio name=foo value=2> Something else
</label>
</div>
<script>
let targetInput = target.querySelector("input");
ancestor.addEventListener("click", () => {
ancestor.inert = true;
});
promise_test(async function () {
assert_false(targetInput.checked, "input shouldn't be checked");
await test_driver.click(target);
assert_true(ancestor.inert, "click handler should've ran");
assert_true(targetInput.checked, "input should become checked");
});
</script>