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

    future-boots-43048

    12/09/2020, 11:49 PM
    My project is very much a framework at the moment, but I've got some cunning ideas to make it look more like a library and give back a feeling of freedom to the user.... the more library-like it is, the more it feels like people will be able to incorporate it into their solution without it getting in the way.
  • b

    billions-rain-29850

    12/10/2020, 8:45 AM
    I can't argue with that. For example for PHP world I'm sure Symfony's dicision on Stimulus and https://github.com/symfony/ux is well investigated. I've just said, I could not reach my goals with it, but it's absolutly about my use cases and my small-scale one-man-show hobby projects.
  • s

    salmon-xylophone-28580

    12/10/2020, 12:42 PM
    Is there something in htmx like [up-expand] in unpoly? Add an [up-expand] attribute to any element to enlarge the click area of a descendant link.
    Copy code
    <div class="notification" up-expand>
      Record was saved!
      <a href="/records">Close</a>
    </div>
    . See https://unpoly.com/up-expand
  • l

    lively-beach-14291

    12/10/2020, 2:14 PM
    @User There's an inherent scope question here. Does
    up-expand
    involve interacting with the server? or is it specialized behaviors local only to the browser?
  • l

    lively-beach-14291

    12/10/2020, 2:17 PM
    I think, and @mysterious-toddler-20573 could correct me, that interactivity things (that don't involve client/server glue) are destined to be part of https://hyperscript.org so that there is a separation of concerns. That said, this line is hard to discover & cleanly articulate ...
  • m

    mysterious-toddler-20573

    12/10/2020, 2:19 PM
    up-expand
    isn't needed in htmx, you would place the
    hx-get
    on the parent element instead:
    Copy code
    html
    <div class="notification" hx-get='/records'>
      Record was saved!
      <a>Close</a>
    </div>
  • s

    salmon-xylophone-28580

    12/10/2020, 2:51 PM
    Thank you for sharing your wisdom. Yes, you are right. up-expand is not about interacting with the server. Now I realized that the tag can contain everything (this was different in the past). The simple solution is to wrap the whole div in a .
  • l

    lively-beach-14291

    12/10/2020, 2:54 PM
    I think htmx semantics treat almost anything as an clickable element. You may not want the formatting that comes with ?
  • l

    lively-beach-14291

    12/10/2020, 2:54 PM
    I'm a newbie here, don't mistake my writing for wisdom
  • w

    wonderful-summer-65517

    12/10/2020, 2:57 PM
    Hi! I tried to return multiple elements with
    hx-swap-oob="true"
    , but I get
    htmx:swapError
    . What can cause this? Only one (top level) element can have the hx-swap-oob attribute? If not, could you please show me an example, where multiple elements are out of bound swapped?
  • w

    wonderful-summer-65517

    12/10/2020, 3:05 PM
    If I return only one element in the ajax response, then it works
  • m

    mysterious-toddler-20573

    12/10/2020, 3:39 PM
    Right now hx-swap-oob must be on top level elements
  • m

    mysterious-toddler-20573

    12/10/2020, 3:39 PM
    that's probably a bad limitation
  • m

    mysterious-toddler-20573

    12/10/2020, 3:39 PM
    multiple top level oob elements should work, however
  • m

    mysterious-toddler-20573

    12/10/2020, 3:40 PM
    unless there is a bug, which is impossible since I'm such a great programmer
  • m

    mysterious-toddler-20573

    12/10/2020, 3:40 PM
    😑
  • w

    wonderful-summer-65517

    12/10/2020, 3:42 PM
    One of my elements is a
    tr
    , the other one is a
    span
    There must be a bug, because if I return only one, it works. But if I return both, then the result of makeFragment is nonsense
  • m

    mysterious-toddler-20573

    12/10/2020, 3:43 PM
    Ah, yeah
  • w

    wonderful-summer-65517

    12/10/2020, 3:43 PM
    Both of them are top level elements
  • m

    mysterious-toddler-20573

    12/10/2020, 3:43 PM
    trs are a nightmare
  • m

    mysterious-toddler-20573

    12/10/2020, 3:43 PM
    we have special logic to make fragments work when you return a tr
  • m

    mysterious-toddler-20573

    12/10/2020, 3:44 PM
    If you return the tr first, it might work
  • m

    mysterious-toddler-20573

    12/10/2020, 3:44 PM
    :/
  • w

    wonderful-summer-65517

    12/10/2020, 3:44 PM
    Unfortunately, it does not :/
  • w

    wonderful-summer-65517

    12/10/2020, 3:45 PM
    By the way this is a great library. This is the only bug/problem I encountered so far 🙂
  • m

    mysterious-toddler-20573

    12/10/2020, 3:46 PM
    OK, can you open a github issue on oob trs ?
  • w

    wonderful-summer-65517

    12/10/2020, 3:47 PM
    Sure, I will open an issue. But now, I have to find a workaround, because I have to finish this work by tomorrow. Maybe I split the responseText in two in selectAndSwap, and call makeFragment twice, or something
  • l

    lively-beach-14291

    12/10/2020, 3:53 PM
    @mysterious-toddler-20573 this is all due to quirks mode parsing and nonsense?
  • l

    lively-beach-14291

    12/10/2020, 3:54 PM
    There is "reparenting" logic for tr as I recall...
  • m

    mysterious-toddler-20573

    12/10/2020, 3:54 PM
    it boils down to some elements not parsing at the top level: https://github.com/bigskysoftware/htmx/blob/564d4eb6519ad5a6e1a39af8a8b2dd02ef19d8ac/src/htmx.js#L148
1...919293...1146Latest