Open ThePrimeagen opened 12 months ago
i cannot use the Request
header's Hx-Target
since that is the target in the form not the form itself
also glad to submit a pr to fix this
Indeed, the HX-Retarget
header works differently than hx-target
, as its doc says:
HX-Retarget a CSS selector that updates the target of the content update to a different element on the page
I don't know if this was forgotten at the time extended selectors were added in, I don't see any reason to oppose to add support for those extended selectors for this header, relatively to the element that triggered the request
Feel free to submit a PR for it!
i'll try to get something up in a bit
This is another consequence of the extended CSS selectors being a construct that exists in a lot of places, so it looks like "one thing", but isn't necessarily supported everywhere that CSS selectors are.
You probably don't have to do too much more than change the line you identified to use findAttributeTarget (although the "this"
behavior is a little weird).
Also another reason to unify their documentation: #1601
@alexpetros thanks for the direction! this is great. i will still take care of this, just preparing for my talk still :)
Hx-Retarget and
this
as target causes null error and prevents htmx from operating any more on the sitethe docs claim that this
context
doing a little 422 swap and from the server i was going to target the originating form to show the error
form
server
this will result in the target code executing, notice no special handling for
this