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


    tpl.on 'replace', (el, tag) ->
        delay.call el, ->
            el._jquery.replaceWith(tag._jquery ? tag)

    tpl.on 'remove', (el) ->
        el._jquery?.remove()


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

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