commit b6347c513a8cfcf77d9f41f8d6c248689077c00f
parent 7ecf0e623c2536e58e9509aa187d023a39c7f655
Author: Joey Arhar <jarhar@chromium.org>
Date: Thu, 9 Oct 2025 20:35:28 +0000
Bug 1992315 [wpt PR 55198] - Add WPT for option.form with ancestor select, a=testonly
Automatic update from web-platform-tests
Add WPT for option.form with ancestor select
This covers the spec change here:
https://github.com/whatwg/html/issues/11708
Change-Id: Iac6ee2e667b796214e15561665dfc0294c72ae9a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6994604
Reviewed-by: David Baron <dbaron@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1524334}
--
wpt-commits: 23fa89d564a9db0c32820a1bd6a6aeeddac52357
wpt-pr: 55198
Diffstat:
1 file changed, 33 insertions(+), 0 deletions(-)
diff --git a/testing/web-platform/tests/html/semantics/forms/the-select-element/customizable-select/option-form-ancestor-select.html b/testing/web-platform/tests/html/semantics/forms/the-select-element/customizable-select/option-form-ancestor-select.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<link rel=author href="mailto:jarhar@chromium.org">
+<link rel=help href="https://html.spec.whatwg.org/multipage/form-elements.html#dom-option-form">
+<link rel=help href="https://github.com/whatwg/html/issues/11708">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<form id=form>
+ <select id=select1></select>
+</form>
+
+<select id=select2 form=form></select>
+
+<script>
+const form = document.getElementById('form');
+const select1 = document.getElementById('select1');
+const select2 = document.getElementById('select2');
+
+test(() => {
+ const div1 = document.createElement('div');
+ select1.appendChild(div1);
+ const option1 = document.createElement('option');
+ div1.appendChild(option1);
+
+ const div2 = document.createElement('div');
+ select2.appendChild(div2);
+ const option2 = document.createElement('option');
+ div2.appendChild(option2);
+
+ assert_equals(option1.form, form, 'option1');
+ assert_equals(option2.form, form, 'option2');
+}, 'option.form should look up the ancestor chain for a select element to get its form from.');
+</script>