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)) (r (webview-call-js wv js-code))
) )
; (format ; (format
; (js-code ; (js-code
; "function(id, el) {" ; "function(id, el) {"
; " let cl = ~a;" ; " let cl = ~a;"
; " let r = {};" ; " let r = {};"
; " cl.forEach(function(st) {" ; " cl.forEach(function(st) {"
; " let stl = window.getComputedStyle(el);" ; " let stl = window.getComputedStyle(el);"
; " r[st] = stl[st];" ; " r[st] = stl[st];"
; " });" ; " });"
; " return { id: id, style: r };" ; " return { id: id, style: r };"
; "}") cl)) ; "}") cl))
; ))) ; )))
(displayln (format "~a: ~a" r js-code)) (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)))
(let ((l (map (λ (e) (let ((l (map (λ (e)
(cons (let ((id-rec (car e))
(string->symbol (hash-ref e 'id)) (style-rec (cadr e)))
(hash-ref e 'style))) h))) (cons (string->symbol (cadr id-rec))
(make-hash (map (λ (e) (cons (car e) (cadr e))) (cadr style-rec)))
)
)) h)))
(if (symbol? selector) (if (symbol? selector)
(cdr (car l)) (cdr (car l))
l)))) l))))