ff-stream-web

git clone git://archive.git.mtrnord.blog/MTRNord/ff-stream-web.git
Log | Files | Refs | README | LICENSE

commit bc1b5416c88e4932d2a0c47af3951d8855415651
parent 989918622ee2811847cdc8d78fdf11fa4e4b7381
Author: Konstantin Tarkus <hello@tarkus.me>
Date:   Sat, 17 Oct 2015 17:52:21 +0300

Update DOMContentLoaded handler in app.js

Diffstat:
Msrc/app.js | 9++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/app.js b/src/app.js @@ -89,10 +89,9 @@ function run() { }); } -// Run the application when both DOM is ready -// and page content is loaded -if (window.addEventListener) { - window.addEventListener('DOMContentLoaded', run); +// Run the application when both DOM is ready and page content is loaded +if (['complete', 'loaded', 'interactive'].includes(document.readyState) && document.body) { + run(); } else { - window.attachEvent('onload', run); + document.addEventListener('DOMContentLoaded', run, false); }