Skip to content

Conversation

josepharhar
Copy link
Contributor

@josepharhar josepharhar commented Oct 14, 2025

This PR changes the "option element nearest ancestor select" algorithm to incorporate cases where the option element is nested inside of option, hr, optgroup, or datalist elements to match the option list algorithm.

Fixes #11788

(See WHATWG Working Mode: Changes for more details.)


/form-elements.html ( diff )

This PR changes the "option element nearest ancestor select" algorithm
to incorporate cases where the option element is nested inside of
option, hr, optgroup, or datalist elements to match the option list
algorithm.

Fixes whatwg#11788
Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

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

This looks good. I guess this is sufficient if we're storing a pointer on option. I hope we can continue to avoid requiring that particular implementation choice however.


<ol>
<li><p>If <var>ancestor</var> is an <code>hr</code>, <code>datalist</code>, or
<code>option</code> element, then return null.</p></li>
Copy link
Member

Choose a reason for hiding this comment

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

Alphabetical order?

<code>option</code> element, then return null.</p></li>

<li>
<p>If <var>ancestor</var> is an <code>optgroup</code> element, then:</p>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<p>If <var>ancestor</var> is an <code>optgroup</code> element, then:</p>
<p>If <var>ancestor</var> is an <code>optgroup</code> element:</p>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

"option element nearest ancestor select" is wrong

2 participants