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

    mysterious-toddler-20573

    12/29/2020, 10:59 PM
    I often do this, along with an
    hx-push-url
    https://htmx.org/attributes/hx-push-url/
  • m

    mysterious-toddler-20573

    12/29/2020, 10:59 PM
    So the URL is copy and pasteable to other people, crawlers, etc.
  • m

    mysterious-toddler-20573

    12/29/2020, 11:00 PM
    The more you use
    hx-boost
    the better SEO you should get, in general
  • h

    helpful-secretary-3515

    12/29/2020, 11:38 PM
    hx-push-url! great, that one helps me !. thank you
  • g

    gorgeous-ghost-95789

    12/30/2020, 12:20 AM
    I haven’t tried too much to make the modals work with distinct URLs. In theory, it should be possible, but it was more moving parts than I wanted to deal with for my server. Here’s one thing to remember when you listen for the
    HX-Request
    header on product pages — you’ll need to return all of your regular page headers and footers, along with the contents of the page underneath the modal pop up. Then, update the URL (or something similar) when visitors dismiss the modal pop up. This will be really great to see, when it’s live!
  • s

    salmon-xylophone-28580

    12/30/2020, 7:42 AM
    Default of
    hx-swap
    is innerHTML. Maybe it is just me, but I use outerHTML more often than innerHTML. I don't want to change the default (since I think this is too late now). What value of hx-swap do you use the most?
  • m

    mysterious-toddler-20573

    12/30/2020, 3:31 PM
    it often depends on the style of application you are building. I have gone back and forth, but end up using
    innerHTML
    a bit more, and it's been the default forever. The good news is that you can configure the default to your liking: https://htmx.org/docs/#config
  • m

    mysterious-toddler-20573

    12/30/2020, 3:31 PM
    Copy code
    html
        <meta name="htmx-config" content='{"defaultSwapStyle":"outerHTML"}'>
  • a

    adamant-exabyte-92636

    01/01/2021, 12:32 PM
    Happy new year to you all 😁👋
  • m

    mysterious-toddler-20573

    01/01/2021, 2:38 PM
    Happy new year folks, thanks for helping make htmx happen
  • b

    big-airline-13935

    01/01/2021, 2:49 PM
    Thank you Carson, for making htmx so great!!
  • m

    most-jelly-15242

    01/01/2021, 3:28 PM
    Happy New Year!
  • a

    adamant-exabyte-92636

    01/01/2021, 5:19 PM
    @User fyi I found some time to finish the tests and documentation for the path-deps pull request (https://github.com/bigskysoftware/htmx/pull/287). Please have a look when you've got time. Also, I made a few pull requests for _hyperscript documentation typos.
  • a

    adamant-exabyte-92636

    01/01/2021, 5:28 PM
    @User great job on the preload pull request (https://github.com/bigskysoftware/htmx/pull/273)! Fwiw I looked through the pull request and I found the code to be clean, logical and easy to understand (which says a lot, coming from a terrible JS developer like me!). The only thing that I can think of that might be useful on top of what you already have, is the ability to perhaps set a different default as to the one you've settled on (onmousedown, 0ms delay), perhaps via a meta tag? This idea was inspired by the ability to set other useful defaults, like
    <meta name="htmx-config" content='{"defaultSwapStyle":"outerHTML"}'>
    . What do you think?
  • g

    gorgeous-ghost-95789

    01/01/2021, 5:56 PM
    Hey @User I think this is covered already. These two properties are inherited from parent nodes, so if you do something like this
    <body hx-ext="preload" preload="on:mouseover wait:100ms">
    then all of the elements below (marked with a
    preload
    attribtute) will use these settings instead of the default values.
  • a

    adamant-exabyte-92636

    01/01/2021, 5:58 PM
    Ah yes of course! That will work perfectly for the uses that I have in mind 👍
  • g

    gorgeous-ghost-95789

    01/01/2021, 5:58 PM
    While you're here, how do you feel about the existing defaults? I wanted to try being as conservative as possible by default, while still giving people the ability to ramp up the "aggressiveness" of the algorithm. Personally, I think I'll use something like
    preload="on:mouseover wait:100ms"
  • g

    gorgeous-ghost-95789

    01/01/2021, 5:58 PM
    And, if that's just a better value all around, maybe I should just make that the default instead.
  • a

    adamant-exabyte-92636

    01/01/2021, 6:00 PM
    That's exactly the default that I was going to set my links to 😁 This will likely vary from app to app, but I feel 100ms on mouseover is plenty of “click intent”
  • g

    gorgeous-ghost-95789

    01/01/2021, 6:02 PM
    Yeah. That's what I think too. I might just change it before it gets merged in 🙂 Right now, I'm just waiting on @mysterious-toddler-20573 to bless the broad architectural strokes, then I'll finish up test cases and documentation.
  • m

    mysterious-toddler-20573

    01/01/2021, 9:59 PM
    OK, I have some time this evening for htmx work, the preload is top of my list
  • m

    mysterious-toddler-20573

    01/02/2021, 2:51 AM
    Did some htmx fiddling tonight. Added the ability to listen for events on other elements, to be used for things like keyboard shortcuts for tabbed elements, etc:
    Copy code
    html
    ...
    <div id="tab1" hx-get="/whatever" hx-trigger="click, keyup[ctrlKey&&textContent=='C'] from:body">Tab 1</div>
    ...
  • g

    gorgeous-ghost-95789

    01/02/2021, 3:00 AM
    Thanks for both of these! Very interested to try out listening to events on other elements
  • g

    gorgeous-ghost-95789

    01/02/2021, 3:00 AM
    htmx is awesome, and you’re awesome for making it, @mysterious-toddler-20573.
  • g

    gorgeous-ghost-95789

    01/02/2021, 3:04 AM
    I have been thinking about the configuration options on the preload plugin. Originally, I was copying the way that
    hx-sse
    works. But on further thought, instead of saying
    preload=“on:mousedown wait:100ms”
    it seems like it would be better to use two separate attributes, like
    preload-on=“mousedown” preload-wait=“100ms”
    . It’s more like standard HTML, and will actually take less code to accomplish. How do you feel about this as a general pattern @mysterious-toddler-20573?
  • m

    mysterious-toddler-20573

    01/02/2021, 3:14 AM
    I defer to the extension designer
  • g

    gorgeous-ghost-95789

    01/02/2021, 3:14 AM
    Okay, fine. But you may come to regret this careless decision 😛
  • g

    gorgeous-ghost-95789

    01/02/2021, 3:16 AM
    I have to say, working on htmx is so much more fun that fixing the Gordian Knot I've created in my primary project.
  • g

    gorgeous-ghost-95789

    01/02/2021, 4:32 AM
    @mysterious-toddler-20573 -- I'm close to done with the documentation for preload. I'm planning on including links to instantclick, which was the inspiration for a lot of this code, and includes some great resources on tuning this kind of behavior. Let me know if you'd rather not, and I'll take those links out.
  • s

    salmon-xylophone-28580

    01/02/2021, 1:18 PM
    I am interested in the preload feature, too. Is it possible to preload a second page immediately after the first page is loaded? For example for tutorials: It is very very likely that the user will hit "next page" sooner or later. Will this use case be supported?
1...114115116...1146Latest