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

Method resolve

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

setSymbolMethod · 0.45
findNextMethod · 0.45

Tested by

no test coverage detected