envjs / env-js

A pure-JavaScript browser environment.
http://www.envjs.com/
87 stars 19 forks source link

window.unload event not emitted #16

Open orslumen opened 13 years ago

orslumen commented 13 years ago

When a different page is loaded, the window.unload event is not emitted.

For now I have added the following code at the top of Envjs.exchangeHTMLDocument in core.js: try { if (doc === window.document) { event = doc.createEvent('HTMLEvents'); event.initEvent('unload', false, false); window.dispatchEvent( event, false ); } } catch (eee) { log.debug('window unload event failed %s', eee); //swallow }

I am note sure though whether or not this code is in the right location... see https://github.com/orslumen/env-js/commit/2c2027e775b6fc9cc78647c3eefb5777d35ddff9