Skip to content

hx-target-2* ignores hx-swap #93

Open
@gogognome

Description

@gogognome

In a Django project I have this fragment of HTML:

                <tr id="new-item-name-row">
                    <th class="row-header">
                        <form
                                id="new-name-form"
                                hx-ext="sl-button"
                                autocomplete="off"
                                hx-post="{{ new_item_url }}"
                                hx-target="#new-item-name-row"
                                hx-target-4*="#new-item-name-row"
                                hx-target-5*="html"
                                hx-swap="outerHTML"
                                hx-indicator="#spinner-new-name">

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions