From 51807d094abd5bcf6ec0db33e08e8733b5afbb0d Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Fri, 9 Aug 2024 14:37:42 -0500 Subject: [PATCH] Checking readyState is interactive before listening for DOMContentLoaded --- src/htmx.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/htmx.js b/src/htmx.js index e7613d151..6c40f41e5 100644 --- a/src/htmx.js +++ b/src/htmx.js @@ -4899,7 +4899,7 @@ var htmx = (function() { function ready(fn) { // Checking readyState here is a failsafe in case the htmx script tag entered the DOM by // some means other than the initial page load. - if (isReady || getDocument().readyState === 'complete') { + if (isReady || getDocument().readyState === 'interactive' || getDocument().readyState === 'complete') { fn() } else { getDocument().addEventListener('DOMContentLoaded', fn)