MCPcopy Index your code
hub / github.com/bigskysoftware/_hyperscript / _morphNode

Function _morphNode

www/js/_hyperscript.js:3625–3635  ·  view source on GitHub ↗
(oldNode, newNode, ctx)

Source from the content-addressed store, hash-verified

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