 
 
 class Tag extends EventEmitter
-    constructor: (@name, @attrs, children, opts) ->
-        unless typeof @attrs is 'object'
-            [opts, children, @attrs] = [children, @attrs, {}]
-        else
-            # if attrs is an object and you want to use opts, make children null
-            @attrs ?= {}
-            opts ?= {}
+    constructor: ->
+        [@name, @attrs, children, opts] = parse_args arguments...
         @pretty = opts.pretty ? off
         @level = opts.level
         @builder = opts.builder #or new Builder # inheritence

EVENTS = ['add', 'attr', 'attr:remove', 'text', 'remove', 'close']


new_tag = (name, attrs, children, opts) ->
    unless typeof attrs is 'object'
        [opts, children, attrs] = [children, attrs, {}]
    else
        # if attrs is an object and you want to use opts, make children null
        attrs ?= {}
    opts ?= {}
    pipe = {}
    opts.level ?= @level+1


    return tag


sync_tag = ->
    [name, attrs, children, opts] = parse_args arguments...
    self_ending_children_scope = ->
        @children children
        @end()
