     up: () -> null # this node has no parent
 
     end: () =>
+        if @_delayed?
+            @_delayed.push @end
+            return this
         if not @closed
             if @headers
                 data = "#{indent this}#{@headers}/>"

        sync_tag.apply this, arguments

    end: (data) =>
        if @pending.length
            @pending[0].once 'end', => @end(data)
        else

        this

    children: (children, {direct} = {}) =>
        return this unless children?
        unless typeof children is 'function'
            content = children
            children = =>
                @text content
        if direct
            children.call this
        else
            @_delayed = [] # mark that this tag has a delayed children scope
            process.nextTick =>
                [delayed, @_delayed] = [@_delayed, null] # turn off
                children.call this
                for method in delayed
                    method.call this
        this

    text: (content, opts = {}) =>
