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

Method resolve

www/js/_hyperscript.esm.js:8492–8527  ·  view source on GitHub ↗
(ctx, { target })

Source from the content-addressed store, hash-verified

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