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

Method resolve

www/js/_hyperscript.js:5907–5927  ·  view source on GitHub ↗
(ctx, { expr, constructorArgs } = {})

Source from the content-addressed store, hash-verified

5905 }
5906 }
5907 resolve(ctx, { expr, constructorArgs } = {}) {
5908 if (this.variant === "queryRef") {
5909 var match, tagname = "div", id, classes = [];
5910 var re = /(?:(^|#|\.)([^#\. ]+))/g;
5911 while (match = re.exec(this.expr.css)) {
5912 if (match[1] === "") tagname = match[2].trim();
5913 else if (match[1] === "#") id = match[2].trim();
5914 else classes.push(match[2].trim());
5915 }
5916 var result = document.createElement(tagname);
5917 if (id !== void 0) result.id = id;
5918 result.classList.add(...classes);
5919 ctx.result = result;
5920 } else {
5921 ctx.result = new expr(...constructorArgs);
5922 }
5923 if (this.target) {
5924 ctx.meta.runtime.setSymbol(this.target.name, ctx, this.target.scope, ctx.result);
5925 }
5926 return this.findNext(ctx);
5927 }
5928 };
5929 var AppendCommand = class _AppendCommand extends Command {
5930 static keyword = "append";

Callers

nothing calls this directly

Calls 2

setSymbolMethod · 0.45
findNextMethod · 0.45

Tested by

no test coverage detected