Fix create-text-node in DOM adapter: host handle Dicts are DOM nodes
The DOM adapter treated all Dict values as empty (create-fragment).
But DOM nodes (text nodes, elements) from create-text-node/host-call
are wrapped as Dict { __host_handle: N } by js_of_ocaml. Now checks
for __host_handle and passes them through as DOM nodes.
Fixes stopwatch button text ("Start") and timer display ("0.0s")
which were missing because create-text-node results were discarded.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -75,8 +75,10 @@
|
||||
(scope-emit! "element-attrs" (spread-attrs expr)))
|
||||
expr)
|
||||
|
||||
;; Dict → empty
|
||||
"dict" (create-fragment)
|
||||
;; Dict → check for host DOM node, else empty fragment
|
||||
"dict" (if (has-key? expr "__host_handle")
|
||||
expr ;; Host DOM node (text node, element, etc.) — pass through
|
||||
(create-fragment))
|
||||
|
||||
;; List → dispatch
|
||||
"list"
|
||||
|
||||
@@ -75,8 +75,10 @@
|
||||
(scope-emit! "element-attrs" (spread-attrs expr)))
|
||||
expr)
|
||||
|
||||
;; Dict → empty
|
||||
"dict" (create-fragment)
|
||||
;; Dict → check for host DOM node, else empty fragment
|
||||
"dict" (if (has-key? expr "__host_handle")
|
||||
expr ;; Host DOM node (text node, element, etc.) — pass through
|
||||
(create-fragment))
|
||||
|
||||
;; List → dispatch
|
||||
"list"
|
||||
|
||||
Reference in New Issue
Block a user