Skip to content

Commit da91c34

Browse files
fix(signals): simplify x-html null-guard to '?? ""' (#1767)
The #1768 null-guard rewrote 'el.innerHTML = evalAttrExpr(value)' into a 'var __html = ...' form, which broke the scope-lifecycle 'should handle @html' assertion that checks the runtime still contains 'el.innerHTML = evalAttrExpr'. Use the runtime's existing '?? '' idiom (cf. el.value at signals.ts) so the null/undefined coercion stays AND the asserted shape is preserved. Full suite green (7796 pass, 0 fail).
1 parent bcd6f2c commit da91c34

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

‎packages/stx/src/signals.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1861,8 +1861,7 @@ else if (name === '@html' || name === ':html' || name === 'x-html') {
18611861
effect(() => {
18621862
// Coerce null/undefined to '' so a missing/unresolved binding renders
18631863
// nothing rather than the literal string "undefined" (#1767).
1864-
var __html = evalAttrExpr(value);
1865-
el.innerHTML = (__html == null) ? '' : __html;
1864+
el.innerHTML = evalAttrExpr(value) ?? '';
18661865
});
18671866
el.removeAttribute(name);
18681867
}

0 commit comments

Comments
 (0)