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

    mysterious-toddler-20573

    12/27/2020, 2:57 PM
    Copy code
    html 
    <div onclick="htmx.trigger('#otherDiv', 'makeRequest') >...</div>
    
      <div id="otherDiv" hx-trigger="makeRequest" hx-get="/whatever">...</div>
  • m

    mysterious-toddler-20573

    12/27/2020, 2:59 PM
    https://htmx.org/api/#trigger
  • a

    adamant-exabyte-92636

    12/27/2020, 3:01 PM
    I personally like the hyperscript way better ๐Ÿ™ ๐Ÿ‘
  • a

    adamant-exabyte-92636

    12/27/2020, 4:34 PM
    Hmmm strange, I couldn't find the
    on <event> trigger <another-event> on #an-element
    example in the hyperscript docs? Is it an undocumented feature that you can trigger events on other elements? Reading the trigger https://hyperscript.org/commands/trigger/ documentation makes it seems like trigger is only for the current element? The
    send
    command (https://hyperscript.org/commands/send/) seems more appropriate for triggering events on other elements? But this begs the question... if you can use
    trigger
    to send events on other elements, what's the point of having both
    trigger
    and
    send
    ?
  • m

    mysterious-toddler-20573

    12/27/2020, 4:53 PM
    Sorry send is what you want!
  • g

    gorgeous-ghost-95789

    12/27/2020, 5:20 PM
    Back to WebSocket connections for a minute, as a low-level library, there are some other features that we could implement/expose that might make it more attractive to run WebSockets through htmx. The first thing to come to mind is automatically reconnecting WebSocket connections when they drop (PR#150).
  • g

    gorgeous-ghost-95789

    12/27/2020, 5:21 PM
    Given an hour or two of research, I'm sure we could make a list of general-purpose WebSocket management that we could simplify for JS applications built on htmx.
  • a

    adamant-exabyte-92636

    12/27/2020, 5:30 PM
    +1 for automatic reconnecting web sockets
  • g

    gorgeous-ghost-95789

    12/27/2020, 6:20 PM
    Hey @User -- my experience with Web Sockets is extremely limited. What are some other common pain points that you wished could be addressed? Be greedy. ๐Ÿ™‚
  • a

    adamant-exabyte-92636

    12/27/2020, 8:29 PM
    No, besides @rough-judge-5566โ€™s requirement for an elegant pattern/mechanism to parse incoming JSON data, I donโ€™t really have anything else on a wishlist ๐Ÿ˜„ Iโ€™m not a big plain web sockets user either, I usually just use Firebase
  • g

    gorgeous-ghost-95789

    12/27/2020, 8:33 PM
    That makes sense. So maybe we just need the ability to put adapters before/after each side of the WebSocket connection so you can make extensions that translate from Firebase, etc..
  • s

    salmon-xylophone-28580

    12/28/2020, 8:49 AM
    There is now a second htmx question at Stackoverflow: https://stackoverflow.com/questions/65474950/disable-buttons-and-show-hourglass-over-row-htmx
  • m

    millions-apartment-38225

    12/28/2020, 9:09 AM
    @User https://htmx.org/attributes/hx-indicator/ should be what you are looking for
  • s

    salmon-xylophone-28580

    12/28/2020, 4:23 PM
    thank you for the link to the hx-indicator docs. I think a
    htmx-request-target
    class on the hx-target element would be great. I created a feature request: https://github.com/bigskysoftware/htmx/issues/290 What do you think?
  • g

    gorgeous-ghost-95789

    12/28/2020, 4:54 PM
    WHILE
    is a fantastic, brilliant idea for Hyperscript. I can't wait to start using it ;) If you're looking for some head-spinning inspiration on this, here's a great (tangentially-related) article by the original creator of Go: https://commandcenter.blogspot.com/2014/01/self-referential-functions-and-design.html He shows how to make functions that 1) perform an action, then 2) return another function that undoes the action. The larger context of his article is also pretty interesting. I thought that this do/undo feature might spark some ideas for htmx, too.
  • p

    powerful-evening-99811

    12/28/2020, 5:38 PM
    article link?
  • g

    gorgeous-ghost-95789

    12/28/2020, 5:46 PM
    Oops, I thought I included it. One sec.
  • g

    gorgeous-ghost-95789

    12/28/2020, 5:47 PM
    Here's the original article: https://commandcenter.blogspot.com/2014/01/self-referential-functions-and-design.html There is lots of commentary on it, too, if you search for "Rob Pike Self-Referential Function Parameters"
  • m

    mysterious-toddler-20573

    12/29/2020, 9:25 PM
    @User what you can't read my mind?
  • m

    mysterious-toddler-20573

    12/29/2020, 9:25 PM
    https://github.com/bigskysoftware/htmx/blob/20436f243c46df4e3965cb4a90c8a1941e70b25a/src/htmx.js#L1836
  • m

    mysterious-toddler-20573

    12/29/2020, 9:25 PM
    commented on the ticket, you can pass in a swap handler
  • m

    mysterious-toddler-20573

    12/29/2020, 9:25 PM
    and make it a no-op for your case
  • m

    mysterious-toddler-20573

    12/29/2020, 9:25 PM
    ๐Ÿ™‚
  • h

    helpful-secretary-3515

    12/29/2020, 9:44 PM
    I am considering using htmx-swaps/modals for an e-commerce site for product pages. the product page will come as an overlay/modal when you click on the product). Those โ€œproduct overlaysโ€ will also be accessible directly with own URL (if need to be linked to for ex.).
  • h

    helpful-secretary-3515

    12/29/2020, 9:44 PM
    1. should i take more care on creating more "URLs" / new pages, to have better SEO result?
  • h

    helpful-secretary-3515

    12/29/2020, 9:45 PM
    2. or just shid on all that , and go on focusing on the most valuable : A HAPPY USER. that have less delays, more fun . (and btw, all with the help of django and HTMX !!!). i fall in love with htmx ๐Ÿ™‚
  • h

    helpful-secretary-3515

    12/29/2020, 10:10 PM
    or to come to the point. is the code that get swapped by HTMX, crawlable by google,etc?!
  • h

    helpful-secretary-3515

    12/29/2020, 10:10 PM
    asking google , i get this result:
  • h

    helpful-secretary-3515

    12/29/2020, 10:10 PM
    in terms of SEO, client-side rendering is a problem, as Google bots don't get any content or get a little content they can't index properly. With server-side rendering, browsers and Google bots get HTML files with all the content. Google bots can index the page properly and rank it higher
  • m

    mysterious-toddler-20573

    12/29/2020, 10:58 PM
    I don't know django very well, but you can assign a URL to a given product and then offer up different HTML based on if the request is from HTMX or a normal web request, by checking the
    HX-Request
    header: https://htmx.org/reference/#request_headers
1...113114115...1146Latest