Patch Changes
-
#3249
6e9e085Thanks @DylanPiercey! - Fix a conditional (<if>) rebuilding its first branch — discarding live DOM state — on the first re-evaluation after an SSR resume. The HTML serializer elides a conditional's renderer index when it is0, but the DOM runtime left that accessor uninitialized on resume, so the guard saw0 !== undefinedand needlessly tore down and rebuilt the resumed branch. The runtime now treats a resumed scope's absent index as0(a freshly created scope still renders its first branch). -
#3242
5c4af81Thanks @DylanPiercey! - Fix&&, ternary (a ? b : c), and&&=expression results being treated as non-nullable unless both sides were nullable. Sincea && byieldsawhenais falsy and a ternary yields whichever branch is taken, the result is nullable if either side is. Under-approximating dropped the optional-chaining /|| {}guards on reads of such bindings, throwing at runtime; the result is now correctly treated as nullable when either side is, matching the||/??cases. -
#3250
226bc67Thanks @DylanPiercey! - Error when a non-function value is passed to a native tag event handler (onClick,on-click, …) or change handler (valueChange,checkedChange,openChange, …). Previously a value like<button onClick=5>or<input value=x valueChange="handler">silently compiled and the handler was wired up with a non-function (or dropped), doing nothing at runtime. Handler values must now be a function or a falsey value — falsey values (null,undefined,false,0, …) are still allowed and mean "no handler", matching the runtime, so patterns likeonClick=items.length && (() => …)continue to work. Statically known invalid values are reported as a compile error; aMARKO_DEBUG-only runtime check catches dynamically passed invalid values.The lowercase
on*attribute check (e.g.<button onclick=…>) is aligned to the same falsey rule: its value must be a string or a falsey value (including0,"", etc.), not justnull/undefined/false. -
#3248
b16d0c8Thanks @DylanPiercey! - Error when a non string/void value is passed to a lowercaseon*attribute on a native tag (e.g.<button onclick=() => {}>). Marko event handlers use theonClick/on-clickform, so a lowercaseonclickis treated as a plain native attribute and the value would have been silently stringified instead of attaching a listener. Lowercaseon*attribute values must now be a string,null,undefined, orfalse. Statically known invalid values are reported as a compile error, and aMARKO_DEBUG-only runtime check catches dynamically passed invalid values; both suggest the correct camelCase handler name. -
#3238
743b327Thanks @DylanPiercey! - Fixasyncmethod-shorthand event handlers (e.g.async onClick() { … }) being normalized with theirasyncandgeneratorflags swapped. The handler was rewritten as a non-async generator, so anyawaitinside it failed to compile (`await` is only allowed within async functions). The flags are now preserved. -
#3247
69d39e1Thanks @DylanPiercey! - Fix event handlers applied through a spread (<div ...attrs>) not being removed when they are dropped from the spread on a later render. Delegated handlers are stored on the element, and only the handlers present in the current render were (re)applied — there was no pass to clear one that had disappeared (plain attributes are cleared via theel.attributesscan; events had no equivalent). A removed handler therefore stayed attached and kept firing. Handlers absent from the spread are now reset. -
#3246
7c285a3Thanks @DylanPiercey! - Add aMARKO_DEBUG-onlyconsole.errorwhen a<for>tag'sbyattribute returns a value that is not a string or number. Such keys can't reliably track item identity or survive SSR serialization/resume, so this surfaces the misuse during development in both the server (HTML) and client (DOM) runtimes.