Domready Solution for mass framework
1 //the domready scheme of mass2 varReadylist = [];3Mass.ready =function(FN) {4 if(readylist) {5 Fn.push (FN);6}Else {7 fn ();8 }9 }Ten varREADYFN, ready = the? "domcontentloaded": "ReadyStateChange"; One functionFireReady () { A for(vari = 0, fn; fn = readylist[i++]; ) { - fn (); - } theReadylist =NULL; -FireReady = $.noop;//lazy function to prevent IE9 from calling _checkdeps two times - } - + functionDoscrollcheck () { - Try{//Doscrollcheck detects if the DOM tree is built under IE +Html.doscroll ("left"); A FireReady (); at}Catch(e) { - setTimeout (doscrollcheck); - } - } - - //before Firefix3.6, there is no readystate attribute in if(!doc.readystate) { - varReadyState = Doc.readystate = Doc.body? "Complete": "Loading"; to } + if(Doc.readystate = = = "complete") { -FireReady ();//If you are loading outside of Domready the}Else { *$.bind (DOC, ready, READYFN =function() { $ if(Online | | Doc.readystate = = = "complete") {Panax Notoginseng FireReady (); - if(readyState) {//can't rewrite doc.readystate under IE theDoc.readystate = "complete"; + } A } the }); + if(html.doscroll) { - Try{//If the cross-domain error occurs, then it must have proved that there are two windows $ if(Self.eavl = = =parent.eval) { $ Doscrollcheck (); - } -}Catch(e) { the Doscrollcheck (); - }Wuyi } the}
The Domready scheme of mass