MCPcopy Create free account
hub / github.com/bigskysoftware/_hyperscript / _morphNode

Function _morphNode

www/js/_hyperscript.esm.js:3623–3633  ·  view source on GitHub ↗
(oldNode, newNode, ctx)

Source from the content-addressed store, hash-verified

3621 }
3622}
3623function _morphNode(oldNode, newNode, ctx) {
3624 if (!(oldNode instanceof Element)) return;
3625 _copyAttributes(oldNode, newNode);
3626 if (oldNode instanceof HTMLTextAreaElement && oldNode.defaultValue !== newNode.defaultValue) {
3627 oldNode.value = newNode.value;
3628 }
3629 if (!oldNode.isEqualNode(newNode) || newNode.tagName === "TEMPLATE" || newNode.querySelector?.("template")) {
3630 _morphChildren(ctx, oldNode, newNode);
3631 }
3632 ctx.callbacks.afterNodeMorphed?.(oldNode);
3633}
3634function _findBestMatch(ctx, node, startPoint, endPoint) {
3635 if (!(node instanceof Element)) return null;
3636 var softMatch = null, displaceMatchCount = 0, scanLimit = 10;

Callers 1

_morphChildrenFunction · 0.70

Calls 2

_copyAttributesFunction · 0.70
_morphChildrenFunction · 0.70

Tested by

no test coverage detected