Repository navigation
Conversation
Member
Author
|
@josepharhar @jnjaeschke I noticed a couple more cases. Once some of my WebKit work lands I'll upload tests for this as well. |
This is a follow-up to #12263 that addresses the remaining cases where selectedcontent elements were updated too little or too much: * Inserting an option element that causes another option element to become selected now updates selectedcontent elements. This happens when the select element has no selected option, e.g., after setting selectedIndex to -1. * Inserting a select element that already contains option elements now updates its selectedcontent elements once, rather than again from the post-connection steps of its selected option element. * The microtasks queued to update selectedcontent elements after option elements are removed or moved are now coalesced per select element, and do nothing if the selectedcontent elements were updated in the meantime. The same goes for moving a selectedcontent element. * The microtask queued by the selectedcontent moving steps now determines the select element when it runs, rather than when it is queued. * Moving a selectedcontent element no longer updates it when its select element and disabledness do not change, e.g., when an ancestor of the select element is moved. * Removing a selectedcontent element now recalculates its disabledness. * Setting the selected IDL attribute of an option element only updates selectedcontent elements when selectedness changes. This also removes "ask for a reset" and "update descendant selectedcontent elements for an option", which would otherwise each have a single caller. Tests: TBD.
annevk
force-pushed
the
annevk/selectedcontent-follow-ups
branch
from
September 30, 2026 14:06
d201e93 to
2fcaa59
Compare
annevk
marked this pull request as ready for review
October 1, 2026 05:24
annevk
added a commit
to annevk/WebKit
that referenced
this pull request
Oct 2, 2026
https://bugs.webkit.org/show_bug.cgi?id=325898 Reviewed by NOBODY (OOPS!). Align with whatwg/html#13005 Inserting, removing, or moving an <option> now updates <selectedcontent> when that causes another option to become selected, which happens when the <select> has no selected option. Inserting an <option> only updates <selectedcontent> when it changes the selected option. To detect this, <select> remembers which option it last cloned into its <selectedcontent> elements. Inserting multiple options together thus updates <selectedcontent> once. An <option> whose <select> does not change, as when inserting a <select> that already contains options, leaves updating to the <selectedcontent> itself. The microtasks that update <selectedcontent> after removing or moving an <option>, or moving a <selectedcontent>, are now coalesced and do nothing if the <selectedcontent> was updated in the meantime. A moved <selectedcontent> now finds its <select> when the queued microtask runs, and is not updated at all when it stays enabled in the same <select>, for instance when an ancestor of the <select> is moved. Removing a <selectedcontent> now recalculates whether it is disabled. Test: imported/w3c/web-platform-tests/html/semantics/forms/the-select-element/customizable-select/selectedcontent-queued-update.html Tests upstream: web-platform-tests/wpt#63153
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a follow-up to #12263 that addresses the remaining cases where selectedcontent elements were updated too little or too much:
This also removes "ask for a reset" and "update descendant selectedcontent elements for an option", which would otherwise each have a single caller.
Tests: web-platform-tests/wpt#63153
(See WHATWG Working Mode: Changes for more details.)
/form-elements.html ( diff )