htmx
htmx copied to clipboard
beforeSwap and afterSwap events should also log hx-swap setting
The beforeSwap and afterSwap events when logged to the console don't contain the actual (inherited) hx-swap
setting.
I was debugging an expected swap that didn't occur. I added logging to the console as described here.
AJAX response was correct, target was correct, isError = false, shouldSwap = true, failed = false, succesful = true, as shown here:
It didn't occur to me that I should explicitly set the hx-swap="innerHTML"
attribute since that is the default. But I didn't know hx-swap="none"
was set on the <body>
tag and it was inherited to the whole DOM tree.
If hx-swap: 'none'
would have been reflected in the log, I would have caught and fixed the issue much earlier.