bigskysoftware / idiomorph

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

Force complete replacement of a node and its children #13

Closed davidjr82 closed 10 months ago

davidjr82 commented 10 months ago

I am using htmx.

I have one ul with 2 li inside. The first one has hx-* attributes on it and the second one doesn't:

<ul>
    <li hx-get="..."><svg first></svg></li>
    <li><svg second></svg></li>
</ul>

When I make an htmx request, I have the li in the response with a different position. My problem is that idiomorph is mixing the hx-* attributes from the first one into the second (that after the request is the first one):

<ul>
    <li hx-get="..."><svg second></svg></li>
    <li><svg first></svg></li>
</ul>

Is there any way to say to idiomorph to fully re-render the complete ul? I have tried to add a random id on the ul (different in each request), and on the li, but I have the same problem.

Thanks!

davidjr82 commented 10 months ago

I just wrapped the svg into a div in the second li and now works fine, thanks!