Is there a built in function to convert a NodeList to a real list (ghcjs-dom)?

88 Views Asked by At

How can I convert the result of Element.querySelectorAll body "h1" which is IO NodeList to IO (List Node). I know I could write a function myself. Is there a builtin function?

1

There are 1 best solutions below

0
On BEST ANSWER

My implementation:

nodeListToList nl = nl
       & NodeList.getLength
     <&> (\x -> [0..x - 1])
     >>= mapM (item nl)
     <&> catMaybes