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

Method resolve

tools/common/_hyperscript.iife.js:7411–7489  ·  view source on GitHub ↗
(context, { element, classRefs, css, from })

Source from the content-addressed store, hash-verified

7409 }
7410 }
7411 resolve(context, { element, classRefs, css, from }) {
7412 var runtime2 = context.meta.runtime;
7413 var cmd = this;
7414 var result;
7415 if (this.variant === "element") {
7416 runtime2.nullCheck(element, this.elementExpr);
7417 if (from != null && Array.isArray(from)) {
7418 var idx = from.indexOf(element);
7419 if (idx > -1) from.splice(idx, 1);
7420 runtime2.notifyMutation(from);
7421 } else if (from instanceof Set) {
7422 from.delete(element);
7423 runtime2.notifyMutation(from);
7424 } else if (from instanceof Map) {
7425 from.delete(element);
7426 runtime2.notifyMutation(from);
7427 } else {
7428 runtime2.implicitLoop(element, function(target) {
7429 if (target.parentElement && (from == null || from.contains(target))) {
7430 target.parentElement.removeChild(target);
7431 }
7432 });
7433 }
7434 } else if (this.variant === "css") {
7435 runtime2.nullCheck(from, this.fromExpr);
7436 var propNames = _cssPropertyNames(css);
7437 runtime2.implicitLoop(from, function(target) {
7438 _removeCssProperties(target, propNames);
7439 });
7440 } else {
7441 runtime2.nullCheck(from, this.fromExpr);
7442 if (classRefs) {
7443 runtime2.forEach(classRefs, function(classRef) {
7444 if (cmd.when) {
7445 result = runtime2.implicitLoopWhen(
7446 from,
7447 cmd.when,
7448 context,
7449 function(t) {
7450 t.classList.remove(classRef.className);
7451 },
7452 function(t) {
7453 t.classList.add(classRef.className);
7454 }
7455 );
7456 } else {
7457 runtime2.implicitLoop(from, function(t) {
7458 t.classList.remove(classRef.className);
7459 });
7460 }
7461 });
7462 } else {
7463 var attributeRef = this.attributeRef;
7464 if (this.when) {
7465 result = runtime2.implicitLoopWhen(
7466 from,
7467 this.when,
7468 context,

Callers

nothing calls this directly

Calls 10

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

Tested by

no test coverage detected