Skip to content

Remove categories of select/optgroup/option element inner content elements#12568

Merged
annevk merged 5 commits into
whatwg:mainfrom
dbaron:content-model-cleanup-part2
Jul 7, 2026
Merged

Remove categories of select/optgroup/option element inner content elements#12568
annevk merged 5 commits into
whatwg:mainfrom
dbaron:content-model-cleanup-part2

Conversation

@dbaron

@dbaron dbaron commented Jun 11, 2026

Copy link
Copy Markdown
Member

This removes the categories:

  • select element inner content elements
  • optgroup element inner content elements
  • option element inner content elements in order to simplify the specification a bit.

It does so by making the div content model rules that use these concepts instead use the transparent content model concept, which works for these cases and is perhaps also more clear.

This is a followup to #12504 and also has the goal of simplifying the content model changes we will need in #12011. (I think #12011 may also need the concept of limiting this transparency to certain close descendants but not all descendants, but I don't think that concept is needed for the select content models.)

(Sorry, I wrote this last week right after landing #12504, but I forgot to actually create the PR!)


/dom.html ( diff )
/form-elements.html ( diff )
/grouping-content.html ( diff )
/index.html ( diff )
/indices.html ( diff )
/scripting.html ( diff )

…ments.

This removes the categories:
* select element inner content elements
* optgroup element inner content elements
* option element inner content elements
in order to simplify the specification a bit.

It does so by making the div content model rules that use these concepts
instead use the transparent content model concept, which works for these
cases and is perhaps also more clear.

This is a followup to whatwg#12504 and also has the goal of simplifying the
content model changes we will need in whatwg#12011.  (I think whatwg#12011 may also
need the concept of limiting this transparency to certain close
descendants but not all descendants, but I don't think that concept is
needed for the select content models.)
Comment thread source
<dd><span><code>option</code> element inner content elements</span>.</dd>
<dt><span data-x="concept-element-contexts">Contexts in which this element can be used</span>:</dt>
<dd>Where <span>flow content</span> is expected.</dd>
<dd>As a child of a <code>dl</code> element.</dd>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Add the following:

As a descendant of an option element, an optgroup element or select element

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.

Agreed, but some nits:

As a descendant of an option element, an optgroup element, or a select element.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added. (I assume you meant in the "Contexts" <dt>.)

@annevk annevk left a comment

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.

Thanks for continuing to simplify this!

I think @mtrootyy's comment makes sense. WDYT @dbaron?

Comment thread source Outdated
<span data-x="Palpable content">palpable</span></td>
<td><span data-x="Phrasing content">phrasing</span>;
<span><code>option</code> element inner content elements</span>*</td>
<span>transparent</span></td>

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.

Does it make sense to say that the Parents can be transparent? Just phrasing might suffice here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, I don't think it does. Removed. (I admit I find editing these tables to be somewhat difficult, and have also noticed they don't seem all that well-maintained as a result...)

On the other hand, I think (given the other thread) I think this pointed out that I should add select/optgroup/option to the parents entry of the table for div.

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.

That seems right. AI found some more cases including that this should probably list div* as well, because you can have select > div > div > option.

If my latest commit looks good to you I suggest we merge this.

@dbaron dbaron left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think your latest commit looks good modulo the comments below:

Comment thread source Outdated
<td><span data-x="Flow content">flow</span></td>
<code>optgroup</code>;
<code>select</code>;
<code>div</code>*</td>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think listing div* as a parent of div doesn't make sense, both because * doesn't make sense in the Parent column and because it's already accounted for with flow above.

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 is precedent for * in the Parent column. But I agree that div is redundant in all these cases.

Comment thread source
<code>optgroup</code>;
<code>select</code>;
<code>div</code>*</td>
<td><span data-x="Flow content">flow</span>*</td>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

There seems to be roughly a 50/50 split over whether a * follows "flow" or "phrasing" in the "Children" column. Probably worth making this consistent one way or the other in a followup. I guess the change here is fine although I might also just leave as-is until the followup.

Comment thread source Outdated
Comment thread source Outdated
Comment thread source
<td><span data-x="text content">text</span>*;
<code>div</code>*;
<span data-x="Phrasing content">phrasing</span></td>
<span data-x="Phrasing content">phrasing</span>*</td>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm ok with this, but there's a lot more like it (see my comment on the 50/50 split above).

@annevk
annevk merged commit 6e358ab into whatwg:main Jul 7, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

3 participants