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

Function _copyAttributes

www/js/_hyperscript.js:3688–3703  ·  view source on GitHub ↗
(destination, source)

Source from the content-addressed store, hash-verified

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