Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

response-targets extension with documentation, exposed 3 functions in internal API #1436

Merged
merged 8 commits into from
May 23, 2023

Conversation

siefca
Copy link
Contributor

@siefca siefca commented May 12, 2023

The response-targets extensions allows to specify different target elements to be swapped when
different HTTP response codes are received.

Example:

<div hx-ext="response-targets">
    <div id="response-div"></div>
    <button hx-post="/register"
            hx-target="#response-div"
            hx-target-5*="#serious-errors"
            hx-target-404="#not-found">
        Register!
    </button>
    <div id="serious-errors"></div>
    <div id="not-found"></div>
</div>

@1cg 1cg merged commit 7fc5ac5 into bigskysoftware:master May 23, 2023
checketts pushed a commit to checketts/htmx that referenced this pull request Jun 19, 2023
… internal API (bigskysoftware#1436)

* findThisElement, getClosestAttributeValue, querySelectorExt exposed in internal API

* Added response-targets extension.

* Extra check for empty element in response-targets.js

* Added test/ext/response-targets.js

* Linked response-targets.md

* Added htmx.config.{responseTargetPrefersExisting, responseTargetPrefersRetargetHeader} configuration options

* Typo fixed (not impacting logic)
alexpetros pushed a commit to alexpetros/htmx that referenced this pull request Jun 21, 2023
… internal API (bigskysoftware#1436)

* findThisElement, getClosestAttributeValue, querySelectorExt exposed in internal API

* Added response-targets extension.

* Extra check for empty element in response-targets.js

* Added test/ext/response-targets.js

* Linked response-targets.md

* Added htmx.config.{responseTargetPrefersExisting, responseTargetPrefersRetargetHeader} configuration options

* Typo fixed (not impacting logic)
@RafaelZasas
Copy link

Has this been updated in the htmx documentation?
If this has been added officially, I would like to add this to the HTMX LSP thats being worked on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants