At Mozilla we're prototyping Promises for document.parsed, document.contentLoaded and document.loaded. You can use these instead of the readystatechange event.
Head to `about:config`, toggle `dom.document.load_promises.enabled` to try it out. Also try the polyfill: github.com/keithamus/do...
