Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added prepend function

  • Loading branch information...
commit eeb897ae1003d21c0ce72fe351498839b12a7369 1 parent f8c34de
@zk authored
Showing with 20 additions and 1 deletion.
  1. +20 −1 src/cljs/nsfw/dom.cljs
View
21 src/cljs/nsfw/dom.cljs
@@ -108,6 +108,25 @@
(throw "Can't call dom/append on a null element")))
els)
+(defn prepend [els content]
+ (doseq [el (ensure-coll els)]
+ (if el
+ (if (and (coll? content)
+ (not (keyword? (first content))))
+ (doseq [c content]
+ (when c
+ (dom/insertChildAt el (wrap-content c) 0))
+ (when content
+ (when-let [on-insert (aget content "on-insert")]
+ (on-insert el))))
+ (do (when content
+ (dom/insertChildAt el (wrap-content content) 0))
+ (when content
+ (when-let [on-insert (aget content "on-insert")]
+ (on-insert el)))))
+ (throw "Can't call dom/append on a null element")))
+ els)
+
(def apd append)
(defn append-to [child parents]
@@ -292,7 +311,7 @@
els
(fn [{:keys [key-code] :as e}]
(when (= key-code target-key)
- (f e els))))))
+ (f e root))))))
root))
(defn scroll-end [els f]
Please sign in to comment.
Something went wrong with that request. Please try again.