htmx icon indicating copy to clipboard operation
htmx copied to clipboard

beforeSwap and afterSwap events should also log hx-swap setting

Open verheyenkoen opened this issue 4 months ago • 0 comments

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: image

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.

verheyenkoen avatar Feb 10 '24 07:02 verheyenkoen