Skip to content

cleanup htmx attributes for reinit during morph#3834

Open
MichaelWest22 wants to merge 3 commits into
bigskysoftware:four-devfrom
MichaelWest22:morph-re-init
Open

cleanup htmx attributes for reinit during morph#3834
MichaelWest22 wants to merge 3 commits into
bigskysoftware:four-devfrom
MichaelWest22:morph-re-init

Conversation

@MichaelWest22

@MichaelWest22 MichaelWest22 commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Description

Handle morph changing or removing hx- attributes so that it can cleanup and reinitialize them clean. outerSync was already doing this but just moving this logic inside copyAttributes means we now cover morph as well

Corresponding issue:

Testing

Already tests for this in outerSync swap tests but added tests to morph as well

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 Jun 9, 2026
@MichaelWest22

Copy link
Copy Markdown
Collaborator Author

Now also handle hx-live cleanup properly so it responds to the cleanup events when morph detects hx-attributes changing and re-inits all hx attributes. This prevents duplicat live functions being registered on morph etc. Also brought in additional tests from @scriptogre branch and my other PR changes to block hx-on from duplicating listeners on re process.

Note also had to extend the hx attribute lookup in morph to check :* attributes for changes as well

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.

1 participant