 # TODO mit canvas tag kommt man direkt auf die browser render ticks.
 
 
+removed = (el) ->
+    el.closed is "removed"
+
 # delay or invoke job immediately
 delay = (job) ->
+    return if removed this
     # only when tag is ready
     if @_jquery?
         do job

#                 parent._jquery.data('dt-jquery', parent)
            else
                nextAnimationFrame ->
                    parent._jquery.append(el._jquery)

    tpl.on 'close', (el) ->
        el._jquery ?= $(el.toString())

                    el.jquery = _jquery

    tpl.on 'remove', (el) ->
        delay.call el.parent, ->
            el._jquery?.remove()
            delete el._jquery

    tpl.on 'end', ->
        tpl.xml._jquery = $()
