Both panels re-fetch the same fragment every four seconds. Type into either
field and watch what survives the swap. The left uses the default
innerHTML swap; the right uses the morph plugin.
The target’s children are replaced. Input state dies with them.
Matching nodes are reused. Typed text, focus, and selection stay.
The server keeps changing the field’s value attribute. On the right,
the input node is reused, so the browser keeps what you typed. On the left, the
input is thrown away and rebuilt from the response.
/demo/morph.minu-swap="morph".id, position, and tag, then updates attributes and text in place.minu.init() so the first load already uses morph.<div minu-get="/demo/morph"
minu-trigger="every 4s"
minu-swap="morph"></div>
<script src="../../dist/minu.min.js"></script>
<script src="../../dist/minu.morph.min.js"></script>
<script>
minu.registerSwap('morph', minuMorph);
minu.init();
</script>
The plugin is separate from the core build. See the migration guide and the other swap modes.