From 1d64dc111a2d46cbc3cf5bff679438056b4a76f9 Mon Sep 17 00:00:00 2001
From: Joey Arhar Let passedFirstSelectedcontent be false. Let selectedcontentElements be « ». For each descendant of select's descendants in tree order that is a
@@ -59136,8 +59138,16 @@ interface HTMLSelectedContentElement : HTMLElement If passedFirstSelectedcontent is false, then set
passedFirstSelectedcontent to true. Otherwise, run clear a Otherwise, append descendant to
+ selectedcontentElements. For each selectedcontent of selectedcontentElements: Clear a selectedcontent given
- descendant.
+
selectedcontent given descendant.
If element's multiple attribute is
- absent, and element's display size is 1,
- and no option elements in the element's list of options have their selectedness set to true, then set the selectedness of the first option
- element in the list of options in
- tree order that is not disabled,
- if any, to true, and return.
If element's multiple attribute is
- absent, and two or more option elements in element's list of options have their selectedness set to true, then set the selectedness of all but the last option
- element with its selectedness set to true in
- the list of options in tree order
- to false.
Let updateSelectedcontent be false.
If element's multiple attribute is
+ absent, and element's display size is 1,
+ and no option elements in the element's list of options have their selectedness set to true, then:
Set the selectedness of the first option
+ element in the list of options in
+ tree order that is not disabled,
+ if any, to true.
Set updateSelectedcontent to true.
Otherwise, if element's multiple
+ attribute is absent, and two or more option elements in element's list of options have their selectedness set to true, then:
Set the selectedness of all but the
+ last option element with its selectedness set to true in the list of options in tree order to
+ false.
Set updateSelectedcontent to true.
If updateSelectedcontent is true, then run update a select's
+ selectedcontent given element.
If passedFirstSelectedcontent is false, then set passedFirstSelectedcontent to true.
-Otherwise,
append descendant to +
Otherwise, append descendant to selectedcontentElements.
For each selectedcontent of selectedcontentElements:
- -Clear a selectedcontent given descendant.
For each selectedcontent of selectedcontentElements, clear a
+ selectedcontent given descendant.
Let passedFirstSelectedcontent be false.
Let selectedcontentElements be « ».
Let elements be « ».
For each descendant of select's HTMLSelectedContentElement : HTMLElementpassedFirstSelectedcontent to true.
Otherwise, append descendant to - selectedcontentElements.
For each selectedcontent of selectedcontentElements, clear a
- selectedcontent given descendant.
For each element of elements, clear a
+ selectedcontent given element.
If element's multiple attribute is
- absent, and two or more option elements in element's list of options have their selectedness set to true, then set the selectedness of all but the last option
- element with its selectedness set to true in
- the list of options in tree order
- to false.
If element's multiple attribute is
+ absent:
Let lastSelectedOption be null.
For each option in element's list of options in reverse order:
+ +If option's selectedness + is true:
+ +If option's cached nearest ancestor select
+ element is null, then continue.
If lastSelectedOption is null, then set lastSelectedOption to + option and continue.
Set option's selectedness to false.
If element's multiple attribute is
- absent, and element's display size is 1,
+ absent, element's display size is 1,
and no option elements in the element's list of options have their selectedness set to true, then:
Set the HTMLSelectElement : HTMLElement {
Otherwise, if element's multiple
- attribute is absent, and two or more option elements in element's option elements in element's list of options have their selectedness set to true, then:
Set the selectedness of all but the
From af049b78ccd8055de18608c28c54376ee9931712 Mon Sep 17 00:00:00 2001
From: Joey Arhar
If element's multiple attribute is
- absent:
If element has the multiple attribute,
+ then return.
Let lastSelectedOption be null.
Let lastSeen be false.
For each option in element's list of options in reverse order:
+For each option in element's list of options in reverse order:
+If option's selectedness + is true:
If option's selectedness - is true:
+If option's cached nearest ancestor select
+ element is null, then continue.
If option's cached nearest ancestor select
- element is null, then continue.
If lastSelectedOption is null, then set lastSelectedOption to - option and continue.
If lastSeen is false, then set lastSeen to true and + continue.
Set option's selectedness to false.
Set option's selectedness to false.
Let passedFirstSelectedcontent be false.
Let seenFirst be false.
Let elements be « ».
If passedFirstSelectedcontent is false, then set - passedFirstSelectedcontent to true.
If seenFirst is false, then set seenFirst to true.
Otherwise, append descendant to elements.
If updateSelectedcontent is true, then run update a select's
- selectedcontent given element.
selectedcontent elementsUpdate a select's selectedcontent given
- select.
Update a select's descendant selectedcontent
+ elements given select.
Run update a select's selectedcontent given
- element.
Run update a select's descendant selectedcontent
+ elements given element.
Run clone selected option into select button given
element.
Run update a select's selectedcontent given
- this.
Run update a select's descendant selectedcontent
+ elements given this.
Run update a select's selectedcontent given
- this.
Run update a select's descendant selectedcontent
+ elements given this.
To maybe clone an option into selectedcontent, given an
- option option:
Let select be option's option element nearest
- ancestor select.
If all of the following conditions are true:
- -select is not null;
option's selectedness is - true; and
select's enabled
- selectedcontent is not null,
then run clone an option into a selectedcontent given
- option and select's enabled
- selectedcontent.
To clone selected option into select button, given a
select element select:
When an option element is popped off the stack of open elements of an
- HTML parser or XML parser, the user agent must run maybe clone an
- option into selectedcontent given the option element.
When an option element option is popped off the stack of open
+ elements of an HTML parser or XML parser:
If option is not selected, + then return.
Let select be option's option element nearest
+ ancestor select.
If select is null, then return.
update a select's descendant selectedcontent
+ elements given select.
To update a select's selectedcontent given a
- select element select:
To update a select's descendant selectedcontent elements
+ given a select element select:
Let selectedcontent be the result of get a select's enabled
- selectedcontent given select.
If select has the multiple
+ attribute, then return.
If selectedcontent is null, then return.
Let descendantSelectedcontents be « ».
Let option be the first option in select's list of options whose selectedness is true, if any such option
- exists, otherwise null.
For each descendant of select's descendants:
-If option is null, then run clear a selectedcontent
- given selectedcontent.
If descendant is a selectedcontent element, then append descendant to
+ descendantSelectedcontents.
Otherwise, run clone an option into a selectedcontent given
- option and selectedcontent.
For each selectedcontent in descendantSelectedcontents:
+ +Update a selectedcontent given select and
+ selectedcontent.
To get a select's enabled
- selectedcontent given a select element select:
To update a selectedcontent given a select element
+ select and a selectedcontent element selectedcontent:
If select has the multiple
- attribute, then return null.
Let selectedcontent be the first selectedcontent element
- descendant of select in tree order if any such element
- exists; otherwise return null.
Let option be the first option in select's list of options whose selectedness is true, if any such option
+ exists, otherwise null.
If selectedcontent's disabled is - true, then return null.
If option is null, then run clear a selectedcontent
+ given selectedcontent.
Return selectedcontent.
Otherwise, run clone an option into a selectedcontent given
+ option and selectedcontent.
If selectedcontent is disabled, + then return.
Let documentFragment be a new DocumentFragment whose node
document is option's node document.
If selectedcontent is disabled, + then return.
Replace all with null within selectedcontent.
To clear a select's non-primary selectedcontent elements,
- given a select element select:
Let seenFirst be false.
Let elements be « ».
For each descendant of select's descendants in tree order that is a
- selectedcontent element:
If seenFirst is false, then set seenFirst to true.
Otherwise, append descendant to - elements.
For each element of elements, clear a
- selectedcontent given element.
The selectedcontent HTML element post-connection steps, given
+
The selectedcontent HTML element insertion steps, given
selectedcontent, are:
If selectedcontent's disabled is
- true, nearestSelectAncestor is null, or nearestSelectAncestor has the
- multiple attribute, then return.
Run update a select's selectedcontent given
- nearestSelectAncestor.
Run clear a select's non-primary selectedcontent
- elements given nearestSelectAncestor.
The selectedcontent HTML element removing steps, given
- removedNode, isSubtreeRoot, and oldAncestor are:
The selectedcontent HTML element post-connection steps, given
+ selectedcontent, are:
If removedNode's disabled is - true, then return.
Let nearestSelectAncestor be null.
For each ancestor of removedNode's For each ancestor of selectedcontent's ancestors, in reverse tree order:
If ancestor is a select element, then return.
If ancestor is a select element:
If nearestSelectAncestor is null, then set nearestSelectAncestor + to select and break.
For each ancestor of oldAncestor's inclusive ancestors, in reverse tree order:
+If selectedcontent's disabled is
+ true, nearestSelectAncestor is null, or nearestSelectAncestor has the
+ multiple attribute, then return.
If ancestor is a select element, then run update a
- select's selectedcontent given ancestor and
- return.
Update a selectedcontent given select and
+ selectedcontent.
If option's cached nearest ancestor select element
- is null, then continue.
If option's cached nearest ancestor select element
+ is null, then continue.
option's cached nearest ancestor select
+ element is null in the case that option hasn't has its insertion steps called yet. If such an option is selected which can happen if multiple
+ options in the markup have the selected attribute, then its insertion steps will run this algorithm again, and deselect
+ insertedSelectedOption. This way, the last option element with the
+ selected attribute will become the only one with
+ selectedness.
If option's selectedness is @@ -56478,7 +56491,7 @@ interface HTMLSelectElement : HTMLElement {
If lastSelectedOption is null if firstEnabledOption is not null:
+If lastSelectedOption is null and firstEnabledOption is not null:
Set firstEnabledOption's HTMLSelectElement : HTMLElement {
To insert a selected option given a select element
- select and an option element insertedSelectedOption:
Assert: insertedSelectedOption's selectedness is true.
For each option in select's list of options:
- -If option's selectedness is
- true, and option is not insertedSelectedOption, and option's
- cached nearest ancestor select element is not null, then set
- option's selectedness to
- false.
option's cached nearest ancestor select
- element is null in the case that option hasn't has its insertion steps called yet. If such an option has selectedness, then its insertion steps will run this
- algorithm again, and deselect insertedSelectedOption. This way, the last
- option element with the selected
- attribute will become the only one with selectedness
Update a select's descendant selectedcontent
- elements given select.
To send If newSelect is not null: If option's selectedness
- is true, then insert a selected Let initiallySelected be true if option is selected, otherwise false. Otherwise, run the selectedness setting algorithm given
+ Run the selectedness setting algorithm given
newSelect. If initiallySelected is true and option is selected, then update a
+ The selectedness setting algorithm will run update a
+ If select has the Let descendantSelectedcontents be « ». For each descendant of select's descendants: If descendant is a Let descendantSelectedcontents be select's descendants that are
+ For each selectedcontent in descendantSelectedcontents:select update notifications for a select element
element, queue an element task on the user interaction task
@@ -57399,12 +57374,23 @@ interface HTMLOptionElement : HTMLElement {
-
From 175b54c9dd2f7022ed70d56f801832a1c3ad0d0f Mon Sep 17 00:00:00 2001
From: Joey Arhar option given newSelect
- and optionselect's descendant selectedcontent elements given
+ newSelect.select's descendant selectedcontent elements if it selects
+ a new option. In this case, no new option is getting selected, but we still want to update
+ selectedcontent elements because a selected option has been inserted.multiple
attribute, then return.
-
- selectedcontent element, then append descendant to
- descendantSelectedcontents.selectedcontent elements, in tree order.
For each selectedcontent in descendantSelectedcontents:
+For each selectedcontent of descendantSelectedcontents:
Update a Let option be the first selectedcontent given select and
From a09e79cdbb59c6935eecfbe3f026dd2fc8a40095 Mon Sep 17 00:00:00 2001
From: Joey Arhar option in select's list of options whose selectedness is true, if any such option
- exists, otherwise null.
If option is null, then run clear a selectedcontent
given selectedcontent.
If select has the multiple
attribute, then return.
Let descendantSelectedcontents be select's descendants that are
- selectedcontent elements, in tree order.
Let descendantSelectedcontents be select's descendant
+ selectedcontent elements which are not disabled, in tree order.
For each selectedcontent of descendantSelectedcontents:
From 091d7375eba26dec2b002ec7dc8fd68def081560 Mon Sep 17 00:00:00 2001 From: Joey ArharRun the selectedness setting algorithm given - selectElement.
If an option element in the list of
- options asks for a reset, then run that
- select element's selectedness setting algorithm.
To ask for a reset given an option element option:
If option's cached nearest ancestor select element is
+ null, then return.
Run the selectedness setting algorithm given option's cached
+ nearest ancestor select element and false.
The selectedness setting algorithm, given a select element
- element, is to run the following steps:
If element has the multiple attribute,
@@ -56681,8 +56688,9 @@ interface HTMLSelectElement : HTMLElement {
If updateSelectedcontent is true, then run update a select's
- descendant selectedcontent elements given element.
If updateSelectedcontent is true and insertionOrRemovalSteps is
+ false, then run update a select's descendant selectedcontent
+ elements given element.
If oldSelect is not null, then run the selectedness setting - algorithm given oldSelect.
If newSelect is not null:
@@ -57558,19 +57566,7 @@ interface HTMLOptionElement : HTMLElement { data-x="concept-option-selectedness">selectedRun the selectedness setting algorithm given - newSelect.
If initiallySelected is true and option is selected, then update a
- select's descendant selectedcontent elements given
- newSelect.
The selectedness setting algorithm will run update a
- select's descendant selectedcontent elements if it selects
- a new option. In this case, no new option is getting selected, but we still want to update
- selectedcontent elements because a selected option has been inserted.
selectThe option HTML element post-connection steps, given
+ insertedOption:
+ +
If insertedOption's cached nearest ancestor select
+ element is not null and insertedOption is selected, then update a select's
+ descendant selectedcontent elements given insertedOption's
+ cached nearest ancestor select element.
The option HTML element removing steps, given
- removedNode, isSubtreeRoot, and oldAncestor are to run
- update an option's nearest ancestor select given
- removedNode.
If removedNode is selected
+ and removedNode's cached nearest ancestor select element is
+ not null, then queue a microtask to update a select's descendant
+ selectedcontent elements given removedNode's cached nearest
+ ancestor select element.
Update an option's nearest ancestor select given
+ removedNode.
If lastSelectedOption is null and firstEnabledOption is not null:
+If lastSelectedOption is null and firstEnabledOption is not null and + element's display size is 1:
Set firstEnabledOption's
Date: Thu, 23 Apr 2026 09:11:45 -0700
Subject: [PATCH 18/29] remove unused variable and fix naming
---
source | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/source b/source
index cb7a3ae4904..a5e08de57ac 100644
--- a/source
+++ b/source
@@ -57559,17 +57559,8 @@ interface HTMLOptionElement : HTMLElement {
If oldSelect is not null, then run the selectedness setting
algorithm given oldSelect and true. If newSelect is not null: Let initiallySelected be true if option is selected, otherwise false. Run the selectedness setting algorithm given
- newSelect and true. If newSelect is not null, then run the selectedness setting
+ algorithm given newSelect and true.
-
-
multiple attribute, then return.
- Update a selectedcontent given select and
- selectedcontent.
Update a selectedcontent given nearestSelectAncestor
+ and selectedcontent.
Let select be removedNode's cached nearest ancestor
+ select element.
If removedNode is selected
- and removedNode's cached nearest ancestor select element is
- not null, then queue a microtask to update a select's descendant
- selectedcontent elements given removedNode's cached nearest
- ancestor select element.
selectedcontent element descendant, then queue a microtask
+ to update a select's descendant selectedcontent elements
+ given removedNode's cached nearest ancestor select
+ element.
Update an option's nearest ancestor select given
removedNode.
Let select be selectedcontent's nearest ancestor select.
Let select be the result of recalculate a selectedcontent
+ element's disabledness given selectedcontent.
If selectedcontent's disabled is
true, select is null, or select has the To get a Let nearestSelectAncestor be null. For each ancestor of selectedcontent's ancestors, in reverse tree order: If ancestor is a Return null. To recalculate a To update an Let oldSelect be option's cached nearest ancestor
@@ -58488,28 +58489,24 @@ interface HTMLOptionElement : HTMLElement {
algorithm given newSelect and true. Return newSelect. The The Let select be insertedOption's cached nearest ancestor
- Let select be the result of update an If select is null or insertedOption's selectedness is false, then return. Update a Queue a microtask to update a Update an Let newSelect be movedNode's cached nearest ancestor
- Let newSelect be the result of update an If newSelect is not null, movedNode's selectedness is true, and newSelect has
@@ -58615,22 +58609,6 @@ interface HTMLOptionElement : HTMLElement {
When an Let select be option's cached nearest ancestor
- If select is null or option's selectedness is false, then return. Update a The The Update a Queue a microtask to update a HTMLSelectedContentElement : HTMLElement
- selectedcontent element's nearest ancestor select, given a
- selectedcontent element selectedcontent:
-
-
-
- select element, then return
- ancestor.selectedcontent element's disabledness, given a
selectedcontent element selectedcontent, run these steps. They return a
From a35e96a5bf827495b0cde52687af0a5c4e0d4585 Mon Sep 17 00:00:00 2001
From: Anne van Kesteren option's nearest ancestor select, given an
- option option:option option, run these steps. They return a select element
+ or null.
+
+ option HTML element insertion steps, given
- insertedOption, are to update an option's nearest ancestor
- select given insertedOption.option HTML element post-connection steps, given
insertedOption, are:
-
select element.option's nearest
+ ancestor select given insertedOption.select's descendant selectedcontent
- elements given select.select's descendant
+ selectedcontent elements given select.select's descendant
selectedcontent elements given oldSelect.option's nearest ancestor select given
- movedNode.select element.option's nearest
+ ancestor select given movedNode.option element option is popped off the stack of open
- elements of an HTML parser or XML parser:
-
- select element.select's descendant selectedcontent
- elements given select.
option.selectedselectedcontent HTML element insertion steps, given
- selectedcontent, are to recalculate a selectedcontent element's
- disabledness given selectedcontent.selectedcontent HTML element post-connection steps, given
selectedcontent, are:
@@ -60562,8 +60534,8 @@ interface HTMLSelectedContentElement : HTMLElementselect is null, or select has the
multiple attribute, then return.
- selectedcontent given select and
- selectedcontent.selectedcontent given
+ select and selectedcontent.select
If select is null or insertedOption's selectedness is false, then return.
selectedcontent elements, then return.
Queue a microtask to update a select's descendant
selectedcontent elements given select.