brainy-ice-92385
10/09/2022, 7:26 PMmysterious-toddler-20573
10/10/2022, 3:20 AMselectAndSwap()
we'll need to parse the response beforehand and select out just the stuff we want to swap into individual chunks and pass that in as the responseText
for each element we are swapping inmysterious-toddler-20573
10/10/2022, 3:20 AMmysterious-toddler-20573
10/10/2022, 3:20 AMinit()
method is the way to get ahold of the internal extension APImysterious-toddler-20573
10/10/2022, 3:21 AMhx-select-oob
option, which does something pretty similar. (The documentation on it sucks though 😑 )square-oyster-36295
10/10/2022, 7:17 AMhx-select-oob
for inspiration, I see it in handleOutOfBandSwaps
functioncuddly-keyboard-70746
10/10/2022, 11:40 AMlate-king-98305
10/10/2022, 3:33 PMhtml
tag." I understand the discussion above, and what generated it - but isn't it really starting to run pretty far afield from the whole HATEOAS way of doing things? IMO, anything that jeopardizes the "throw hx-boost="true"
on the body
tag, and it 'just works!'" makes it not a desirable solution.
htmx is about simplification and straightforwardness. It's not a "run your SPA piece-by-piece" library, it's a "make your MPA feel like it's a SPA" library. As an extension, I think it would be fine (and head
merging is a slightly different discussion, though I have some "just works" concerns there), but to introduce magic in the main library that doesn't go with its original intent seems, to me, to not be the best idea.
My (unrequested) $.02 - probably worth twice what you paid for it...late-king-98305
10/10/2022, 3:33 PMhappy-pillow-29003
10/10/2022, 4:57 PMdata
attribute. Basically it listens for the change event and does something to the rest of the page. Now I’m using htmx to dynamically render these form elements when another input changes, but this means my event listeners don’t work anymore. I guess I’d need something like jquery’s live()
, or some way to re-add the event listeners once htmx has finished swapping the form elements. Is there an easy/obvious way to do this?mysterious-toddler-20573
10/10/2022, 5:33 PMbrainy-ice-92385
10/10/2022, 5:33 PMtarget
was the element you're actually interested in.mysterious-toddler-20573
10/10/2022, 5:34 PMhtmx.onLoad()
to establish your event handlers. Or, alternatively, use Alpine or _hyperscript, which eliminates this problem by colocating the scripts and the elements.boundless-vase-80440
10/10/2022, 6:16 PMhappy-pillow-29003
10/10/2022, 7:20 PMhtmx:afterSwap
, it works well! 👍mysterious-toddler-20573
10/11/2022, 1:48 AMmysterious-toddler-20573
10/11/2022, 1:49 AMrefined-waiter-90422
10/11/2022, 2:45 AMrefined-waiter-90422
10/11/2022, 2:54 AMmysterious-toddler-20573
10/11/2022, 3:46 AMred-farmer-97020
10/11/2022, 4:02 AMred-farmer-97020
10/11/2022, 4:03 AMhundreds-cartoon-20446
10/11/2022, 10:58 AMaloof-crayon-56651
10/11/2022, 11:30 AMaloof-crayon-56651
10/11/2022, 11:31 AMaloof-crayon-56651
10/11/2022, 11:34 AMboundless-vase-80440
10/11/2022, 11:51 AMrefined-waiter-90422
10/11/2022, 12:48 PMrefined-waiter-90422
10/11/2022, 12:51 PM