Skip to content

Add event listener for htmx:after:process#652

Open
rewritten wants to merge 1 commit intobigskysoftware:masterfrom
rewritten:support-htmx-4
Open

Add event listener for htmx:after:process#652
rewritten wants to merge 1 commit intobigskysoftware:masterfrom
rewritten:support-htmx-4

Conversation

@rewritten
Copy link

With htmx 4, there are new events to listen to.

Setting up a listener now should be harmless because they are simply not emitted by anyone unless they have the newer htmx installed.

With htmx 4, there are new events to listen to.

Setting up a listener now should be harmless because they are simply not emitted by anyone unless they have the newer htmx installed.
Copilot AI review requested due to automatic review settings March 5, 2026 12:55
@rewritten
Copy link
Author

By the way the docs at https://four.htmx.org/events/#htmx:after:process seems a bit misleading, they point to a detail.elt but evt.detail is empty, and the just-processed element is in target.

Screenshot 2026-03-05 at 13 56 22

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the browser initialization in the hyperscript core to also react to the new htmx:after:process event (introduced in htmx 4), ensuring hyperscript re-processes nodes after htmx finishes processing.

Changes:

  • Add a document.addEventListener("htmx:after:process", …) hook during browser init.
  • Call _runtime.processNode(...) when that event fires to initialize hyperscript behaviors on the processed node.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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