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

Method resolve

tools/common/_hyperscript.iife.js:8044–8079  ·  view source on GitHub ↗
(ctx, { target })

Source from the content-addressed store, hash-verified

8042 return new _EmptyCommand(target);
8043 }
8044 resolve(ctx, { target }) {
8045 var elt = target || ctx.me;
8046 if (Array.isArray(elt)) {
8047 elt.splice(0);
8048 ctx.meta.runtime.notifyMutation(elt);
8049 } else if (elt instanceof Set || elt instanceof Map) {
8050 elt.clear();
8051 ctx.meta.runtime.notifyMutation(elt);
8052 } else {
8053 ctx.meta.runtime.implicitLoop(elt, function(e) {
8054 var tag = e.tagName;
8055 if (tag === "INPUT") {
8056 if (e.type === "checkbox" || e.type === "radio") e.checked = false;
8057 else e.value = "";
8058 } else if (tag === "TEXTAREA") {
8059 e.value = "";
8060 } else if (tag === "SELECT") {
8061 e.selectedIndex = -1;
8062 } else if (tag === "FORM") {
8063 e.querySelectorAll("input, textarea, select").forEach(function(inp) {
8064 if (inp.tagName === "INPUT") {
8065 if (inp.type === "checkbox" || inp.type === "radio") inp.checked = false;
8066 else inp.value = "";
8067 } else if (inp.tagName === "TEXTAREA") {
8068 inp.value = "";
8069 } else if (inp.tagName === "SELECT") {
8070 inp.selectedIndex = -1;
8071 }
8072 });
8073 } else {
8074 e.replaceChildren();
8075 }
8076 });
8077 }
8078 return this.findNext(ctx);
8079 }
8080 };
8081 var ResetCommand = class _ResetCommand extends Command {
8082 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