       newConfig[key] = value for own key, value of args
       newConfig
 
+    _on: (elt, evt, callback) ->
+      if window.addEventListener
+        elt.addEventListener evt, callback, false
+      else if window.attachEvent
+        elt.attachEvent "on#{evt}", callback
+
     _addEventHandlers: ->
-      @el.addEventListener 'input', (e) =>
+      @_on(@el, 'input', (e) =>
         @_searchFor e.currentTarget.value
-
-      @el.addEventListener 'keypress', (e) =>
+      )
+      @_on(@el, 'keydown', (e) =>
         @_keypressHandler e
+      )
 
     _setupXHR: ->
       xhr = new XMLHttpRequest()
-      xhr.addEventListener 'readystatechange', =>
+      xhr.onreadystatechange = =>
         if @xhr.readyState == 4
           if @xhr.status == 200
             @_populateResults JSON.parse(@xhr.responseText), @currentSearch

      @_addClass results, @config.resultsClass
      @_addClass results, "#{@config.resultsClass}--#{@config.classModifier}" if @config.classModifier

      results.addEventListener 'click', (e) =>
        @_resultsClick e
      , false

      results.addEventListener 'mouseover', (e) =>
        @_resultsMouseOver e.target
      , false

      results.addEventListener 'mouseout', (e) =>
        @_resultsMouseOut e.target
      , false

      results

    # event handlers

    _init: (args) ->
      @config = @_updateConfig args
      @el = document.getElementById @config.id
      @xhr = @_setupXHR()
      @_addEventHandlers()
      @results = @_buildResults()

    _updateConfig: (args) ->
      newConfig = {}
