bigskysoftware / bigskysoftware/htmx

`body` content not selected when `hx-select="body"` is set

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

Description

When an element has `hx-select="body"` applied to it, no content is selected from a given response, and instead a blank response is swapped in. For example, using the following:

```py
import flask

app = flask.Flask(__name__)

@app.route("/")
def index():
return """

click me

"""

@app.route("/alt")
def bad():
return """

swapped page

howdy

"""
```

Clicking the button when `hx-select="body"` is applied will swap in an empty response.

If the `hx-select` attribute is removed from the button, the contents of the response's `body` will be swapped as normal (ironically, mimicking the behaviour expected when the attribute is present).

Unfortunately, I think there's more to this than just what is demonstrated here - this issue stems from a more complex error-handling setup in a larger app and I think there are other things going on there that might lead to the same condition happening that I've been struggling to isolate.

Cheers :)

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.