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

Method resolve

www/js/_hyperscript-max.js:8493–8528  ·  view source on GitHub ↗
(ctx, { target })

Source from the content-addressed store, hash-verified

8491 return new _EmptyCommand(target);
8492 }
8493 resolve(ctx, { target }) {
8494 var elt = target || ctx.me;
8495 if (Array.isArray(elt)) {
8496 elt.splice(0);
8497 ctx.meta.runtime.notifyMutation(elt);
8498 } else if (elt instanceof Set || elt instanceof Map) {
8499 elt.clear();
8500 ctx.meta.runtime.notifyMutation(elt);
8501 } else {
8502 ctx.meta.runtime.implicitLoop(elt, function(e) {
8503 var tag = e.tagName;
8504 if (tag === "INPUT") {
8505 if (e.type === "checkbox" || e.type === "radio") e.checked = false;
8506 else e.value = "";
8507 } else if (tag === "TEXTAREA") {
8508 e.value = "";
8509 } else if (tag === "SELECT") {
8510 e.selectedIndex = -1;
8511 } else if (tag === "FORM") {
8512 e.querySelectorAll("input, textarea, select").forEach(function(inp) {
8513 if (inp.tagName === "INPUT") {
8514 if (inp.type === "checkbox" || inp.type === "radio") inp.checked = false;
8515 else inp.value = "";
8516 } else if (inp.tagName === "TEXTAREA") {
8517 inp.value = "";
8518 } else if (inp.tagName === "SELECT") {
8519 inp.selectedIndex = -1;
8520 }
8521 });
8522 } else {
8523 e.replaceChildren();
8524 }
8525 });
8526 }
8527 return this.findNext(ctx);
8528 }
8529 };
8530 var ResetCommand = class _ResetCommand extends Command {
8531 static keyword = "reset";

Callers

nothing calls this directly

Calls 4

notifyMutationMethod · 0.45
implicitLoopMethod · 0.45
forEachMethod · 0.45
findNextMethod · 0.45

Tested by

no test coverage detected