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

Function _copyAttributes

src/core/runtime/morph.js:194–209  ·  view source on GitHub ↗
(destination, source)

Source from the content-addressed store, hash-verified

192}
193
194function _copyAttributes(destination, source) {
195 for (var attr of source.attributes) {
196 if (destination.getAttribute(attr.name) !== attr.value) {
197 destination.setAttribute(attr.name, attr.value);
198 if (attr.name === "value" && destination instanceof HTMLInputElement && destination.type !== "file") {
199 destination.value = attr.value;
200 }
201 }
202 }
203 for (var i = destination.attributes.length - 1; i >= 0; i--) {
204 var attr = destination.attributes[i];
205 if (attr && !source.hasAttribute(attr.name)) {
206 destination.removeAttribute(attr.name);
207 }
208 }
209}
210
211function _isSoftMatch(oldNode, newNode) {
212 if (!(oldNode instanceof Element) || oldNode.tagName !== newNode.tagName) return false;

Callers 2

morphMethod · 0.70
_morphNodeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected