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

Method resolve

www/js/_hyperscript.esm.js:7815–7906  ·  view source on GitHub ↗
(context, { element, classRefs, css, from })

Source from the content-addressed store, hash-verified

7813 }
7814 }
7815 resolve(context, { element, classRefs, css, from }) {
7816 var runtime2 = context.meta.runtime;
7817 var cmd = this;
7818 var result;
7819 if (this.variant === "element") {
7820 if (from == null && typeof this.elementExpr.delete === "function") {
7821 var isDomTarget = this.isDOMTarget(element);
7822 if (!isDomTarget) {
7823 var lhsExprs = this.elementExpr.lhs;
7824 var lhs = {};
7825 for (var key in lhsExprs) {
7826 var sub = lhsExprs[key];
7827 lhs[key] = sub && sub.evaluate ? sub.evaluate(context) : sub;
7828 }
7829 this.elementExpr.delete(context, lhs);
7830 return this.findNext(context);
7831 }
7832 }
7833 runtime2.nullCheck(element, this.elementExpr);
7834 if (from != null && Array.isArray(from)) {
7835 var idx = from.indexOf(element);
7836 if (idx > -1) from.splice(idx, 1);
7837 runtime2.notifyMutation(from);
7838 } else if (from instanceof Set) {
7839 from.delete(element);
7840 runtime2.notifyMutation(from);
7841 } else if (from instanceof Map) {
7842 from.delete(element);
7843 runtime2.notifyMutation(from);
7844 } else {
7845 runtime2.implicitLoop(element, function(target) {
7846 if (target.parentElement && (from == null || from.contains(target))) {
7847 target.parentElement.removeChild(target);
7848 }
7849 });
7850 }
7851 } else if (this.variant === "css") {
7852 runtime2.nullCheck(from, this.fromExpr);
7853 var propNames = _cssPropertyNames(css);
7854 runtime2.implicitLoop(from, function(target) {
7855 _removeCssProperties(target, propNames);
7856 });
7857 } else {
7858 runtime2.nullCheck(from, this.fromExpr);
7859 if (classRefs) {
7860 runtime2.forEach(classRefs, function(classRef) {
7861 if (cmd.when) {
7862 result = runtime2.implicitLoopWhen(
7863 from,
7864 cmd.when,
7865 context,
7866 function(t) {
7867 t.classList.remove(classRef.className);
7868 },
7869 function(t) {
7870 t.classList.add(classRef.className);
7871 }
7872 );

Callers

nothing calls this directly

Calls 12

isDOMTargetMethod · 0.95
_cssPropertyNamesFunction · 0.70
_removeCssPropertiesFunction · 0.70
evaluateMethod · 0.45
deleteMethod · 0.45
findNextMethod · 0.45
nullCheckMethod · 0.45
notifyMutationMethod · 0.45
implicitLoopMethod · 0.45
containsMethod · 0.45
forEachMethod · 0.45
implicitLoopWhenMethod · 0.45

Tested by

no test coverage detected