Skip to content

Comments

handle newContent processing of outerMorph that inserts new nodes#3667

Merged
1cg merged 1 commit intobigskysoftware:fourfrom
MichaelWest22:fix-outerMorph-newContent
Feb 23, 2026
Merged

handle newContent processing of outerMorph that inserts new nodes#3667
1cg merged 1 commit intobigskysoftware:fourfrom
MichaelWest22:fix-outerMorph-newContent

Conversation

@MichaelWest22
Copy link
Collaborator

Description

During outerMorph swap style we make the newContent for later processing by using the fragment childNodes and adding in the target node so that either the existing morphed node or the newly inserted nodes will always be processed properly. But inside the morph we actually can clone the nodes with importNode() when inserting new nodes leaving the fragment childNodes disconnected and preventing the cloned in node being processed. To solve this I've removed the importNode which was done to prevent parent node mutations and instead captured the parent node children in the for loop to make the loop stable this way.

Corresponding issue:

Testing

Please explain how you tested this change manually, and, if applicable, what new tests you added. If
you're making a change to just the website, you can omit this section.

Checklist

  • I have read the contribution guidelines
  • I have targeted this PR against the correct branch (master for website changes, dev for
    source changes)
  • This is either a bugfix, a documentation update, or a new feature that has been explicitly
    approved via an issue
  • I ran the test suite locally (npm run test) and verified that it succeeded

@MichaelWest22 MichaelWest22 added the htmx 4 Issues specific to htmx version 4 label Feb 22, 2026
@1cg 1cg merged commit c6644aa into bigskysoftware:four Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

htmx 4 Issues specific to htmx version 4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants