             #TODO: figure out how to make this work with JSDOM.
             when 'KeyboardEvent'
                 event.initKeyboardEvent(clientEv.type, clientEv.bubbles,
-                                        clientEv.cancelable, null,
+                                        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, null,
+                                           clientEv.cancelable, @browser.window,
                                            clientEv.data, clientEv.locale)
 
 

                                     clientEv.relatedTarget)
            when 'TextEvent'
                event.initTextEvent(clientEv.type, clientEv.bubbles,
                                    clientEv.cancelable, null, clientEv.data,
                                    clientEv.inputMethod, clientEv.locale)

            when 'WheelEvent'
                event.initWheelEvent(clientEv.type, clientEv.bubbles,
                                     clientEv.cancelable, null,
                                     clientEv.detail, clientEv.screenX,
                                     clientEv.screenY, clientEv.clientX,
                                     clientEv.clientY, clientEv.button,

            when 'UIEvents' # TODO: JSDOM only has level 2 events, so we have to have the s.
                # Currently setting view to null
                event.initUIEvent(clientEv.type, clientEv.bubbles,
                                  clientEv.cancelable, @browser.window, clientEv.detail)
            when 'FocusEvent'
                event.initFocusEvent(clientEv.type, clientEv.bubbles,
                                     clientEv.cancelable, @browser.window,
                                     clientEv.detail, clientEv.relatedTarget)
            when 'MouseEvents'
                event.initMouseEvent(clientEv.type, clientEv.bubbles,
                                     clientEv.cancelable, @browser.window,
                                     clientEv.detail, clientEv.screenX,
                                     clientEv.screenY, clientEv.clientX,
                                     clientEv.clientY, clientEv.ctrlKey,
