tag:blogger.com,1999:blog-34454975.post2054178607398490137..comments2023-06-28T16:58:41.189+02:00Comments on Web Reflection: 195 Chars To Help Lazy LoadingAndrea Giammarchihttp://www.blogger.com/profile/16277820774810688474noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-34454975.post-80490253176461720812011-08-13T09:19:52.849+02:002011-08-13T09:19:52.849+02:00I know FF5 is out, but a bunch of people still use...I know FF5 is out, but a bunch of people still use this < 3.6 so thanks a bunch! This script worked perfectly!Rickhttps://www.blogger.com/profile/11799865735082753492noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-62321036907654163272009-11-20T12:48:46.689+01:002009-11-20T12:48:46.689+01:00Shade, I have removed the named function expressio...Shade, I have removed the named function expressionAndrea Giammarchihttps://www.blogger.com/profile/16277820774810688474noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-17117818061597342592009-11-19T08:58:47.366+01:002009-11-19T08:58:47.366+01:00@Shade, it was broken but I have updated it and it...@Shade, it was broken but I have updated it and it works like a charm.<br />About the leak, that scope is parsed but never used/referenced via IE (so no leaks), I don't think even in the unpatched IE6 that little single scoped function will be a problem, compared with the total amount of scripts that does not care at all about these kind of leaks (never seen a library with hundreds of null assignment at the end for non IE functions, specially in a features detection script where you cannot even know which function should be removed)<br />Feel free in any case to use your "bigger" version if you think it's worth it.<br />I did not invent anything here, it is just a proof of concept with a manually minified suggestion ;-)Andrea Giammarchihttps://www.blogger.com/profile/16277820774810688474noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-53798548705349813382009-11-19T01:40:27.619+01:002009-11-19T01:40:27.619+01:00@Andrea-
The full version of your code works grea...@Andrea-<br /><br />The full version of your code works great to "patch" a page for proper document.readyState behavior for FF < 3.6.<br /><br />But the minified version of your script is broken, and moreover I believe it has an unsafe (memory-leak-wise) named-function-expression. <br /><br />I submit this version, which is slightly larger (209 characters) which works, and avoids the named-function-expression.<br /><br />(function(a,b,c,d){if(a[b]==null&&a[c]){a[c](d,function(){a.removeEventListener(d,arguments.callee,false);a[b]="complete"},false);a[b]="loading"}})(document,"readyState","addEventListener","DOMContentLoaded");getifyhttps://www.blogger.com/profile/01884519514982705317noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-42757860834766102992009-11-18T08:44:47.833+01:002009-11-18T08:44:47.833+01:00I wonder the same but since it should be undefined...I wonder the same but since it should be undefined, at least this is the FF case, and not 0, false, or an empty string, I thought for this post purpose made sense to compare with undefined or null only. Feel free to change it to have 191 charsAndrea Giammarchihttps://www.blogger.com/profile/16277820774810688474noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-505973862858856282009-11-18T01:45:48.952+01:002009-11-18T01:45:48.952+01:00nice, I'm just wondering if "document.rea...nice, I'm just wondering if "document.readyState == null" could be !('readyState' in document)RStankovhttps://www.blogger.com/profile/17939870090130016723noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-16964787092664218372009-11-18T00:23:06.335+01:002009-11-18T00:23:06.335+01:00cheers mate ... that happens when you are tired :D...cheers mate ... that happens when you are tired :D - updatedAndrea Giammarchihttps://www.blogger.com/profile/16277820774810688474noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-32448964304096847082009-11-17T23:30:35.312+01:002009-11-17T23:30:35.312+01:00Shouldn’t the third s[l+e] be s[v+e]?Shouldn’t the third s[l+e] be s[v+e]?Azat Razetdinovhttps://www.blogger.com/profile/18129808378496136541noreply@blogger.com