Skip to content

DomNode: fix insertBefore() not dissolving DocumentFragment#1110

Merged
rbri merged 1 commit intoHtmlUnit:masterfrom
duonglaiquang:duong_DomNode
Apr 16, 2026
Merged

DomNode: fix insertBefore() not dissolving DocumentFragment#1110
rbri merged 1 commit intoHtmlUnit:masterfrom
duonglaiquang:duong_DomNode

Conversation

@duonglaiquang
Copy link
Copy Markdown
Contributor

###This PR does the following

Fix DomNode.insertBefore(DomNode) to dissolve DocumentFragment into its children before insertion

Problem

The DomNode.insertBefore(DomNode) did not check for DomDocumentFragment. When a DocumentFragment was passed, the fragment node itself was inserted into the DOM tree instead of being dissolved into its children.
This caused before(), after(), prepend(), and multi-arg replaceWith() to produce incorrect DOM structures.

@sonarqubecloud
Copy link
Copy Markdown

@rbri rbri merged commit e4b83d0 into HtmlUnit:master Apr 16, 2026
8 checks passed
@rbri
Copy link
Copy Markdown
Member

rbri commented Apr 16, 2026

As always ❤️

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