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

Method resolve

www/js/_hyperscript-max.js:5906–5926  ·  view source on GitHub ↗
(ctx, { expr, constructorArgs } = {})

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

setSymbolMethod · 0.45
findNextMethod · 0.45

Tested by

no test coverage detected