Skip to content

Commit

Permalink
Nil values should remove attributes (instead of rendering as "null").
Browse files Browse the repository at this point in the history
  • Loading branch information
lynaghk committed May 12, 2012
1 parent 5a756e5 commit 260e612
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion project.clj
@@ -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"}
Expand Down
8 changes: 5 additions & 3 deletions src/cljs/c2/dom.cljs
Expand Up @@ -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
Expand Down

0 comments on commit 260e612

Please sign in to comment.