| 282 | } |
| 283 | |
| 284 | resolve(ctx, { expr, constructorArgs } = {}) { |
| 285 | if (this.variant === "queryRef") { |
| 286 | var match, |
| 287 | tagname = "div", |
| 288 | id, |
| 289 | classes = []; |
| 290 | var re = /(?:(^|#|\.)([^#\. ]+))/g; |
| 291 | while ((match = re.exec(this.expr.css))) { |
| 292 | if (match[1] === "") tagname = match[2].trim(); |
| 293 | else if (match[1] === "#") id = match[2].trim(); |
| 294 | else classes.push(match[2].trim()); |
| 295 | } |
| 296 | |
| 297 | var result = document.createElement(tagname); |
| 298 | if (id !== undefined) result.id = id; |
| 299 | result.classList.add(...classes); |
| 300 | |
| 301 | ctx.result = result; |
| 302 | } else { |
| 303 | ctx.result = new expr(...constructorArgs); |
| 304 | } |
| 305 | |
| 306 | if (this.target) { |
| 307 | ctx.meta.runtime.setSymbol(this.target.name, ctx, this.target.scope, ctx.result); |
| 308 | } |
| 309 | |
| 310 | return this.findNext(ctx); |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | /** |