From 168c5b490c68282e3ef7a902f1c317e4ffd58263 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 24 Oct 2016 22:13:04 +0200 Subject: [PATCH] Add more dom creation and manipulation functions to util.dom ns. --- src/uxbox/util/dom.cljs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/uxbox/util/dom.cljs b/src/uxbox/util/dom.cljs index e526563b0..56bc6eeb0 100644 --- a/src/uxbox/util/dom.cljs +++ b/src/uxbox/util/dom.cljs @@ -82,3 +82,33 @@ "Extract the files from event instance." [event] (get-files (get-target event))) + +(defn create-element + ([tag] + (.createElement js/document tag)) + ([ns tag] + (.createElementNS js/document ns tag))) + +(defn set-html! + [el html] + (set! (.-innerHTML el) html)) + +(defn append-child! + [el child] + (.appendChild el child)) + +(defn get-first-child + [el] + (.-firstChild el)) + +(defn get-tag-name + [el] + (.-tagName el)) + +(defn get-outer-html + [el] + (.-outerHTML el)) + +(defn query + [el query] + (.querySelector el query))