Skip to content

Commit b67b29a

Browse files
committed
Fixes requirejs#266, if document.readyState is in interactive, it means dom can be touched.
1 parent 61ab4e1 commit b67b29a

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

domReady.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,13 @@ define(function () {
8383
}
8484

8585
//Check if document already complete, and if so, just trigger page load
86-
//listeners.
87-
if (document.readyState === "complete") {
86+
//listeners. Latest webkit browsers also use "interactive", and
87+
//will fire the onDOMContentLoaded before "interactive" but not after
88+
//entering "interactive" or "complete". More details:
89+
//http://dev.w3.org/html5/spec/the-end.html#the-end
90+
//http://stackoverflow.com/questions/3665561/document-readystate-of-interactive-vs-ondomcontentloaded
91+
if (document.readyState === "complete" ||
92+
document.readyState === "interactive") {
8893
pageLoaded();
8994
}
9095
}

0 commit comments

Comments
 (0)