Permalink
Browse files

Nil values should remove attributes (instead of rendering as "null").

  • Loading branch information...
1 parent 5a756e5 commit 260e6121d0dd3443e966b6f07b220fe8b0d65b97 @lynaghk committed May 12, 2012
Showing with 6 additions and 4 deletions.
  1. +1 −1 project.clj
  2. +5 −3 src/cljs/c2/dom.cljs
View
@@ -1,4 +1,4 @@
-(defproject com.keminglabs/c2 "0.1.0"
+(defproject com.keminglabs/c2 "0.1.1-SNAPSHOT"
:description "Declarative data visualization in Clojure(Script)."
:url "http://keminglabs.com/c2/"
:license {:name "BSD" :url "http://www.opensource.org/licenses/BSD-3-Clause"}
View
@@ -168,9 +168,11 @@
(do (doseq [[k v] m] (attr el k v))
el)))
([el k v]
- (if (= :style k)
- (style el v)
- (.setAttribute el (name k) v))
+ (if (nil? v)
+ (.removeAttribute el (name k))
+ (if (= :style k)
+ (style el v)
+ (.setAttribute el (name k) v)))
el))
(defn text

0 comments on commit 260e612

Please sign in to comment.