(str, context, type, targetElement)
| 252 | } |
| 253 | |
| 254 | resolveSymbol(str, context, type, targetElement) { |
| 255 | if (str === "me" || str === "my" || str === "I") return context.me; |
| 256 | if (str === "it" || str === "its") return context.beingTested ?? context.result; |
| 257 | if (str === "result") return context.result; |
| 258 | if (str === "you" || str === "your" || str === "yourself") return context.you; |
| 259 | |
| 260 | if (type === "global") { |
| 261 | if (this.reactivity.isTracking) this.reactivity.trackGlobalSymbol(str); |
| 262 | var val = this.#globalScope[str]; |
| 263 | this.#trackMutation(val); |
| 264 | return val; |
| 265 | } |
| 266 | if (type === "element") { |
| 267 | if (this.reactivity.isTracking) this.reactivity.trackElementSymbol(str, context.meta.owner); |
| 268 | var val = this.#getElementScope(context)[str]; |
| 269 | this.#trackMutation(val); |
| 270 | return val; |
| 271 | } |
| 272 | if (type === "inherited") { |
| 273 | var inherited = this.#resolveInherited(str, context, targetElement); |
| 274 | if (this.reactivity.isTracking) { |
| 275 | var trackElement = inherited.element || targetElement || context.meta?.owner; |
| 276 | if (trackElement) { |
| 277 | this.reactivity.trackElementSymbol(str, trackElement); |
| 278 | } |
| 279 | } |
| 280 | this.#trackMutation(inherited.value); |
| 281 | return inherited.value; |
| 282 | } |
| 283 | // local scope resolution: meta.context (set only inside `on click[...]` |
| 284 | // filter expressions to the current event) → locals → element → global. |
| 285 | // Event destructuring in handler bodies is explicit: `on click(x, y)` |
| 286 | // copies event/detail props into ctx.locals at handler entry, so in body |
| 287 | // code `x` is a real local, not a fallback lookup. |
| 288 | if (context.meta?.context) { |
| 289 | var fromMetaContext = context.meta.context[str]; |
| 290 | if (typeof fromMetaContext !== "undefined") return fromMetaContext; |
| 291 | if (context.meta.context.detail) { |
| 292 | fromMetaContext = context.meta.context.detail[str]; |
| 293 | if (typeof fromMetaContext !== "undefined") return fromMetaContext; |
| 294 | } |
| 295 | } |
| 296 | var fromContext = this.#isHyperscriptContext(context) && !this.#isReservedWord(str) |
| 297 | ? context.locals[str] : context[str]; |
| 298 | if (typeof fromContext !== "undefined") return fromContext; |
| 299 | |
| 300 | // element scope |
| 301 | var elementScope = this.#getElementScope(context); |
| 302 | fromContext = elementScope[str]; |
| 303 | if (typeof fromContext !== "undefined") { |
| 304 | if (this.reactivity.isTracking) this.reactivity.trackElementSymbol(str, context.meta.owner); |
| 305 | this.#trackMutation(fromContext); |
| 306 | return fromContext; |
| 307 | } |
| 308 | // global scope (or not found - track as global so we catch the first write) |
| 309 | if (this.reactivity.isTracking) this.reactivity.trackGlobalSymbol(str); |
| 310 | var val = this.#globalScope[str]; |
| 311 | this.#trackMutation(val); |
no test coverage detected