Skip to content

Commit

Permalink
Fixes #10918, move away from old IE domcontentloaded approximation to…
Browse files Browse the repository at this point in the history
… something that should work better. Made detection of page loaded after dojo is added to the page better too.

git-svn-id: http://svn.dojotoolkit.org/src/dojo/trunk@21706 560b804f-0ae3-0310-86f3-f6aa0a117693
  • Loading branch information
jrburke committed Apr 3, 2010
1 parent 4f1f5ba commit a3125b3
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions _base/_loader/hostenv_browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ if(typeof window != 'undefined'){
}
}

if(!dojo.config.afterOnLoad){
if(!dojo.config.afterOnLoad){
if(document.addEventListener){
//Standards. Hooray! Assumption here that if standards based,
//it knows about DOMContentLoaded. It is OK if it does not, the fall through
Expand All @@ -393,23 +393,28 @@ if(typeof window != 'undefined'){
window.addEventListener("load", dojo._loadInit, false);
}else if(window.attachEvent){
window.attachEvent("onload", dojo._loadInit);

//DOMContentLoaded approximation. Diego Perini found this MSDN article
//that indicates doScroll is available after DOM ready, so do a setTimeout
//to check when it is available.
//http://msdn.microsoft.com/en-us/library/ms531426.aspx
if(!dojo.config.skipIeDomLoaded && self === self.top){
dojo._scrollIntervalId = setInterval(function (){
try{
document.documentElement.doScroll("left");
dojo._loadInit();
if(dojo._scrollIntervalId){
clearInterval(dojo._scrollIntervalId);
dojo._scrollIntervalId = 0;
}
}catch (e){}
}, 30);
}
}
}

//>>excludeStart("webkitMobile", kwArgs.webkitMobile);
if(dojo.isIE){
// for Internet Explorer. readyState will not be achieved on init
// call, but dojo doesn't need it however, we'll include it
// because we don't know if there are other functions added that
// might. Note that this has changed because the build process
// strips all comments -- including conditional ones.
if(!dojo.config.afterOnLoad && !dojo.config.skipIeDomLoaded){
document.write('<scr'+'ipt defer src="//:" '
+ 'onreadystatechange="if(this.readyState==\'complete\'){' + dojo._scopeName + '._loadInit();}">'
+ '</scr'+'ipt>'
);
}

try{
document.namespaces.add("v", "urn:schemas-microsoft-com:vml");
var vmlElems = ["*", "group", "roundrect", "oval", "shape", "rect", "imagedata"],
Expand Down

0 comments on commit a3125b3

Please sign in to comment.