       (let [k (name k)]
         (rebind-attr! node k v node-state)))))
 
+;(defn- replace-attrs!* [node node-state old-attrs new-attrs rebinder]
+;  (let [hit #js {}]
+;    (doseq [[attr-name new-val] new-attrs]
+;      ;(println "rebinding" attr-name new-val)
+;      (rebinder node attr-name new-val node-state)
+;      (when (get old-attrs attr-name)
+;          (aset hit (str attr-name) true)))
+;    (doseq [[attr-name _] old-attrs]
+;      (let [attr-str (str attr-name)]
+;        (when-not (aget hit attr-str)
+;          ;(println "unbinding" attr-name)
+;          (rebinder node attr-name nil node-state))))))
+
 (defn- replace-attrs!* [node node-state old-attrs new-attrs rebinder]
-  (let [hit #js {}]
+  (let [new-attrs-js #js {}]
     (doseq [[attr-name new-val] new-attrs]
-      ;(println "rebinding" attr-name new-val)
-      (rebinder node attr-name new-val node-state)
-      (when (get old-attrs attr-name)
-          (aset hit (str attr-name) true)))
-    (doseq [[attr-name _] old-attrs]
-      (let [attr-str (str attr-name)]
-        (when-not (aget hit attr-str)
-          ;(println "unbinding" attr-name)
-          (rebinder node attr-name nil node-state))))))
+      (let [attr-str (if-let [attr-ns (namespace attr-name)]
+                       (str attr-ns "/" (name attr-name))
+                       (name attr-name))]
+        (rebinder node attr-name new-val node-state)
+        (js-delete old-attrs attr-str)
+        (aset new-attrs-js attr-str new-val)))
+    (goog.object/forEach old-attrs
+      (fn [_ attr-str _]
+        (rebinder node (keyword attr-str) nil node-state)))
+    new-attrs-js))
 
 ;(defn- replace-attrs!* [node node-state old-attrs new-attrs rebinder]
 ;  (loop [[[k new-val] & new-attrs] (seq new-attrs)

(defn- text-node? [dom-node]
  (identical? (.-nodeType dom-node) 3))

(def enable-diffing false)

(defn- register-element-with-parent [parent new-elem]
  (when-not (text-node? new-elem)

            node (create-dom-node tag)
            attrs? (second virtual-dom)
            attrs (when (map? attrs?) attrs?)
            state (init-element-state! node elem-spec tag)
            children (if attrs (nnext virtual-dom) (next virtual-dom))]
        ;(doseq [[k v] attrs]
        ;  (bind-attr! node k v state))
        (bind-attrs! node attrs state)
        (when children
          (append-children! node children))
        ;(when-let [m (.-meta state)]
