Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…perties.
  • Loading branch information...
commit b55df922d3742e0c2bba7e17e2a3d74d987c3f2e 1 parent 2603b73
@lynaghk authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/cljs/c2/dom.cljs
View
8 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)]
Please sign in to comment.
Something went wrong with that request. Please try again.