               (unbind-attr!* node-state "attr" k))
             (bind-attr! node k v node-state)))))))
 
-(defn- replace-attr!* [node node-state attr-name old-val new-val prefix
-                       binder remover]
-  (if old-val
-    (if new-val
-      (if (not (identical? old-val new-val))
-        (unbind-attr!* node-state prefix attr-name)
-        (binder node attr-name new-val node-state))
-      (remover node attr-name))
-    (binder node attr-name new-val node-state)))
+;(defn- replace-attr!* [node node-state attr-name old-val new-val prefix binder]
+;  (if (not (identical? old-val new-val))
+;    (unbind-attr!* node-state prefix attr-name)
+;    (binder node attr-name new-val node-state)))
+;
+;(defn- replace-attr! [node node-state attr-name old-val new-val]
+;  (replace-attr!* node node-state attr-name old-val new-val "attr"))
+
+(defn- replace-attrs!* [node node-state old-attrs new-attrs rebinder binder
+                        remover]
+  (loop [[[k new-val] & new-attrs] (seq new-attrs)
+         old-attrs old-attrs]
+    (if k
+      (let [attr-name (name k)]
+        (if-let [existing (get old-attrs k)]
+          (do
+            (rebinder node node-state attr-name existing new-val)
+            (recur new-attrs (dissoc old-attrs k)))
+          (do
+            (binder node node-state attr-name new-val)
+            (recur new-attrs old-attrs))))
+      (loop [[[k v] & old-attrs] old-attrs]
+        (when k
+          (remover node node-state (name k))
+          (recur old-attrs))))))
 
 (defn- replace-attrs! [node old-attrs new-attrs]
   (let [node-state (get-element-state node)]
+    ;;(replace-attrs!* node node-state old-attrs new-attrs nil nil )
     ))
 
 ;; From hiccup.compiler:


(defn bind-style-prop! [element attr-name attr-value node-state]
  (if (satisfies? cljs.core/IDeref attr-value)
    (on-value-ref-invalidated* set-style-prop! element "style." attr-name attr-value node-state)
    (set-style-prop! element attr-name attr-value)))

(defn listen! [element evt-name handler]


(defn- bind-prop-attr! [set-fn element attr-name attr-value node-state]
  (if (satisfies? cljs.core/IDeref attr-value)
        (on-value-ref-invalidated* set-fn element "attr" attr-name
                                   attr-value node-state)
        (set-fn element attr-name attr-value)))

(defn- bind-attr! [element attr-name attr-value node-state]
  (let [attr-name (name attr-name)]
    (cond
      (identical? "style" attr-name)
