 #                 parent._jquery.data('dt-jquery', parent)
             else
                 nextAnimationFrame ->
-                    parent._jquery.append(el._jquery)
+                    parent._jquery?.append(el._jquery)
 
     tpl.on 'close', (el) ->
         el._jquery ?= $(el.toString())

# 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 @_jquery?
        do job

    tpl.on 'raw', (el, html) ->
        delay.call el, ->
            nextAnimationFrame ->
                el._jquery?.html(html)

    tpl.on 'show', (el) ->
        delay.call el, ->
