https://htmx.org logo
Join Discord
Powered by
# htmx-general
  • l

    late-king-98305

    08/23/2022, 11:44 PM
    XmlProblemFactoryImpl
    FTW
  • b

    brash-house-85887

    08/23/2022, 11:54 PM
    Does the first element/child of a response that includes an hx-swap-oob need to be a div? https://codepen.io/geoffeg/pen/qBowqzK
  • b

    brash-house-85887

    08/24/2022, 12:19 AM
    seems to work, but can't be the first element in a response that also contains an hx-swap-oob. Still trying to narrow it down and looking through the source code. Seems to result in an htmx:swapError.
  • e

    echoing-nest-31408

    08/24/2022, 1:02 AM
    @mysterious-toddler-20573 I think I have things working smoothly and correctly now. I got rid of submit from the form trigger, just using input now, and on all the buttons I use hx-vals to send the action for that button. So now, when javascript is available and htmx is used, it sends the action via a different value than the submit value that's used when js is disabled. By using hx-vals instead of the submit value, I don't get wrong submit values sent in safari sometimes when using htmx (safari was sometimes sending the last button's submit value, for new inputs -- possibly due to 1s delay).
  • m

    mysterious-toddler-20573

    08/24/2022, 1:03 AM
    stand alone elements will cause issues when there is OOB content. You can set
    htmx.config.useTemplateFragments
    to true to use template parsing, which should be able to handle those little buggers: https://htmx.org/docs/#config
  • m

    mysterious-toddler-20573

    08/24/2022, 1:03 AM
    great to hear!
  • e

    echoing-nest-31408

    08/24/2022, 1:04 AM
    morphdom seems to work good too, keeps my cursor position
  • e

    echoing-nest-31408

    08/24/2022, 1:05 AM
    Any opinions on alpine's swap over morphdom? I haven't tried it, but I am using alpine for something else, so I may test it
  • b

    brash-house-85887

    08/24/2022, 1:05 AM
    Thanks, I'll give that a try. (Any reason why, btw? I was wondering if html tables had to adhere to a stricter DOM policy or something?)
  • m

    mysterious-toddler-20573

    08/24/2022, 1:05 AM
    <tr/>
    can't be top level content in "normal" HTML
  • b

    brash-house-85887

    08/24/2022, 1:06 AM
    Ah, got it, thanks!
  • m

    mysterious-toddler-20573

    08/24/2022, 1:06 AM
    it's one of a few tags that have this annoying limitation
  • b

    brash-house-85887

    08/24/2022, 1:06 AM
    I've been writing HTML for 25+ years now and I'm still learning new things.
  • m

    mysterious-toddler-20573

    08/24/2022, 1:06 AM
    if you look here: https://github.com/bigskysoftware/htmx/blob/master/src/htmx.js#L263
  • m

    mysterious-toddler-20573

    08/24/2022, 1:07 AM
    you can see we do some janky stuff where, if the top level content is one of these sorts of tags, we wrap it in a fake table, so it will parse
  • b

    brash-house-85887

    08/24/2022, 1:07 AM
    Hah, I was looking at that a few minutes ago but didn't make the connection to the impact on my issue.
  • m

    mysterious-toddler-20573

    08/24/2022, 1:07 AM
    and we then pull the content out of that table. Unfortunately that doesn't work if you have other out of band content in there as well
  • m

    mysterious-toddler-20573

    08/24/2022, 1:08 AM
    wrapping everything in a template tag does work, and allows you to parse arbitrary content, but that isn't IE compatible, so we don't turn it on by default
  • m

    mysterious-toddler-20573

    08/24/2022, 1:08 AM
    it will be the default in htmx 2.0, and we'll drop that janky code
  • m

    mysterious-toddler-20573

    08/24/2022, 1:08 AM
    in conclusion, don't become a computer programmer and definitely never use the JavaScript history API
  • b

    brash-house-85887

    08/24/2022, 1:09 AM
    I have considered buying a nice rock somewhere in the woods and living under it.
  • h

    hallowed-architect-39752

    08/24/2022, 4:11 AM
    https://twitter.com/htmx_org/status/1490318550170357760 pedantic correction: the thesis-antithesis-synthesis triad is not Hegel's, but Johann Fichte's formulation
  • h

    hallowed-architect-39752

    08/24/2022, 4:11 AM
    source: I read Hegel for fun
  • e

    echoing-nest-31408

    08/24/2022, 1:44 PM
    I've set a htmx-indicator class to a few elements so that when the button is clicked, it shows a spinner. However, this also happens for the form itself because the form has hx-trigger="input", which leads to all those buttons briefly showing a spinner every time an input is changed. Is there a straight forward way for me to have a spinner show for a specific button when clicked (hx-trigger="click"), but not when the form's triggered for input?
  • m

    mysterious-toddler-20573

    08/24/2022, 1:56 PM
    you could use the hx-indicator attribute specifically on those buttons
  • m

    mysterious-toddler-20573

    08/24/2022, 2:01 PM
    idiomorph
    t
    g
    +2
    • 5
    • 54
  • e

    echoing-nest-31408

    08/24/2022, 3:24 PM
    Thanks, I think I've worked out something with that.
  • e

    echoing-nest-31408

    08/24/2022, 3:25 PM
    Is there something faulty with inputs that are type="number" instead of type="text"? With text, it keeps the cursor position and seems to act fine. With number it doesn't keep cursor position unless I use morphdom. Furthermore, htmx seems to stop working without any errors in console when using number, after swaps sometimes.
  • e

    echoing-nest-31408

    08/24/2022, 3:26 PM
    Changing to type="text", and the issues disappear.
  • e

    echoing-nest-31408

    08/24/2022, 3:27 PM
    By "stop working", I mean no further requests are sent for triggers
1...795796797...1146Latest