bigskysoftware / bigskysoftware/htmx

htmx:beforeSwap event is not emitted for the hx-swap-oob swaps

Open
#2,192 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
49.4k
Forks
1.7k
Avg merge
3d 22h
Merged PRs (30d)
30

Description

When response contains `hx-swap-oob` elements, `htmx:beforeSwap` event is only emitted for the main content only, while `html:afterSwap` events are emitted for all the swaps.

In my case I have a main content that is replaced with `hx-boost` and every response contains 3 additional `hx-swap-oob` elements to be replaced. I have both listeners for the `htmx:beforeSwap` and `htmx:afterSwap`events and here is how the console.log statements look when request is completed:

Screenshot 2024-01-15 at 12 36 26

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.