aboutsummaryrefslogtreecommitdiff
path: root/src/Lib/Dom/Document.ml
blob: 39c1bb41e816b21dde2050c7ebc029c3ae3018d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
external createElement : string -> Dom.element = "createElement"
  [@@bs.val] [@@bs.scope "document"]

external createElementNS : string -> string -> Dom.element = "createElementNS"
  [@@bs.val] [@@bs.scope "document"]

external querySelector : string -> Dom.element Js.Nullable.t = "querySelector"
  [@@bs.val] [@@bs.scope "document"]

let querySelectorUnsafe id =
  querySelector id |> Js.Nullable.toOption |> Js.Option.getExn

external createTextNode : string -> Dom.element = "createTextNode"
  [@@bs.val] [@@bs.scope "document"]

external location : Location.location = "location"
  [@@bs.val] [@@bs.scope "document"]