Threepenny-GUI: Get Attribute Value as String

时间:2017-08-30 20:57:34

标签: haskell threepenny-gui

is there a way to get the attribute value (especially the id) of an element as a string? For instance the following lines result in "()":

<div class="dropDownbtn">
    <button>H1</button>
    <a href="" class="dropDownContents">P1</a>
    <a href="" class="dropDownContents">P2</a>
</div>

Since split() returns a x <- c(1, 1, 2.00005, 1, 1, 0, 0, 0, 0, 1, 2, 0, 3, 4, 0, 0, 0, 0, 1, 2, 3, 1, 3) ll <- with(rle(x == 0), { ifelse(x == 0 & (seq_along(x) != cumsum(lengths)[lengths <= 3 & values]), NA, x) }) split(x, with(rle(is.na(ll)), rep(1:length(lengths), lengths) + ll * 0)) # $`1` # [1] 1.00000 1.00000 2.00005 1.00000 1.00000 # # $`3` # [1] 1 2 0 3 4 # # $`5` # [1] 1 2 3 1 3 , field <- UI.new # set (attr "id") "some text" on UI.drop field $ \_ -> do -- Some label to print the attribute value to label <- getElementById window "labelID" id <- get (attr "id") field (element (fromJust label)) # set text (show id) might not be working. Is there a workaround?

Thanks in advance!

Greetings

1 个答案:

答案 0 :(得分:0)

截至threepenny-gui v0.8.1.0,目前尚未实施。这当然是可能的,我还没有去做那件事。随意在Github上打开一个问题!

(请注意,如果您缺少功能,可以随时使用runFunctionffi函数直接调用JavaScript。)