| 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"; |