Skip to content

Place trailing comments per spec and clarify open elements - #2557

Merged
jhy merged 2 commits into
masterfrom
treebuilder-open-elements
Aug 9, 2026
Merged

jhy merged 2 commits into
masterfrom
treebuilder-open-elements

Conversation

@jhy

@jhy jhy commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Comments after now remain under the html element, while comments after are attached to the Document, matching the HTML specification.

Make currentElement() strictly represent the top of the stack of open elements, and use an explicit Document fallback only for generic node attachment.

This separates parser state from insertion placement while preserving fragment parsing and empty-stack recovery.

jhy added 2 commits August 9, 2026 15:48
Comments after </body> now remain under the html element, while comments after </html> are attached to the Document, matching the HTML specification.

Make currentElement() strictly represent the top of the stack of open elements, and use an explicit Document fallback only for generic node attachment.

This separates parser state from insertion placement while preserving fragment parsing and empty-stack recovery.
@jhy jhy added this to the 1.23.2 milestone Aug 9, 2026
@jhy
jhy merged commit d7ee3f8 into master Aug 9, 2026
22 checks passed
@jhy
jhy deleted the treebuilder-open-elements branch August 9, 2026 05:59
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