Skip to content

HX-Reselect does not support "unset" (like hx-select does) #3152

Open
@oliverhaas

Description

@oliverhaas

Pretty much the title.

HX-Reselect does not support unset like hx-select does.

I guess this is a pretty rare case, but I wanted to basically do the following:

<button hx-select="#some_div" hx-target="#some_div">
  Click me
</button>

Then on the server side I want to switch to a body swap, and since hx-select is set I need to unset it.

HX-Retarget = "body"
HX-Reselect = "unset"

Such a body swap might be the only case where unset really matters, since otherwise one is probably able to just work with css selectors. In this case I don't think there is a way. Yes, I've tried :scope, :host, *, > *, and all other suggestions for the selector I could find. maybe I'm missing something...

But in any case: I think it would be nice if htmx would just support the HX-Reselect override with unset like one would expect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions