 (defn- unregister-from-parent-state [parent-state child-key]
   (when-let [child-states (.-child-states parent-state)]
     (js-delete child-states child-key)))
-
-(defn- reset-element-spec! [dom-node spec]
-  (set! (.-element-spec (get-element-state dom-node)) spec))
 
 (defprotocol IRemove
   (-remove! [x]))

                (let [next-sib (.-nextSibling cur-child)]
                  (remove-dom-node cur-child)
                  (recur next-sib)))))
          cur-dom-node))
      (do
        ;(println "build hit" (first vdom) (first cur-vdom))


(declare get-transition)

(defn- init-element-meta! [state element-spec]
  (let [m (meta element-spec)]
    (set! (.-meta state) m)
    (when-let [on-disposed (get m :node-disposed)]
      (set! (.-disposed-callback state) on-disposed))))

(defn- reset-element-spec! [state spec]
  (when-let [on-disposed (.-disposed-callback state)]
    (on-disposed)
    (set! (.-disposed-callback state) nil))
  (set! (.-element-spec state) spec)
  (init-element-meta! state spec))

(defn- init-element-state! [dom-node element-spec]
  (let [node-id (str auto-node-id)
        state (ElementState. node-id false element-spec nil)]
    (set! auto-node-id (inc auto-node-id))
    (set-attr! dom-node "data-freactive-id" node-id)
    (init-element-meta! state element-spec)
    (aset element-state-lookup node-id state)
    ;;(set! element-state-lookup (assoc element-state-lookup dom-node state))
    state))
