 
   Object
   (dispose [this]
-    (when attr-binder (r/dispose attr-binder))
-    (dotimes [i (.-length children)]
+    (r/dispose attr-binder)
+    (doseq [i (range (.-length children))]
       (r/dispose (aget children i))))
   (ensureNode [this]
     (when-not node

    (fn [attr-value]
      (set-attr! element attr-name attr-value))))

;; TODO
;; (defn- bind-lifecycle-callback! [node node-state cb-name cb-value]
;;   (when (identical? cb-name "on-disposed")
;;     (set! (.-disposed-callback node-state) cb-value)
;;     ;; other callbacks automatically included in attr map
;;     )
;;   cb-value)

(defn- get-ns-attr-setter [element attr-ns attr-name]
  (fn [attr-value]
      ;(println "setting attr" element attr-name attr-value)

  (updateAttrs [this new-attrs]
    (set! attr-binder (attr-binder node new-attrs))
    (set! attrs new-attrs))

  ui/IVirtualElement
  (-velem-parent [this] parent)
