(str, context, type, value, targetElement)
| 313 | } |
| 314 | |
| 315 | setSymbol(str, context, type, value, targetElement) { |
| 316 | if (type === "global") { |
| 317 | this.#globalScope[str] = value; |
| 318 | this.reactivity.notifyGlobalSymbol(str); |
| 319 | return; |
| 320 | } |
| 321 | if (type === "element") { |
| 322 | this.#getElementScope(context)[str] = value; |
| 323 | this.reactivity.notifyElementSymbol(str, context.meta.owner); |
| 324 | return; |
| 325 | } |
| 326 | if (type === "inherited") { |
| 327 | var inherited = this.#resolveInherited(str, context, targetElement); |
| 328 | if (inherited.element) { |
| 329 | this.getInternalData(inherited.element).elementScope[str] = value; |
| 330 | this.reactivity.notifyElementSymbol(str, inherited.element); |
| 331 | } else { |
| 332 | var owner = targetElement || context.meta?.owner; |
| 333 | if (owner) { |
| 334 | var internalData = this.getInternalData(owner); |
| 335 | if (!internalData.elementScope) internalData.elementScope = {}; |
| 336 | internalData.elementScope[str] = value; |
| 337 | this.reactivity.notifyElementSymbol(str, owner); |
| 338 | } |
| 339 | } |
| 340 | return; |
| 341 | } |
| 342 | // local scope resolution (tries locals → element → global chain) |
| 343 | if (this.#isHyperscriptContext(context) && !this.#isReservedWord(str) && typeof context.locals[str] !== "undefined") { |
| 344 | context.locals[str] = value; |
| 345 | return; |
| 346 | } |
| 347 | var elementScope = this.#getElementScope(context); |
| 348 | if (typeof elementScope[str] !== "undefined") { |
| 349 | elementScope[str] = value; |
| 350 | this.reactivity.notifyElementSymbol(str, context.meta.owner); |
| 351 | } else if (this.#isHyperscriptContext(context) && !this.#isReservedWord(str)) { |
| 352 | context.locals[str] = value; |
| 353 | } else { |
| 354 | context[str] = value; |
| 355 | } |
| 356 | } |
| 357 | |
| 358 | getInternalData(elt) { |
| 359 | if (!elt._hyperscript) { |
no test coverage detected