bigskysoftware / bigskysoftware/htmx-extensions
hx-target-2* ignores hx-swap
- Dominant language
- JavaScript
- Stars
- 284
- Forks
- 88
- PR merge metrics
- No merged PRs in 30d
Description
In a Django project I have this fragment of HTML:
When the form is submitted, and a 200 response is returned, then the response contains two `tr` elements: one that replaces the row with id `new-item-name-row` and a second row with the new item.
This works fine. But when I replace `hx-target` by `hx-target-2*`, then the `form` element gets replaced by the two rows, which completely screws up the table.
If I change the view code to return a 409 status instead of status 200, then it works perfectly.
Is this a bug in the extension?
Contributor guide
Research direction
Start by locating the extension code that handles hx-target-2* and compare its 200-response path with the 409-response path. Reproduce the supplied table and form markup, including hx-swap="outerHTML" and the two returned tr elements. Done means the 200 response applies the outerHTML swap to the intended row without replacing the form with invalid table content.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100