diff options
author | Joris | 2021-01-09 14:24:49 +0100 |
---|---|---|
committer | Joris | 2021-01-09 14:24:49 +0100 |
commit | 026ace6302f23837e34e982f6660e09ff38ee97b (patch) | |
tree | 4ea14b3cdadadad97b349901148b8f4a2462482e /src/domUtils.ml | |
parent | 8337dd669c518a70bffdf1e91059e0968d786c0f (diff) |
Use plain HTML and CSS
Diffstat (limited to 'src/domUtils.ml')
-rw-r--r-- | src/domUtils.ml | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/src/domUtils.ml b/src/domUtils.ml deleted file mode 100644 index 282ac12..0000000 --- a/src/domUtils.ml +++ /dev/null @@ -1,37 +0,0 @@ -open Webapi.Dom - -let toggleClassName (element : Dom.element) (className : string) : unit = - Element.setClassName element - (if Element.className element == className then "" else className) - -type child = TextChild of string | ElemChild of Dom.element - -let h (tag : string) (attributes : (string * string) Js.Array.t) - (children : child Js.Array.t) : Dom.element = - let element = Document.createElement tag document in - let () = - attributes - |> Js.Array.forEach (fun a -> Element.setAttribute (fst a) (snd a) element) - in - let () = - children - |> Js.Array.forEach (fun c -> - match c with - | TextChild t -> - Element.appendChild (Document.createTextNode t document) element - | ElemChild e -> Element.appendChild e element) - in - element - -external replace_child : Dom.node -> Dom.element -> Dom.element -> unit - = "replaceChild" - [@@bs.send] - -let replace (element : Dom.element) (replacement : Dom.element) : unit = - match Element.parentNode element with - | Some parent -> replace_child parent replacement element - | _ -> () - -external value : Dom.eventTarget -> string option = "value" [@@bs.get] - -external setValue : Dom.element -> string -> unit = "value" [@@bs.set] |