bigskysoftware / bigskysoftware/htmx-extensions
response-targets: add support for hx-swap-... overrides
- Dominant language
- JavaScript
- Stars
- 284
- Forks
- 88
- PR merge metrics
- No merged PRs in 30d
Description
Hi guys,
First of all, thanks for the great work on HTMX and its extensions. I just started a new project with it, and I must say I'm surprised how convenient it is to work with.
I ran into one issue though with the `response-targets` extension: it would be really handy if it was possible to override the `hx-swap` attribute similarly to `hx-target`, because the two are tightly related.
In my specific case, I'd need to replace a `delete` swap rule with `innerHTML`. I know I could tweak my components and API to be able to use the same swap rule, but that would really degrade the code (especially the API). My current workaround is to include a custom header in the HX request that triggers a custom "reswap" logic (`HX-Reswap` response header) on the backend, effectively implementing `hx-swap-` manually on the backend, but solving this problem with an `hx-swap-` attribute in the HTML would be way cleaner and more elegant in my opinion.
Contributor guide
Assessment
This issue has not been assessed yet.