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

Method resolve

www/js/_hyperscript-max.js:6707–6762  ·  view source on GitHub ↗
(context, { root, prop, value: valueToPut })

Source from the content-addressed store, hash-verified

6705 }
6706 }
6707 resolve(context, { root, prop, value: valueToPut }) {
6708 if (this.symbolWrite) {
6709 this.putInto(context, root, prop, valueToPut);
6710 } else {
6711 context.meta.runtime.nullCheck(root, this.rootExpr);
6712 if (this.operation === "into") {
6713 if (this.attributeWrite) {
6714 context.meta.runtime.implicitLoop(root, function(elt) {
6715 if (valueToPut == null) {
6716 elt.removeAttribute(prop);
6717 } else {
6718 elt.setAttribute(prop, valueToPut);
6719 }
6720 });
6721 } else if (this.styleWrite) {
6722 context.meta.runtime.implicitLoop(root, function(elt) {
6723 elt.style[prop] = valueToPut;
6724 });
6725 } else if (this.arrayIndex) {
6726 root[prop] = valueToPut;
6727 } else {
6728 var cmd = this;
6729 context.meta.runtime.implicitLoop(root, function(elt) {
6730 cmd.putInto(context, elt, prop, valueToPut);
6731 });
6732 }
6733 } else if (Array.isArray(root)) {
6734 if (this.operation === "start") {
6735 root.unshift(valueToPut);
6736 } else {
6737 root.push(valueToPut);
6738 }
6739 context.meta.runtime.notifyMutation(root);
6740 } else {
6741 var ops = {
6742 before: Element.prototype.before,
6743 after: Element.prototype.after,
6744 start: Element.prototype.prepend,
6745 end: Element.prototype.append
6746 };
6747 var op = ops[this.operation] || Element.prototype.append;
6748 context.meta.runtime.implicitLoop(root, function(elt) {
6749 op.call(
6750 elt,
6751 valueToPut instanceof Node ? valueToPut : context.meta.runtime.convertValue(valueToPut, "Fragment")
6752 );
6753 if (elt.parentElement) {
6754 context.meta.runtime.processNode(elt.parentElement);
6755 } else {
6756 context.meta.runtime.processNode(elt);
6757 }
6758 });
6759 }
6760 }
6761 return this.findNext(context);
6762 }
6763 };
6764

Callers

nothing calls this directly

Calls 7

putIntoMethod · 0.95
nullCheckMethod · 0.45
implicitLoopMethod · 0.45
notifyMutationMethod · 0.45
convertValueMethod · 0.45
processNodeMethod · 0.45
findNextMethod · 0.45

Tested by

no test coverage detected