Skip to content

Commit

Permalink
Fix long delay
Browse files Browse the repository at this point in the history
Port changes from jQuery
Related to requirejs#1 requirejs#18
  • Loading branch information
ihor-sviziev authored Jul 30, 2020
1 parent d85bdc3 commit 2d2dc5a
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions domReady.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,12 @@ define(function () {
}
}

//Check if document already complete, and if so, just trigger page load
//listeners. Latest webkit browsers also use "interactive", and
//will fire the onDOMContentLoaded before "interactive" but not after
//entering "interactive" or "complete". More details:
//http://dev.w3.org/html5/spec/the-end.html#the-end
//http://stackoverflow.com/questions/3665561/document-readystate-of-interactive-vs-ondomcontentloaded
//Hmm, this is more complicated on further use, see "firing too early"
//bug: https://github.com/requirejs/domReady/issues/1
//so removing the || document.readyState === "interactive" test.
//There is still a window.onload binding that should get fired if
//DOMContentLoaded is missed.
if (document.readyState === "complete") {
// Catch cases where $(document).ready() is called
// after the browser event has already occurred.
// Support: IE6-10
// Older IE sometimes signals "interactive" too soon
if (document.readyState === "complete" ||
(document.readyState !== "loading" && !document.documentElement.doScroll)) {
pageLoaded();
}
}
Expand Down

0 comments on commit 2d2dc5a

Please sign in to comment.