Skip to content

Commit

Permalink
add extra check if dom is already ready
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioCrisostomo committed Feb 24, 2015
1 parent 1c3e4d3 commit 80b6695
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Source/Utilities/DOMReady.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ if (document.readyState) checks.push(function(){
return (state == 'loaded' || state == 'complete');
});

if ('onreadystatechange' in document) document.addListener('readystatechange', check);
if ('onreadystatechange' in document){
document.addListener('readystatechange', check);
var state = document.readyState;
if (state == 'loaded' || state == 'complete') domready();
}
else shouldPoll = true;

if (shouldPoll) poll();
Expand Down

0 comments on commit 80b6695

Please sign in to comment.