Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Implement <select> parser "relaxation" — for "customizable" <select> #113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sideshowbarker wants to merge 2 commits into master
base: master
Choose a base branch
Loading
from sideshowbarker/relaxed-select-parsing

Conversation

@sideshowbarker
Copy link
Member

@sideshowbarker sideshowbarker commented Dec 30, 2025
edited
Loading

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

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
Copy link
Member

Sorry I missed this over the holidays.

Copy link
Member Author

Sorry I missed this over the holidays.

No worries — there's no real rush on it

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

Reviewers

@alphan102 alphan102 Awaiting requested review from alphan102

@hsivonen hsivonen Awaiting requested review from hsivonen

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /