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

Function _morphNode

www/js/_hyperscript-max.js:3624–3634  ·  view source on GitHub ↗
(oldNode, newNode, ctx)

Source from the content-addressed store, hash-verified

3622 }
3623 }
3624 function _morphNode(oldNode, newNode, ctx) {
3625 if (!(oldNode instanceof Element)) return;
3626 _copyAttributes(oldNode, newNode);
3627 if (oldNode instanceof HTMLTextAreaElement && oldNode.defaultValue !== newNode.defaultValue) {
3628 oldNode.value = newNode.value;
3629 }
3630 if (!oldNode.isEqualNode(newNode) || newNode.tagName === "TEMPLATE" || newNode.querySelector?.("template")) {
3631 _morphChildren(ctx, oldNode, newNode);
3632 }
3633 ctx.callbacks.afterNodeMorphed?.(oldNode);
3634 }
3635 function _findBestMatch(ctx, node, startPoint, endPoint) {
3636 if (!(node instanceof Element)) return null;
3637 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