3 ms·
at the end of the day morphdom (and my own algorithm, idiomorph) can only do so much, because the current DOM APIs nuke much of the state of nodes when they dis
by recursivedoubts 2y ago
at the end of the day morphdom (and my own algorithm, idiomorph) can only do so much, because the current DOM APIs nuke much of the state of nodes when they disconnect from the DOM
if you look at the algorithms they give up very quickly and simply merge the new nodes in once matching doesn't work at a certain level because of this
there is a new API coming down the pipe, moveBefore(), that will allow much better morphing/preservation in general:
https://github.com/noamr/dom/blob/spm-explainer/moveBefore-explainer.md https://github.com/noamr/dom/blob/spm-explainer/moveBefore-e...
htmx supports it today if you enable it in chrome canary:
https://htmx.org/examples/move-before/ https://htmx.org/examples/move-before/