                     else
                         data = "</#{@name}>"
                         @closed = yes
-                    @emit 'data', prettify this, data
+                    @emit 'data', prettify this, data unless @hidden
                     @emit 'close', this
                     @emit 'end'
                     @writable = false

{ EventEmitter } = require 'events'
{ deep_merge, prettify, new_attrs, safe } = require './util'
EVENTS = ['add','attr','attr:remove','text','raw','remove','close']


parse_args = (name, attrs, children, opts) ->


    write: (content, {escape} = {}) =>
        content = safe(content) if escape
        return true if @hidden # dont emit data when this tag is hidden
        if @isempty
            @emit 'data', prettify this, "<#{@name}#{new_attrs @attrs}>"
            @isempty = no
