solving bug in webview-get-style

This commit is contained in:
2026-07-30 11:44:21 +02:00
parent d8ed6235ef
commit 39b6e1adf5
+5 -5
View File
@@ -1014,7 +1014,7 @@
; ) ; )
(define/contract (webview-get-style wv selector styles) (define/contract (webview-get-style wv selector styles)
(-> wv-win? (or/c symbol? string?) (or/c symbol? list-of-symbol?) (or/c list? hash?)) (-> wv-win? (or/c symbol? string?) (or/c symbol? list-of-symbol?) (or/c list? hash? boolean?))
(let ((sel (if (symbol? selector) (let ((sel (if (symbol? selector)
(format "#~a" selector) (format "#~a" selector)
selector)) selector))
@@ -1025,8 +1025,7 @@
; (list styles) ; (list styles)
; styles))) ; styles)))
) )
(let ((r (webview-call-js wv (let* ((js-code (with-selector sel
(with-selector sel
(λ (id el) (λ (id el)
(let ((cl (eval cl)) (let ((cl (eval cl))
(r (make-hash))) (r (make-hash)))
@@ -1036,9 +1035,9 @@
(set! (js-ref r st) (js-ref stl st))))) (set! (js-ref r st) (js-ref stl st)))))
(make-hash (list (make-hash (list
(list 'id id) (list 'id id)
(list 'style r)))))) (list 'style r)))))))
(r (webview-call-js wv js-code))
) )
))
; (format ; (format
; (js-code ; (js-code
; "function(id, el) {" ; "function(id, el) {"
@@ -1051,6 +1050,7 @@
; " return { id: id, style: r };" ; " return { id: id, style: r };"
; "}") cl)) ; "}") cl))
; ))) ; )))
(displayln (format "~a: ~a" r js-code))
(if (eq? r #f) (if (eq? r #f)
#f #f
(let ((h (hash-ref r 'with-ids))) (let ((h (hash-ref r 'with-ids)))