[FIX] utils: whenReady should work for all document states

Document readyState can be either 'loading', 'interactive' or
'complete'. We can access the DOM whenever we are no longer in 'loading'
state.
This commit is contained in:
Géry Debongnie
2019-06-08 16:20:44 +02:00
parent f881640d3d
commit b53a34b7d1
+1 -1
View File
@@ -11,7 +11,7 @@
*/
export function whenReady(fn) {
if (document.readyState === "complete") {
if (document.readyState !== "loading") {
fn();
} else {
document.addEventListener("DOMContentLoaded", fn, false);