Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 39 additions & 18 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -56241,24 +56241,45 @@ interface <dfn interface>HTMLSelectElement</dfn> : <span>HTMLElement</span> {
<var>element</var>, is to run the following steps:</p>

<ol>
<li><p>If <var>element</var>'s <code data-x="attr-select-multiple">multiple</code> attribute is
absent, and <var>element</var>'s <span data-x="concept-select-size">display size</span> is 1,
and no <code>option</code> elements in the <var>element</var>'s <span
data-x="concept-select-option-list">list of options</span> have their <span
data-x="concept-option-selectedness">selectedness</span> set to true, then set the <span
data-x="concept-option-selectedness">selectedness</span> of the first <code>option</code>
element in the <span data-x="concept-select-option-list">list of options</span> in
<span>tree order</span> that is not <span data-x="concept-option-disabled">disabled</span>,
if any, to true, and return.</p></li>

<li><p>If <var>element</var>'s <code data-x="attr-select-multiple">multiple</code> attribute is
absent, and two or more <code>option</code> elements in <var>element</var>'s <span
data-x="concept-select-option-list">list of options</span> have their <span
data-x="concept-option-selectedness">selectedness</span> set to true, then set the <span
data-x="concept-option-selectedness">selectedness</span> of all but the last <code>option</code>
element with its <span data-x="concept-option-selectedness">selectedness</span> set to true in
the <span data-x="concept-select-option-list">list of options</span> in <span>tree order</span>
to false.</p></li>
<li><p>Let <var>updateSelectedcontent</var> be false.</p></li>

<li>
<p>If <var>element</var>'s <code data-x="attr-select-multiple">multiple</code> attribute is
absent, and <var>element</var>'s <span data-x="concept-select-size">display size</span> is 1,
Comment thread
josepharhar marked this conversation as resolved.
Outdated
and no <code>option</code> elements in the <var>element</var>'s <span
data-x="concept-select-option-list">list of options</span> have their <span
data-x="concept-option-selectedness">selectedness</span> set to true, then:</p>
Comment thread
josepharhar marked this conversation as resolved.
Outdated

<ol>
<li><p>Set the <span
data-x="concept-option-selectedness">selectedness</span> of the first <code>option</code>
element in the <span data-x="concept-select-option-list">list of options</span> in
<span>tree order</span> that is not <span data-x="concept-option-disabled">disabled</span>,
if any, to true.</p></li>

<li><p>Set <var>updateSelectedcontent</var> to true.</p></li>
</ol>
</li>

<li>
<p>Otherwise, if <var>element</var>'s <code data-x="attr-select-multiple">multiple</code>
attribute is absent, and two or more <code>option</code> elements in <var>element</var>'s <span
Comment thread
josepharhar marked this conversation as resolved.
Outdated
data-x="concept-select-option-list">list of options</span> have their <span
data-x="concept-option-selectedness">selectedness</span> set to true, then:</p>
Comment thread
josepharhar marked this conversation as resolved.
Outdated

<ol>
<li><p>Set the <span data-x="concept-option-selectedness">selectedness</span> of all but the
last <code>option</code> element with its <span
data-x="concept-option-selectedness">selectedness</span> set to true in the <span
data-x="concept-select-option-list">list of options</span> in <span>tree order</span> to
false.</p></li>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reads a bit ambiguous to me. Maybe:

Set the selectedness of all option elements whose selectedness is true in the list of options to false, exception for the last one.

Perhaps it's okay as-is though. @zcorpan @domfarolino @noamr thoughts?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like your proposed wording, but do we even need to specify the ones with selectedness to true? How about:

Set the selectedness of all option elements in the list of options to false, exception for the last one in tree order.

This should be the same, but is more concise, and keeps the tree order condition, which I think is nice.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not the same. If we have true, true, false we would go to false, false, false with your wording. Whereas we want false, true, false.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, I find it hard to read.

How about something like:

Let |options| be element's list of options.
Let |currentlySelectedOptions| be the options in |options| whose selectedness is true
... make the rest of the checks on |options" and on |currentlySelectedOptions|

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's now also #12083 which is quite a bit clearer for this particular problem, but I'm not sure how it all relates anymore.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I am going to make it a clearer algorithm. I think we can proceed in a couple different ways:

  1. Continue with this PR and 12083. I can deal with the merge conflicts for whichever gets merged first/second.
  2. Create a third PR which doesn't change behavior but changes this algorithm to make it easier to read and modify which doesn't change behavior. This PR and 12083 would be rebased on that one.
  3. Combine this PR with 12083 so there is only one PR.

Which would you prefer @annevk?


<li><p>Set <var>updateSelectedcontent</var> to true.</p></li>
</ol>
</li>

<li><p>If <var>updateSelectedcontent</var> is true, then run <span>update a <code>select</code>'s
<code>selectedcontent</code></span> given <var>element</var>.</p></li>
</ol>
</div>

Expand Down