mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[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:
+1
-1
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
export function whenReady(fn) {
|
||||
if (document.readyState === "complete") {
|
||||
if (document.readyState !== "loading") {
|
||||
fn();
|
||||
} else {
|
||||
document.addEventListener("DOMContentLoaded", fn, false);
|
||||
|
||||
Reference in New Issue
Block a user