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

Function _copyAttributes

www/js/_hyperscript-max.js:3687–3702  ·  view source on GitHub ↗
(destination, source)

Source from the content-addressed store, hash-verified

3685 parentNode.insertBefore(element, after);
3686 }
3687 function _copyAttributes(destination, source) {
3688 for (var attr of source.attributes) {
3689 if (destination.getAttribute(attr.name) !== attr.value) {
3690 destination.setAttribute(attr.name, attr.value);
3691 if (attr.name === "value" && destination instanceof HTMLInputElement && destination.type !== "file") {
3692 destination.value = attr.value;
3693 }
3694 }
3695 }
3696 for (var i = destination.attributes.length - 1; i >= 0; i--) {
3697 var attr = destination.attributes[i];
3698 if (attr && !source.hasAttribute(attr.name)) {
3699 destination.removeAttribute(attr.name);
3700 }
3701 }
3702 }
3703 function _isSoftMatch(oldNode, newNode) {
3704 if (!(oldNode instanceof Element) || oldNode.tagName !== newNode.tagName) return false;
3705 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