Skip to content

@marko/runtime-tags@6.1.13

Latest

Choose a tag to compare

@github-actions github-actions released this 21 Jun 01:55
· 4 commits to main since this release
8a6d86b

Patch Changes

  • #3249 6e9e085 Thanks @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 is 0, but the DOM runtime left that accessor uninitialized on resume, so the guard saw 0 !== undefined and needlessly tore down and rebuilt the resumed branch. The runtime now treats a resumed scope's absent index as 0 (a freshly created scope still renders its first branch).

  • #3242 5c4af81 Thanks @DylanPiercey! - Fix &&, ternary (a ? b : c), and &&= expression results being treated as non-nullable unless both sides were nullable. Since a && b yields a when a is 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 226bc67 Thanks @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 like onClick=items.length && (() => …) continue to work. Statically known invalid values are reported as a compile error; a MARKO_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 (including 0, "", etc.), not just null/undefined/false.

  • #3248 b16d0c8 Thanks @DylanPiercey! - Error when a non string/void value is passed to a lowercase on* attribute on a native tag (e.g. <button onclick=() => {}>). Marko event handlers use the onClick/on-click form, so a lowercase onclick is treated as a plain native attribute and the value would have been silently stringified instead of attaching a listener. Lowercase on* attribute values must now be a string, null, undefined, or false. Statically known invalid values are reported as a compile error, and a MARKO_DEBUG-only runtime check catches dynamically passed invalid values; both suggest the correct camelCase handler name.

  • #3238 743b327 Thanks @DylanPiercey! - Fix async method-shorthand event handlers (e.g. async onClick() { … }) being normalized with their async and generator flags swapped. The handler was rewritten as a non-async generator, so any await inside it failed to compile (`await` is only allowed within async functions). The flags are now preserved.

  • #3247 69d39e1 Thanks @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 the el.attributes scan; events had no equivalent). A removed handler therefore stayed attached and kept firing. Handlers absent from the spread are now reset.

  • #3246 7c285a3 Thanks @DylanPiercey! - Add a MARKO_DEBUG-only console.error when a <for> tag's by attribute 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.