Skip to content
Browse files

Ensure we set `document.loaded` to `true` (and fire `dom:loaded`) whe…

…n Prototype is loaded asynchronously after DOMContentLoaded.
  • Loading branch information...
1 parent 95ccdc5 commit addd725de13bcef84e31ae791cd81e98a1844a06 @savetheclocktower savetheclocktower committed Aug 31, 2012
Showing with 9 additions and 0 deletions.
  1. +9 −0 src/prototype/dom/event.js
View
9 src/prototype/dom/event.js
@@ -1407,6 +1407,15 @@
fireContentLoadedEvent();
}
+
+
+ if (document.readyState === 'complete') {
+ // We must have been loaded asynchronously, because the DOMContentLoaded
+ // event has already fired. We can just fire `dom:loaded` and be done
+ // with it.
+ fireContentLoadedEvent();
+ return;
+ }
if (document.addEventListener) {
// All browsers that support DOM L2 Events support DOMContentLoaded,

0 comments on commit addd725

Please sign in to comment.
Something went wrong with that request. Please try again.