From 83cb75a87b5e1e1e4d378bd0b3dcf756dc8aee59 Mon Sep 17 00:00:00 2001 From: giles Date: Mon, 27 Apr 2026 03:07:36 +0000 Subject: [PATCH] HS: keyword-as-ref fallback + list innerHTML join - parse-atom: unrecognized keywords (e.g. index) fall back to ref, fixing 'set index to N' parse failure - hs-set-inner-html!: join list values as "" so 'put [A,C] into el' concatenates strings not [object Object] Co-Authored-By: Claude Sonnet 4.6 --- lib/hyperscript/parser.sx | 2 ++ lib/hyperscript/runtime.sx | 4 +++- shared/static/wasm/sx/hs-parser.sx | 2 ++ shared/static/wasm/sx/hs-runtime.sx | 4 +++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/hyperscript/parser.sx b/lib/hyperscript/parser.sx index eb8270cf..55dd00d8 100644 --- a/lib/hyperscript/parser.sx +++ b/lib/hyperscript/parser.sx @@ -429,6 +429,8 @@ (let ((name val) (args (parse-call-args))) (cons (quote call) (cons (list (quote ref) name) args))))) + ((= typ "keyword") + (do (adv!) (list (quote ref) val))) (true nil))))) (define parse-poss diff --git a/lib/hyperscript/runtime.sx b/lib/hyperscript/runtime.sx index 4bc59e82..b3284eac 100644 --- a/lib/hyperscript/runtime.sx +++ b/lib/hyperscript/runtime.sx @@ -311,7 +311,9 @@ hs-set-inner-html! (fn (target value) - (do (dom-set-inner-html target value) (hs-boot-subtree! target)))) + (let + ((str-val (if (list? value) (join "" (map (fn (x) (str x)) value)) value))) + (do (dom-set-inner-html target str-val) (hs-boot-subtree! target))))) (define hs-put! (fn diff --git a/shared/static/wasm/sx/hs-parser.sx b/shared/static/wasm/sx/hs-parser.sx index eb8270cf..55dd00d8 100644 --- a/shared/static/wasm/sx/hs-parser.sx +++ b/shared/static/wasm/sx/hs-parser.sx @@ -429,6 +429,8 @@ (let ((name val) (args (parse-call-args))) (cons (quote call) (cons (list (quote ref) name) args))))) + ((= typ "keyword") + (do (adv!) (list (quote ref) val))) (true nil))))) (define parse-poss diff --git a/shared/static/wasm/sx/hs-runtime.sx b/shared/static/wasm/sx/hs-runtime.sx index 4bc59e82..b3284eac 100644 --- a/shared/static/wasm/sx/hs-runtime.sx +++ b/shared/static/wasm/sx/hs-runtime.sx @@ -311,7 +311,9 @@ hs-set-inner-html! (fn (target value) - (do (dom-set-inner-html target value) (hs-boot-subtree! target)))) + (let + ((str-val (if (list? value) (join "" (map (fn (x) (str x)) value)) value))) + (do (dom-set-inner-html target str-val) (hs-boot-subtree! target))))) (define hs-put! (fn