Skip to content

Commit

Permalink
Checking readyState is interactive before listening for DOMContentLoaded
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-ebsco committed Aug 9, 2024
1 parent b610776 commit 51807d0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/htmx.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 51807d0

Please sign in to comment.