Browse files

Add "px" to numeric values when they're passed into certain style pro…

  • Loading branch information...
lynaghk committed Apr 15, 2012
1 parent 2603b73 commit b55df922d3742e0c2bba7e17e2a3d74d987c3f2e
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/cljs/c2/dom.cljs
@@ -76,7 +76,13 @@
([el x] (match [x]
[(k :when keyword?)] (gstyle/getComputedStyle el (name k))
[(m :when map?)] (doseq [[k v] m] (style el k v))))
- ([el k v] (gstyle/setStyle el (name k) v)))
+ ([el k v] (gstyle/setStyle el (name k)
+ (match [v]
+ [s :when string?] s
+ [n :when number?]
+ (if (#{:height :width :top :left :bottom :right} (keyword k))
+ (str n "px")
+ n)))))
(defn attr
([el] (let [attrs (.-attributes el)]

0 comments on commit b55df92

Please sign in to comment.