                                      clientEv.relatedTarget)
             when 'TextEvent'
                 event.initTextEvent(clientEv.type, clientEv.bubbles,
-                                    clientEv.cancelable, null, clientEv.data,
+                                    clientEv.cancelable, @browser.window, clientEv.data,
                                     clientEv.inputMethod, clientEv.locale)
 
             when 'WheelEvent'
                 event.initWheelEvent(clientEv.type, clientEv.bubbles,
-                                     clientEv.cancelable, null,
+                                     clientEv.cancelable, @browser.window,
                                      clientEv.detail, clientEv.screenX,
                                      clientEv.screenY, clientEv.clientX,
                                      clientEv.clientY, clientEv.button,

            else
                throw new Error "target doesn't have 'value' attribute"
        else
            console.log "Dispatching #{event.type} [#{group}] on #{clientEv.target[@browser.idProp]}"
            clientEv.target.dispatchEvent(event)

    _buildTables : ->

            #TODO: figure out how to make this work with JSDOM.
            when 'KeyboardEvent'
                event.initKeyboardEvent(clientEv.type, clientEv.bubbles,
                                        clientEv.cancelable, @browser.window,
                                        clientEv.char, clientEv.key,
                                        clientEv.location,
                                        clientEv.modifiersList,
                                        clientEv.repeat, clientEv.locale)
            when 'CompositionEvent'
                event.initCompositionEvent(clientEv.type, clientEv.bubbles,
                                           clientEv.cancelable, @browser.window,
                                           clientEv.data, clientEv.locale)


