Created
September 26, 2017 08:37
-
-
Save nojaf/73901af8f3209f6f8527a1cced21f4b3 to your computer and use it in GitHub Desktop.
Fable querySelector
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Helper | |
open Fable.Import.Browser | |
let private toList (nodeList:NodeListOf<Element>) = | |
let length = nodeList.length - 1.0 | |
[0.0 .. length] | |
|> List.map (fun i -> nodeList.item i :?> HTMLElement) | |
let dollar selector (element:HTMLElement) = | |
element.querySelectorAll selector | |
|> toList |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment