Skip to content

Instantly share code, notes, and snippets.

@nojaf
Created September 26, 2017 08:37
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nojaf/73901af8f3209f6f8527a1cced21f4b3 to your computer and use it in GitHub Desktop.
Save nojaf/73901af8f3209f6f8527a1cced21f4b3 to your computer and use it in GitHub Desktop.
Fable querySelector
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