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

Function _copyAttributes

tools/common/_hyperscript.iife.js:3528–3543  ·  view source on GitHub ↗
(destination, source)

Source from the content-addressed store, hash-verified

3526 parentNode.insertBefore(element, after);
3527 }
3528 function _copyAttributes(destination, source) {
3529 for (var attr of source.attributes) {
3530 if (destination.getAttribute(attr.name) !== attr.value) {
3531 destination.setAttribute(attr.name, attr.value);
3532 if (attr.name === "value" && destination instanceof HTMLInputElement && destination.type !== "file") {
3533 destination.value = attr.value;
3534 }
3535 }
3536 }
3537 for (var i = destination.attributes.length - 1; i >= 0; i--) {
3538 var attr = destination.attributes[i];
3539 if (attr && !source.hasAttribute(attr.name)) {
3540 destination.removeAttribute(attr.name);
3541 }
3542 }
3543 }
3544 function _isSoftMatch(oldNode, newNode) {
3545 if (!(oldNode instanceof Element) || oldNode.tagName !== newNode.tagName) return false;
3546 if (oldNode.tagName === "SCRIPT" && !oldNode.isEqualNode(newNode)) return false;

Callers 2

morphMethod · 0.70
_morphNodeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected