Skip to content

Parse select content by the current HTML Standard - #50

Merged
matthew-dean merged 1 commit into
mainfrom
select-content-parsing
Sep 22, 2026
Merged

matthew-dean merged 1 commit into
mainfrom
select-content-parsing

Conversation

@matthew-dean

Copy link
Copy Markdown
Contributor

<select><slot></slot></select> lost its slot at parse time, so every framework target generated an empty <select> (Looma's Select, reported by Knit: authored <option>s never render).

The HTML Standard no longer has the "in select" insertion mode: select content is parsed in "in body" as part of the customizable <select> change (whatwg/html#10557, superseded by #10548), so the slot is kept, as Chrome's parser does. parse5 8.0.1 (the latest) still implements the retired mode and drops it.

Until parse5 follows the standard, the source parser parses select tags under a same-length placeholder name (source locations stay exact) and renames them back; the placeholder never leaves the parser.

Test: a slot inside a select reaches the Vue, React, and Svelte output; it fails without the fix. Lint, typecheck, 208 unit tests, 228 target tests pass.

The standard parses <select> content in the in-body insertion mode (the
customizable-select parser change), so <select><slot></slot></select> keeps its
slot. parse5 still implements the retired in-select mode and dropped the slot,
so every framework target emitted an empty select. Select tags are parsed under
a same-length placeholder name and renamed back until parse5 follows the
standard.
@matthew-dean
matthew-dean merged commit b0c1e5b into main Sep 22, 2026
7 checks passed
@matthew-dean
matthew-dean deleted the select-content-parsing branch September 22, 2026 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant