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

    brainy-ice-92385

    10/08/2022, 6:55 AM
    > some special HTML element with the ID "htmx-extras" as the last element in the . This sounds like it would fit nicely as a special case of OOB-swap
  • m

    mysterious-toddler-20573

    10/08/2022, 6:15 PM
    I got a bug and implemented a playground verison of the algorithm I have in mind: https://github.com/bigskysoftware/htmx/blob/3506ecfb6a12c995871c2c02b35a481825930a10/test/merge-head-scratch.html#L22
  • m

    mysterious-toddler-20573

    10/08/2022, 6:16 PM
    basically a modification of the existing logic to get the title tag out, coupled w/ the child-syncing logic @brainy-ice-92385 suggested
  • m

    mysterious-toddler-20573

    10/08/2022, 6:16 PM
    I use
    outerHTML
    , which is grug-brain but works
  • m

    mysterious-toddler-20573

    10/08/2022, 6:17 PM
    I played around with it locally and it appears to work pretty well. This is an important enough change that I'm going to hold off on the next release of htmx to see if I can convinced myself this works, and maybe include it.
  • m

    mysterious-toddler-20573

    10/08/2022, 6:18 PM
    We will need events for all the add/removes that occur, but I like the look of this. Coupled w/ idiomorph, should be a nice combo.
  • b

    brainy-ice-92385

    10/08/2022, 6:39 PM
    Just had an interesting thought which is to send a remove event to a script tag itself. Then de-init code could listen for removal event on its container script tag. Have't thought it through much but it's fun
  • m

    mysterious-toddler-20573

    10/08/2022, 6:43 PM
    Yep exactly we are on the same page
  • m

    mysterious-toddler-20573

    10/08/2022, 7:24 PM
    now I'm wondering how to support this
  • m

    mysterious-toddler-20573

    10/08/2022, 7:24 PM
    Right now we support a title tag in the content
  • m

    mysterious-toddler-20573

    10/08/2022, 7:26 PM
    it seems to me like people would want two different use cases for a
    <head>
    tag: * You are getting a full html document response (e.g. a boosted link, or you are using hx-select) and you want to synchronize the current head element w/ the new one * You are returning a partial, but you want to jam some additional stuff up in the
    head
    element
  • m

    mysterious-toddler-20573

    10/08/2022, 7:27 PM
    thinking if you mark the head as
    hx-swap-oob='beforeend'
    we will do the latter behavior
  • m

    mysterious-toddler-20573

    10/08/2022, 7:27 PM
    does this sound right?
  • m

    mysterious-toddler-20573

    10/08/2022, 7:37 PM
    also want a way to mark stuff as preserved, in case it's added dynamically
  • b

    brainy-ice-92385

    10/08/2022, 7:57 PM
    Struggling a bit with the swap oob case. If they're merged, does that mean if you want to make any change to the head, that you will have to send an entire head that is mostly the same to prevent things being wrongly removed? Does that make sense - I can rephrase
  • b

    brainy-ice-92385

    10/08/2022, 8:00 PM
    For that case, it would be useful if you could nest some chunk of the head in a semantically uninteresting element like a div, just to mark that as the "volatile set of stuff that we might want to merge changes into" and keep stuff that never changes, like the meta viewport or base css out of that. But that's probably too complicated an idea (is it even possible, idk)
  • b

    brainy-ice-92385

    10/08/2022, 8:08 PM
    On second thought your marking as preserved idea makes a lot more sense heh
  • m

    mysterious-toddler-20573

    10/08/2022, 8:08 PM
    I'm thinking the "here is a whole page, replace the head" case vs. the "here is a partial bit of HTML, and some stuff to jam in the head" case
  • b

    brainy-ice-92385

    10/08/2022, 8:10 PM
    Yes those two cases make sense. For the latter, you could just make a special case of "If you provide a tag at the top level of a response, we will treat it as this special case of oob-swap with the special merge"
  • m

    mysterious-toddler-20573

    10/08/2022, 9:04 PM
    so "If there is an in the response, we sync, if not, we merge?"
  • m

    mysterious-toddler-20573

    10/08/2022, 9:04 PM
    maybe a little too magic?
  • m

    mysterious-toddler-20573

    10/08/2022, 9:04 PM
    Just wondering if we want to give people something explicit
  • b

    brainy-ice-92385

    10/08/2022, 10:59 PM
    I think a at the top level would be a non-magic signal that this is a fragment, not a whole page
  • b

    brainy-ice-92385

    10/08/2022, 11:00 PM
    at the top level having meaning does not seem too magic to me
  • b

    brainy-ice-92385

    10/08/2022, 11:01 PM
    like, obv it is magic but it's not too magic IMO because those things align with the spirit of HTML. Maybe a top-level htmx config could opt in or out of that behavior
  • b

    brainy-ice-92385

    10/08/2022, 11:03 PM
    Put another way, what else could those elements as top-level mean?
  • c

    cuddly-keyboard-70746

    10/09/2022, 1:04 AM
    merge seems too much complexity...
  • c

    cuddly-keyboard-70746

    10/09/2022, 1:04 AM
    not to implement but just the concept of htmx i general... in my mind it is supposed to be stupid simple
  • c

    cuddly-keyboard-70746

    10/09/2022, 1:06 AM
    I know that may clash with people seeking to write pure html instead of generating it but idk I think htmx may get to complex if it plans to support merging (which is really avoiding templates or other generation mechanism)
  • c

    cuddly-keyboard-70746

    10/09/2022, 1:07 AM
    i dont think the prescense or absence of html tag should do anything at all
1...848849850...1146Latest