bigskysoftware / idiomorph

A DOM-merging algorithm
BSD 2-Clause "Simplified" License
631 stars 31 forks source link

question: passing options parameter via hx-swap #17

Closed GlennWSo closed 6 months ago

GlennWSo commented 7 months ago

I would like set the ignoreActiveValue option to true for a hx-swap attribute.

is it possible to declare these options when using htmx attributes, and if so how?

example

hx-swap="morph:outerHTML:ignoreActiveValue"

even more context

<div  hx-target="this" hx-swap="morph:outerHTML:ignoreActiveValue">
    <label for="name">Name</label>
    <input id="name" name="name" type="text" placeholder="Alice" hx-post="./name/validate" hx-params="*" 
        hx-trigger="change, keyup delay:350ms changed, htmx:validation:validate"></input>
     <span hidden">name is too short</span></div>
1cg commented 6 months ago

This is now possible in idiomorph 0.2:

https://github.com/bigskysoftware/idiomorph?tab=readme-ov-file#configuring-morphing-behavior-in-htmx

And you can also set defaults:

https://github.com/bigskysoftware/idiomorph?tab=readme-ov-file#setting-defaults