2 ms·
> Even morphdom overwrites some things you’d expect it not to, so we had to patch it to avoid messing with input elements, and details elements. Would love to
by ricardobeat 2y ago
> Even morphdom overwrites some things you’d expect it not to, so we had to patch it to avoid messing with input elements, and details elements.
Would love to hear more about this issue. Preserving the state of elements like input or detail is the main function of libraries like morphdom, something must have gone wrong there.
- recursivedoubts 2y agoat 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/