-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Per the docs:
The
hx-swapattribute allows you to specify how the response will be swapped in relative to the target of an AJAX request. If you do not specify the option, the default ishtmx.config.defaultSwapStyle(innerHTML).
This makes sense.
What makes less sense to me is that it also seems to silently default to innerHTML when the value specified is invalid. As in, an element with hx-swap="gobbledygook" set would use innerHTML. To me, it seems that hx-swap="gobbledygook" is an invalid configuration, and should result in an error (or at least a warning) in the console. Falling back and performing an innerHTML swap would make sense to me, but in my opinion, there should also be an error.
Context: I just spent 2 hours trying to figure out why idiomorph wasn't doing what I expected. If hx-swap="morph:outerHTML" had produced something like htmx:swapError in my console, I would have much more quickly discovered that I had installed the idiomorph extension wrong, and that my initial setup should have worked perfectly.