 (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]

  (set-fn @ref))

(defn- bind-style-prop! [element attr-name attr-value node-state]
  (let [setter (fn [v]
                 (set-style-prop! element attr-name v))]
    (if (satisfies? cljs.core/IDeref attr-value)
      (bind-attr* setter element "style" attr-name attr-value node-state)

  (.removeAttribute elem attr-name))

(defn- set-style-prop! [elem prop-name prop-value]
  ;(println "set-style-prop!" elem prop-name prop-value)
  (if prop-value
    (aset (.-style elem)
          prop-name
          (if (.-substring prop-value)
            prop-value
            (.toString prop-value)))
    (js-delete (.-style elem) prop-name)))

(defn- remove-style-prop! [elem prop-name]
  (js-delete (.-style elem) prop-name))
