tag:blogger.com,1999:blog-34454975.post852449658845910992..comments2023-06-28T16:58:41.189+02:00Comments on Web Reflection: What's wrong with new IEContentLoaded solution?Andrea Giammarchihttp://www.blogger.com/profile/16277820774810688474noreply@blogger.comBlogger12125tag:blogger.com,1999:blog-34454975.post-11953256453057442722007-10-05T11:58:00.000+02:002007-10-05T11:58:00.000+02:00it should prevent just setTimeout Jake but if You ...it should prevent just setTimeout Jake but if You don't throw errors inside try catch your code will never work.<BR/><BR/>However, You can choose to write this trick as You prefere and I suppose there's any problem with your last example :-)<BR/><BR/>Best RegardsAndrea Giammarchihttps://www.blogger.com/profile/16277820774810688474noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-13269987944846541722007-10-05T11:55:00.000+02:002007-10-05T11:55:00.000+02:00When I discovered the issue I was trying to throw ...When I discovered the issue I was trying to throw a helpful error in an application, not because I'd written buggy code.<BR/><BR/>Either way, gobbling errors is never a good idea.<BR/><BR/>How about...<BR/><BR/>f=function(){try{n.doScroll('left')}catch(e){setTimeout(f,10);return}c()}<BR/><BR/>Or does that create problems I'm missing?Jake Archibaldhttps://www.blogger.com/profile/04599856665408765772noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-69665017809283451282007-10-05T11:45:00.000+02:002007-10-05T11:45:00.000+02:00quite obvious Jake but I hope your DOMReady code, ...quite obvious Jake but I hope your DOMReady code, one day, will work without exceptions :D<BR/><BR/>P.S. don't call them infinite loop, it's just an intervalAndrea Giammarchihttps://www.blogger.com/profile/16277820774810688474noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-4332706414000156592007-10-05T11:34:00.000+02:002007-10-05T11:34:00.000+02:00Problem with the solution above: If the callback t...Problem with the solution above: If the callback throws an error, it'll send IE into an infinite loop.<BR/><BR/>Eg.<BR/><BR/>onReady(function() { alert("hi!"); lalala(); });Jake Archibaldhttps://www.blogger.com/profile/04599856665408765772noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-76465709245574932802007-09-27T18:54:00.000+02:002007-09-27T18:54:00.000+02:00Sry, but you have missunderstood me, with timeout ...Sry, but you have missunderstood me, with timeout 0 I meant this original code listed in your post (+ajaxian) - not yours!<BR/><BR/>I'am only using the "Dean"-way for production-releases, too. But I like clever __attempts__ to solve common problems like this in another way... ;)<BR/><BR/>okAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-34454975.post-79725303919534464422007-09-27T14:44:00.000+02:002007-09-27T14:44:00.000+02:00Andrea,use "document.documentElement" as in the or...Andrea,<BR/>use "document.documentElement" as in the original solution (see Dean blog) and my lab site, instead of "document.firstChild". Your solution is also likely to break...<BR/><BR/>I may be wrong but if the "document" is a well written (x)HTML it will probably fail because the "firstChild" will then be a "DOCTYPE" declaration with node type 8.<BR/><BR/>If there is a line-feed or even a space before the HTML tag it will also break.<BR/>I would be surprised if it doesn't.<BR/><BR/>So all you said about Hedger Wang "bad" modifications to my original "test" case ( see http://javascript.nwbox.com/IEContentLoaded/ ) are completely correct, he probably just believed the document will scroll !?! I did also believe that initially...<BR/><BR/>For a cross-browser solution, included this IE trick/hack, my take to it has always been here:<BR/><BR/>http://javascript.nwbox.com/ContentLoaded/ <BR/><BR/>I know everybody will take that code and rebuild their own, but that was the objective :-)<BR/><BR/>If I can help slice down lost testing hours for you and other developers, forget trying other methods like "document.recalc()" (that also works the same for our objective).<BR/><BR/>Really Microsoft says "there are a few methods like doScroll()"...but what I claim about being my idea is to join this with a try/catch construct and "documentElement".<BR/><BR/>The next idea is to completely avoid the setTimout or setInterval and use it like an event to check the "doScroll()".<BR/><BR/>My real trick (which is an extension of this basic one) will be published as soon, as time permits...or as soon somebody find flaws with this method. I am only a test cases guy, no fancy website sorry...And yes I also have bugs in my code.<BR/><BR/>The "red", "green" test case I have on my lab site is a good test for the "onload" moment we are looking for, so you may use it with other solutions and compare.<BR/><BR/>I also suggest some reading here, which is slightly related to this and presents still another solution to the problem.<BR/><BR/>http://peter.michaux.ca/article/3752<BR/><BR/>which is also based on my "NWEvents" and related event Delegates in a new strange way.<BR/><BR/>Diego PeriniAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-34454975.post-31813077931329400522007-09-27T12:18:00.000+02:002007-09-27T12:18:00.000+02:00Andrea,you took the code from a place where it was...Andrea,<BR/>you took the code from a place where it was slightly modified from my original code posted here:<BR/><BR/>http://javascript.nwbox.com/IEContentLoaded/<BR/><BR/>My original solution was also posted on Dean blog and it was using the "document.documentElement" as a source for this trick since that node is the only node available during startup and we can be sure it always exists even in wrongly written pages.<BR/><BR/>I wanted to keep this as simple as possible without creating/extending anything.<BR/><BR/>Beside that, scrolling "documentElement" to the left seemed safe to me because the HTML node is normally not used to scroll the page "left"...<BR/><BR/>I have a better solution based on the same trick but acting like an event instead of polling, but I prefer to keep that on test for some time before releasing it.<BR/><BR/>Diego PeriniAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-34454975.post-1899291182948159202007-09-27T12:17:00.000+02:002007-09-27T12:17:00.000+02:00You are welcome Francesco and thank You too for th...You are welcome Francesco and thank You too for this comment :-)Andrea Giammarchihttps://www.blogger.com/profile/16277820774810688474noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-31480516249974594682007-09-27T11:50:00.000+02:002007-09-27T11:50:00.000+02:00Ciao Andrea.Seguo di tanto in tanto le tue soluzio...Ciao Andrea.<BR/>Seguo di tanto in tanto le tue soluzioni e trovo che siano sempre molto interessanti. Volevo solo farti i complimenti e per pigrizia te li faccio come commento ad un interessante post.<BR/>Tante belle cose,<BR/>FrancescoAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-34454975.post-13686790481865847802007-09-26T20:23:00.000+02:002007-09-26T20:23:00.000+02:00P.S. JPU is just an experiment (a toy if You prefe...P.S. JPU is just an experiment (a toy if You prefere) ... if You can understand its logic, You can understand why it will never be perfect.<BR/><BR/>However, if Opera use more CPU while You scroll a page, JPU will grow up :-)Andrea Giammarchihttps://www.blogger.com/profile/16277820774810688474noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-77396975540974646892007-09-26T20:21:00.000+02:002007-09-26T20:21:00.000+02:00Oliver, my last 2 functions doesn't use timeout 0 ...Oliver, my last 2 functions doesn't use timeout 0 ... and if You read entire post You'll see that I'm not sure about doScroll behaviour and that Dean solution, actually my favourite one and the only one I use, should have problems with script source.<BR/><BR/>However, thank You but please read post before another comment, ok? :DAndrea Giammarchihttps://www.blogger.com/profile/16277820774810688474noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-59997810988753218442007-09-26T19:26:00.000+02:002007-09-26T19:26:00.000+02:00the thought rethought!thx, this idea was generelly...the thought rethought!<BR/><BR/>thx, this idea was generelly a bit strange (timeout=0) for me... but now it's like a realy nice attempt to solve this DOMShitWhatever-problem in a "Not-Dean-Edwards-Way" :D nice work, compliment!<BR/><BR/>Some other question: I'am asking me why your beatiful JPU is going crazy if I scroll in Opera? I haven't notice this behavior in other Browsers... btw. thx, again for this great work!<BR/><BR/>okAnonymousnoreply@blogger.com