diff options
Diffstat (limited to 'src/Dom/Document.ml')
-rw-r--r-- | src/Dom/Document.ml | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/Dom/Document.ml b/src/Dom/Document.ml index afd1a84..867e28c 100644 --- a/src/Dom/Document.ml +++ b/src/Dom/Document.ml @@ -1,4 +1,14 @@ -external querySelector : string -> Dom.element option = "querySelector" +external createElement : string -> Dom.element = "createElement" [@@bs.val] [@@bs.scope "document"] -let querySelectorUnsafe id = querySelector id |> Js.Option.getExn +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"] |