From 347ce7a19f5c15a91a4fca166505e0b397b160ed Mon Sep 17 00:00:00 2001 From: Alexander Petros Date: Fri, 4 Aug 2023 19:10:26 -0400 Subject: [PATCH] Add interactive check to ready event handler (#1672) If HTMX is imported in a module the readyState is "interactive" so the extension processing happens too late. This would fix it. Co-authored-by: Dave Syer --- src/htmx.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/htmx.js b/src/htmx.js index f41c8a92..54b0e9d6 100644 --- a/src/htmx.js +++ b/src/htmx.js @@ -3605,7 +3605,7 @@ return (function () { //==================================================================== function ready(fn) { - if (getDocument().readyState !== 'loading') { + if (getDocument().readyState === 'complete') { fn(); } else { getDocument().addEventListener('DOMContentLoaded', fn);