Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If it's well thought out, sure, why not. But the examples in the HTMX docs for me are mostly not as simple as common HTML attributes.

E.g. these are examples for what I meant by "DSL in HTML attributes":

    <input type="text" name="q"
        hx-get="/trigger_delay"
        hx-trigger="keyup changed delay:500ms"
        hx-target="#search-results"
        placeholder="Search..."
    >
    <div id="search-results"></div>

In the end, of course, standardized HTML has DSLs in attributes too (e.g. srcset, sizes...).

Using the word "magic" might have been a bit snarky, that's always a question of definition.

I meant that the behavior is neither standardized nor simple code that can be read as such. With Alpine it's the same, it's code in HTML attributes, but not all regular JS rules apply.

The first example for the transition from the release notes is another one:

    <div class="sample-transition">
       <h1>Initial Content</h1>
       <button hx-get="/new-content" 
               hx-swap="innerHTML transition:true"
               hx-target="closest div">
         Swap It!
       </button>
    </div>
Strings like "innerHTML transition:true" or "closest div" and the whole thing in combination are just not too much my taste, and I find that this is not really simpler than just writing JS.

But I can see how it fills a niche and I don't want to argue against this idea as such.

Just the presentation I can't understand.

HTMX is not an "extension of HTML" for my understanding, it's a JS lib that parses non-standard attributes using a DSL. Doesn't need to be bad.

Regarding the "download" attribute: I love it too, and I always love when I find out I can do something easily in HTML and CSS without using JS. Similar example, maybe not useful so often: the form attribute.



> E.g. these are examples for what I meant by "DSL in HTML attributes"

It's a DSL, sure, I won't argue about that. Matter of taste I guess, but I actually find this example you posted super easy to read, even the hx-trigger value. That's precisely what I like about HTMX: you get quite a lot done in a few attributes, while still remaining very readable. If the attributes value is too complicated or too long (ie. difficult to read), I would probably rewrite the logic in a simple JS function anyway.

> I always love when I find out I can do something easily in HTML and CSS without using JS

Ditto. When I wanted to play a media, it used to be some bad combination of flash object with JS bindings... now it's just a single audio and video tag. What a time to be alive...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: