Skip to content

fix stale hx-* handlers on re-process#3835

Open
scriptogre wants to merge 1 commit into
bigskysoftware:four-devfrom
scriptogre:4.0/dynamic-hx-attrs
Open

fix stale hx-* handlers on re-process#3835
scriptogre wants to merge 1 commit into
bigskysoftware:four-devfrom
scriptogre:4.0/dynamic-hx-attrs

Conversation

@scriptogre

Copy link
Copy Markdown
Collaborator

Fixes stale hx-on/hx-trigger handlers after morph or re-process.

Previously:

btn.setAttribute('hx-on:click', 'doV2()')
htmx.process(btn)
btn.click() // fired doV1 AND doV2

Now only the current handler fires. Cleanup is scoped to elements whose wiring attrs (hx-trigger, hx-boost, hx-on*) actually changed. hx-vals changes, hx-trigger with once modifiers, and child elements are unaffected.

Adds 12 tests. All of #3830 / #3834's tests pass.

Related: #3830, #3834

Mutating hx-trigger, hx-on, or hx-boost on an initialized element now takes effect.
@scriptogre scriptogre force-pushed the 4.0/dynamic-hx-attrs branch from 26b48df to 35044f5 Compare June 9, 2026 22:31
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