       return
 
     @parser.onopentag = (node) ->
+      # opened a tag.  node has "name" and "attributes"
       stack.push(node)
-      # opened a tag.  node has "name" and "attributes"
       return
 
     @parser.onclosetag = (name) =>
+      # closed a tag. "name" is tag name
       node = stack.pop()
       result = {}
       res2 = {}

        parent = stack[stack.length - 1]
        parent.children ?= []
        parent.children.push(result)
      # closed a tag. "name" is tag name
      return



  write: (text) ->
    @parser.write(text)
    
  on: (event, cb) ->
    @events.on event, cb
    

{EventEmitter} = require 'events'
sax = require 'sax'

module.exports = 
class Parser
