Fix issues with window load events.

Window load events are supposed to be dispatched on the window with the target
set to document and the currentTarget set to the window.