webview-get-style debugging

This commit is contained in:
2026-07-30 13:19:01 +02:00
parent 97313c1357
commit 6a4dd25dfe
+18 -15
View File
@@ -1040,26 +1040,29 @@
))
(r (webview-call-js wv js-code))
)
; (format
; (js-code
; "function(id, el) {"
; " let cl = ~a;"
; " let r = {};"
; " cl.forEach(function(st) {"
; " let stl = window.getComputedStyle(el);"
; " r[st] = stl[st];"
; " });"
; " return { id: id, style: r };"
; "}") cl))
; )))
; (format
; (js-code
; "function(id, el) {"
; " let cl = ~a;"
; " let r = {};"
; " cl.forEach(function(st) {"
; " let stl = window.getComputedStyle(el);"
; " r[st] = stl[st];"
; " });"
; " return { id: id, style: r };"
; "}") cl))
; )))
(displayln (format "~a: ~a" r js-code))
(if (eq? r #f)
#f
(let ((h (hash-ref r 'with-ids)))
(let ((l (map (λ (e)
(cons
(string->symbol (hash-ref e 'id))
(hash-ref e 'style))) h)))
(let ((id-rec (car e))
(style-rec (cadr e)))
(cons (string->symbol (cadr id-rec))
(make-hash (map (λ (e) (cons (car e) (cadr e))) (cadr style-rec)))
)
)) h)))
(if (symbol? selector)
(cdr (car l))
l))))