bigskysoftware / bigskysoftware/htmx

hx-swap="delete" should be allowed to work even with no request at all

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

Description

The [documentation on swapping](https://htmx.org/docs/#swapping) says that for **delete**, hx-swap "deletes the target element regardless of the response"

While #1130 has raised the issue of this not happening for 204 response codes, i think it should go further— if `hx-target` and `hx-swap="delete"` are set, the target should be deleted even if none of `hx-get`, `hx-post`, `hx-put`, `hx-patch`, or `hx-delete` are set.

Current use case is loading the full size of an image and then, to remove it, deleting it entirely. Of course JavaScript can do this, but lifting this arbitrary constraint on HTMX feels like a consistent approach.

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.