Skip to content

Conversation

@sideshowbarker
Copy link
Member

@sideshowbarker sideshowbarker commented Dec 30, 2025

This change, in order to support the “customizable” select element:

  • “relaxes” parsing rules in select (to allow more elements as children)
  • adds the selectedcontent element for cloning selected option content

ElementName.java

  • Add selectedcontent element with TreeBuilder.SELECTEDCONTENT group

TreeBuilder.java

  • Add SELECTEDCONTENT group constant and IN_SELECT_IN_CONTENT mode
  • Track selectedContentPointer and activeOptionStackPos for cloning
  • Allow div, span, and other elements in select in “relaxed” mode
  • Deep clone option content to selectedcontent when option closes
  • Handle selectedcontent special-casing (store pointer, no stack push)

SAXTreeBuilder.java

  • Implement clearSelectedContentChildren() for clearing before clone
  • Implement deepCloneChildren() and deepCloneNode() for option cloning

ParentNode.java

  • Add clearChildren() method, to support clearing selectedcontent

html5lib-tests (submodule)

  • Updated our submodule to pull in corresponding tests for “relaxed” select parsing

@sideshowbarker sideshowbarker force-pushed the sideshowbarker/relaxed-select-parsing branch from 7a83606 to cdf2934 Compare December 30, 2025 03:01
This change make our test harness skip 13 tests for foreign-content
fragment parsing that have been failing from some time now. They’re
not regressions — or not recent regressions at least — so, we can
essentially treat them as “known to fail” for the time being.
This change, in order to support the “customizable” <select> element:

  - “relaxes” parsing rules in <select> (to allow more elements as children)
  - adds the <selectedcontent> element for cloning selected <option> content

ElementName.java
----------------
  - Add <selectedcontent> element with TreeBuilder.SELECTEDCONTENT group

TreeBuilder.java
----------------
  - Add SELECTEDCONTENT group constant and IN_SELECT_IN_CONTENT mode
  - Track selectedContentPointer and activeOptionStackPos for cloning
  - Allow <div>, <span>, and other elements in <select> in “relaxed” mode
  - Deep clone <option> content to <selectedcontent> when <option> closes
  - Handle <selectedcontent> special-casing (store pointer, no stack push)

SAXTreeBuilder.java
-------------------
  - Implement clearSelectedContentChildren() for clearing before clone
  - Implement deepCloneChildren() and deepCloneNode() for <option> cloning

ParentNode.java
---------------
  - Add clearChildren() method, to support clearing <selectedcontent>

html5lib-tests submodule
------------------------
  - Updated to pull in corresponding tests for “relaxed” <select> parsing
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.

2 participants