                     el.dom = _dom
 
     tpl.on 'remove', (el) ->
-        el.parent?._dom?.removeChild(el._dom) if el._dom?
+        delay.call el.parent, ->
+            el.parent?._dom?.removeChild(el._dom) if el._dom?
+            delete el._dom
 
     tpl.on 'end', ->
         tpl.xml._dom = []

# TODO listen for dom events to know when a dom manipulation is ready
# TODO mit canvas tag kommt man direkt auf die browser render ticks.


# delay or invoke job immediately
delay = (job) ->
    # only when tag is ready
    if @_dom?
        do job

    tpl.on 'replace', (el, tag) ->
        delay.call el, ->
            nextAnimationFrame ->
                return if removed el
                _dom = tag._dom ? tag
                return unless _dom?.length > 0
                el.parent?._dom?.replaceChild(_dom)
