mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-10-02 15:25:26 +00:00

If an element is replaced by an extension in `handleSwap`, the events (`afterSwap.htmx` and `afterSettle.htmx`) were not received by the `onLoad` method of extensions defined on parents of the target, because theses extensions were retrieved after the replacement, and so it was not possible to get through the parents, the target not being in the dom anymore. This commits loads the extensions for the target and save them in `eventDetail` before doing the swap, so they are accessible in `triggerEvent`, and passed to `withExtensions` that use this list if passed (else load them). A new test is added that fails without the updates in `htmx.js`.