Browse files

Fix val not working when passed in an array of nodes

  • Loading branch information...
1 parent b7a1d72 commit f8c34ded414ac0544aedee7c80bc1596015307ce @zk committed Mar 9, 2013
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/cljs/nsfw/dom.cljs
View
9 src/cljs/nsfw/dom.cljs
@@ -70,11 +70,16 @@
([base o]
(selector base (name o))))
+(defn unwrap [el]
+ (if (coll? el)
+ (first el)
+ el))
+
(defn val
([el]
- (.-value (if (coll? el) (first el) el)))
+ (.-value (unwrap el)))
([el new-value]
- (set! (.-value el) new-value)))
+ (set! (.-value (unwrap el)) new-value)))
(defn wrap-content
[content]

0 comments on commit f8c34de

Please sign in to comment.