diff options
Diffstat (limited to 'src/Lib/Dom/Document.ml')
-rw-r--r-- | src/Lib/Dom/Document.ml | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/Lib/Dom/Document.ml b/src/Lib/Dom/Document.ml new file mode 100644 index 0000000..867e28c --- /dev/null +++ b/src/Lib/Dom/Document.ml @@ -0,0 +1,14 @@ +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"] |