-
Notifications
You must be signed in to change notification settings - Fork 3k
Improve option insertion and removal algorithms #11790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This PR improves the option element insertion and removal steps to incorporate invalid nestings of option elements inside select elements by reusing the nearest ancestor select algorithm. It also adds datalist to the list of disallowed elements for nesting options in. Fixes whatwg#11787
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this works and avoids a lot of the complexity I was envisioning we'd need. Nice!
We also need to account for this where we look for whether |
Here's a proposed patch: index 0cecdf224b1a..89d5b874704b 100644
--- a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-select-element/customizable-select/nested-options.tenative.html
+++ b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-select-element/customizable-select/nested-options.tenative.html
@@ -33,6 +33,7 @@ test(() => {
// Manually nest the <options> anyway for the following tests.
o1.appendChild(o2);
+document.querySelector('select').appendChild(o1);
test(() => {
assert_equals(select.options.length, 1, 'select.options.length'); |
Another comment: the moving steps can now call this update algorithm directly. The way this is currently written it'd run a lot of redundant code. |
Thanks, I am incorporating this into the chromium patch in the PR description.
Thanks, I accounted for this and added a test to the WPT changes
done |
This PR improves the option element insertion and removal steps to incorporate invalid nestings of option elements inside select elements by reusing the nearest ancestor select algorithm. It also adds datalist to the list of disallowed elements for nesting options in.
Fixes #11787
(See WHATWG Working Mode: Changes for more details.)
/form-elements.html ( diff )