<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: ELO &#8211; Encapsulated Load Object &#8211; The ultimate way to handle window load events</title>
	<atom:link href="http://robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/feed/" rel="self" type="application/rss+xml" />
	<link>http://robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/</link>
	<description>Web development and Internet trends</description>
	<lastBuildDate>Sat, 13 Mar 2010 22:37:13 +0100</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Javascript para auxiliar o estudo de mÃƒÂ©tricas &#187; Japs</title>
		<link>http://robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-64352</link>
		<dc:creator>Javascript para auxiliar o estudo de mÃƒÂ©tricas &#187; Japs</dc:creator>
		<pubDate>Mon, 28 May 2007 19:24:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-64352</guid>
		<description>[...] utilizando tambÃƒÂ©m o ELO - Encapsulated Load Object para adicionar a funÃƒÂ§ÃƒÂ£o no onload da pÃƒÂ¡gina, estou disponibilizando os dois scripts para [...]</description>
		<content:encoded><![CDATA[<p>[...] utilizando tambÃƒÂ©m o ELO &#8211; Encapsulated Load Object para adicionar a funÃƒÂ§ÃƒÂ£o no onload da pÃƒÂ¡gina, estou disponibilizando os dois scripts para [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-55429</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Wed, 02 May 2007 06:57:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-55429</guid>
		<description>Aldrik,

ELF: Ha ha! :-)
Thanks for sharing!</description>
		<content:encoded><![CDATA[<p>Aldrik,</p>
<p>ELF: Ha ha! <img src='http://robertnyman.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
Thanks for sharing!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aldrik</title>
		<link>http://robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-55346</link>
		<dc:creator>Aldrik</dc:creator>
		<pubDate>Tue, 01 May 2007 21:24:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-55346</guid>
		<description>Great script Robert! I&#039;ve made some changes some time ago &amp; have been meaning to share. I call it &lt;a href=&quot;http://www.alunamation.com/lab/elf/&quot; rel=&quot;nofollow&quot;&gt;ELF&lt;/a&gt;. :)

Changes: added Konqueror &amp; 64bit IE support (I assume @_win32 doesn&#039;t work on 64bit but have not been able to test (vista x64 blue screens upon boot on my hardware)), it&#039;s also a bit smaller in file size.</description>
		<content:encoded><![CDATA[<p>Great script Robert! I&#8217;ve made some changes some time ago &amp; have been meaning to share. I call it <a href="http://www.alunamation.com/lab/elf/" rel="nofollow">ELF</a>. <img src='http://robertnyman.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Changes: added Konqueror &amp; 64bit IE support (I assume @_win32 doesn&#8217;t work on 64bit but have not been able to test (vista x64 blue screens upon boot on my hardware)), it&#8217;s also a bit smaller in file size.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-29704</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Tue, 23 Jan 2007 07:33:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-29704</guid>
		<description>Stefan,

Well, I have a Mac, but I don&#039;t want to taint it with a nasty IE 5. :-)
Besides, I don&#039;t put any extra time into supporting IE on Mac anymore, since developing on it stopped a number of years ago and the user base is just too small.</description>
		<content:encoded><![CDATA[<p>Stefan,</p>
<p>Well, I have a Mac, but I don&#8217;t want to taint it with a nasty IE 5. <img src='http://robertnyman.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
Besides, I don&#8217;t put any extra time into supporting IE on Mac anymore, since developing on it stopped a number of years ago and the user base is just too small.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Van Reeth</title>
		<link>http://robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-29573</link>
		<dc:creator>Stefan Van Reeth</dc:creator>
		<pubDate>Mon, 22 Jan 2007 17:06:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-29573</guid>
		<description>Well, is there anyone who can test this for us? I know nobody with a Mac. No point discussing something we can&#039;t check ourselves ;).</description>
		<content:encoded><![CDATA[<p>Well, is there anyone who can test this for us? I know nobody with a Mac. No point discussing something we can&#8217;t check ourselves <img src='http://robertnyman.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-29571</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Mon, 22 Jan 2007 16:53:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-29571</guid>
		<description>Stefan,

No matter if we&#039;re accessing it or not, I doubt that &lt;code&gt;clipboardData&lt;/code&gt; or any &lt;code&gt;external&lt;/code&gt; property are available in IE on Mac, so just checking if it&#039;s there or not will likely fail.</description>
		<content:encoded><![CDATA[<p>Stefan,</p>
<p>No matter if we&#8217;re accessing it or not, I doubt that <code>clipboardData</code> or any <code>external</code> property are available in IE on Mac, so just checking if it&#8217;s there or not will likely fail.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Van Reeth</title>
		<link>http://robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-29561</link>
		<dc:creator>Stefan Van Reeth</dc:creator>
		<pubDate>Mon, 22 Jan 2007 15:51:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-29561</guid>
		<description>We never access it here Robert, but just sniff it&#039;s presence. Or did I misunderstood what you mean?

And there is a whole list of &quot;externals&quot; in IE, like window.window. It doesn&#039;t have to be the one above, we just have to settle for one that&#039;s found in all versions of it. In other browsers that list is limited to the Java stuff (at least Opera and Mozilla family).

Admitted, looking the presence of window.clipboardData on the Mac is probably not the way to go, but hey, I just picked one as an example...</description>
		<content:encoded><![CDATA[<p>We never access it here Robert, but just sniff it&#8217;s presence. Or did I misunderstood what you mean?</p>
<p>And there is a whole list of &#8220;externals&#8221; in IE, like window.window. It doesn&#8217;t have to be the one above, we just have to settle for one that&#8217;s found in all versions of it. In other browsers that list is limited to the Java stuff (at least Opera and Mozilla family).</p>
<p>Admitted, looking the presence of window.clipboardData on the Mac is probably not the way to go, but hey, I just picked one as an example&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-29497</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Mon, 22 Jan 2007 08:01:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-29497</guid>
		<description>Stefan,

Interesting approach! Two things to mention, though:

First, for security reasons, it seems likely, (at least to me), that maybe IE will block the access to &lt;code&gt;clipboardData&lt;/code&gt;.

Second, I haven&#039;t tested, but I&#039;m fairly sure IE on Mac wouldn&#039;t let you access &lt;code&gt;clipboardData&lt;/code&gt;.</description>
		<content:encoded><![CDATA[<p>Stefan,</p>
<p>Interesting approach! Two things to mention, though:</p>
<p>First, for security reasons, it seems likely, (at least to me), that maybe IE will block the access to <code>clipboardData</code>.</p>
<p>Second, I haven&#8217;t tested, but I&#8217;m fairly sure IE on Mac wouldn&#8217;t let you access <code>clipboardData</code>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By:  </title>
		<link>http://robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-29429</link>
		<dc:creator> </dc:creator>
		<pubDate>Sun, 21 Jan 2007 23:47:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-29429</guid>
		<description>As promised, here&#039;s an alternative way to let the conditional comments (not statements lol) go:

I&#039;ve kept the original code between the conditional comments intact, to keep it simple here. It&#039;s also possible to add the script by the DOM, but there are a few gotcha&#039;s there, and that wasn&#039;t the goal I set out for anyway. For those interested, it IS solved by yours truly ;).

The alternative here requires a bit extra code, but those funcs (and other typecheckers) are missing in javascript anyway. It&#039;s one of those things that are in my common.js. Also I&#039;ve written it out quite elaborate, just to make the workings clearer. Everyone feel free to crunch it as much you like :).
&lt;code&gt;
if (isExternal(window.clipboardData))
{
document.write( &quot;&lt;script id=__ie_onload defer src=javascript:void(0)&gt;&lt;\/script&gt;&quot; );
var script = document.getElementById( &quot;__ie_onload&quot; );
script.onreadystatechange = function() {
    if ( this.readyState == &quot;complete&quot; ) {
        init(); // call the onload handler
    }
};
}

function isExternal(item)
{
	if (isObject(item))
	{
		return typeof item.constructor !== &quot;function&quot;;
	}
	else
	{
		return false;
	}
}
	
function isObject(item)
{
	if (!(item &amp;&amp; typeof item === &quot;object&quot;))
	{
		return isFunction(item);
	}
	else
	{
		return true;
	}
}
	
function isFunction(item)
{
	return typeof item === &quot;function&quot;;
}
&lt;/code&gt;
What we do here is searching for an object that is accessible to javascript, but isn&#039;t part of it. Like the Packages (from Java) in Mozilla for example. What I found was that IE has quite a few of them, and I picked one that seemed suitable. Instead of wrapping the IE code in those UGLY statements, this way seems much nicer and less &#039;hack&#039; to me.

What I like to have now is some feedback from IE users on the Mac. Can I use this test there too? Logically it would work just fine, but one never knows with Explorer :D.</description>
		<content:encoded><![CDATA[<p>As promised, here&#8217;s an alternative way to let the conditional comments (not statements lol) go:</p>
<p>I&#8217;ve kept the original code between the conditional comments intact, to keep it simple here. It&#8217;s also possible to add the script by the DOM, but there are a few gotcha&#8217;s there, and that wasn&#8217;t the goal I set out for anyway. For those interested, it IS solved by yours truly <img src='http://robertnyman.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>
<p>The alternative here requires a bit extra code, but those funcs (and other typecheckers) are missing in javascript anyway. It&#8217;s one of those things that are in my common.js. Also I&#8217;ve written it out quite elaborate, just to make the workings clearer. Everyone feel free to crunch it as much you like <img src='http://robertnyman.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .<br />
<code><br />
if (isExternal(window.clipboardData))<br />
{<br />
document.write( &quot;&lt;script id=__ie_onload defer src=javascript:void(0)&gt;&lt;\/script&gt;&quot; );<br />
var script = document.getElementById( &quot;__ie_onload&quot; );<br />
script.onreadystatechange = function() {<br />
    if ( this.readyState == &quot;complete&quot; ) {<br />
        init(); // call the onload handler<br />
    }<br />
};<br />
}</p>
<p>function isExternal(item)<br />
{<br />
	if (isObject(item))<br />
	{<br />
		return typeof item.constructor !== "function";<br />
	}<br />
	else<br />
	{<br />
		return false;<br />
	}<br />
}</p>
<p>function isObject(item)<br />
{<br />
	if (!(item &amp;&amp; typeof item === "object"))<br />
	{<br />
		return isFunction(item);<br />
	}<br />
	else<br />
	{<br />
		return true;<br />
	}<br />
}</p>
<p>function isFunction(item)<br />
{<br />
	return typeof item === "function";<br />
}<br />
</code><br />
What we do here is searching for an object that is accessible to javascript, but isn&#8217;t part of it. Like the Packages (from Java) in Mozilla for example. What I found was that IE has quite a few of them, and I picked one that seemed suitable. Instead of wrapping the IE code in those UGLY statements, this way seems much nicer and less &#8216;hack&#8217; to me.</p>
<p>What I like to have now is some feedback from IE users on the Mac. Can I use this test there too? Logically it would work just fine, but one never knows with Explorer <img src='http://robertnyman.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> .</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Van Reeth</title>
		<link>http://robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-28392</link>
		<dc:creator>Stefan Van Reeth</dc:creator>
		<pubDate>Wed, 17 Jan 2007 07:48:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-28392</guid>
		<description>Nice work Robert.

I&#039;ve seen some variants on this, but this one seems to be the easiest to use. Gonna try to rewrite it if you don&#039;t mind, so the ugly conditional statements can go (really, really hate &#039;em, but that&#039;s just me).

I&#039;ll be in touch if I succeed and it&#039;s err... presentable :).</description>
		<content:encoded><![CDATA[<p>Nice work Robert.</p>
<p>I&#8217;ve seen some variants on this, but this one seems to be the easiest to use. Gonna try to rewrite it if you don&#8217;t mind, so the ugly conditional statements can go (really, really hate &#8216;em, but that&#8217;s just me).</p>
<p>I&#8217;ll be in touch if I succeed and it&#8217;s err&#8230; presentable <img src='http://robertnyman.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-16655</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Tue, 14 Nov 2006 13:14:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-16655</guid>
		<description>Edemilson,

The script in this post doesn&#039;t use &lt;code&gt;document.write&lt;/code&gt; at all.</description>
		<content:encoded><![CDATA[<p>Edemilson,</p>
<p>The script in this post doesn&#8217;t use <code>document.write</code> at all.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Edemilson Lima</title>
		<link>http://robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-16654</link>
		<dc:creator>Edemilson Lima</dc:creator>
		<pubDate>Tue, 14 Nov 2006 12:59:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-16654</guid>
		<description>Hmmm... the website ripped many underscores in my code (it was where italics begin and end)...  :(</description>
		<content:encoded><![CDATA[<p>Hmmm&#8230; the website ripped many underscores in my code (it was where italics begin and end)&#8230;  <img src='http://robertnyman.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Edemilson Lima</title>
		<link>http://robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-16652</link>
		<dc:creator>Edemilson Lima</dc:creator>
		<pubDate>Tue, 14 Nov 2006 12:53:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-16652</guid>
		<description>A problem with this script, I think, is the document.write(), which in mostly cases can&#039;t be used inside a DIV if you get its content by an innerHTML property. document.write will mess the document. This is common in an AJAX application, so you need to put it in the main HTML document, outside any DIV.

I did create my own functions to handle events to use multiple functions (see below). I am not sure this is the most elegant way to do this, but it works fine.

// global variables
var onload_events=&#039;&#039;;
var onmousemove_events=&#039;&#039;;
var onmouseup_events=&#039;&#039;;

function onload_push(str) {
	if(str.substr(str.length-1,1)!=&#039;;&#039;) str+=&#039;;&#039;;
	onload_events+=str;
	window.onload=function() {
		eval(onload_events);
	}
}

function onmousemove_push(str) {
	if(str.substr(str.length-1,1)!=&#039;;&#039;) str+=&#039;;&#039;;
	onmousemove_events+=str;
	document.onmousemove=function(evt) {
		eval(onmousemove_events);
	}
}

function onmouseup_push(str) {
	if(str.substr(str.length-1,1)!=&#039;;&#039;) str+=&#039;;&#039;;
	onmouseup_events+=str;
	document.onmouseup=function(evt) {
		eval(onmouseup_events);
	}
}

function onload_init() {
        // flag to look after if the document was loaded
	document.loaded=true;
}

// examples
onload_push(&#039;onload_init()&#039;); 
onload_push(&#039;some_function()&#039;);
onmousemove_push(&#039;some_other_function()&#039;);
onmousemove_push(someojb+&#039;.property=&quot;value&quot;&#039;);
onmousemove_push(someobj+&#039;.method(evt)&#039;);</description>
		<content:encoded><![CDATA[<p>A problem with this script, I think, is the document.write(), which in mostly cases can&#8217;t be used inside a DIV if you get its content by an innerHTML property. document.write will mess the document. This is common in an AJAX application, so you need to put it in the main HTML document, outside any DIV.</p>
<p>I did create my own functions to handle events to use multiple functions (see below). I am not sure this is the most elegant way to do this, but it works fine.</p>
<p>// global variables<br />
var onload_events=&#8221;;<br />
var onmousemove_events=&#8221;;<br />
var onmouseup_events=&#8221;;</p>
<p>function onload_push(str) {<br />
	if(str.substr(str.length-1,1)!=&#8217;;') str+=&#8217;;';<br />
	onload_events+=str;<br />
	window.onload=function() {<br />
		eval(onload_events);<br />
	}<br />
}</p>
<p>function onmousemove_push(str) {<br />
	if(str.substr(str.length-1,1)!=&#8217;;') str+=&#8217;;';<br />
	onmousemove_events+=str;<br />
	document.onmousemove=function(evt) {<br />
		eval(onmousemove_events);<br />
	}<br />
}</p>
<p>function onmouseup_push(str) {<br />
	if(str.substr(str.length-1,1)!=&#8217;;') str+=&#8217;;';<br />
	onmouseup_events+=str;<br />
	document.onmouseup=function(evt) {<br />
		eval(onmouseup_events);<br />
	}<br />
}</p>
<p>function onload_init() {<br />
        // flag to look after if the document was loaded<br />
	document.loaded=true;<br />
}</p>
<p>// examples<br />
onload_push(&#8216;onload_init()&#8217;);<br />
onload_push(&#8217;some_function()&#8217;);<br />
onmousemove_push(&#8217;some_other_function()&#8217;);<br />
onmousemove_push(someojb+&#8217;.property=&#8221;value&#8221;&#8216;);<br />
onmousemove_push(someobj+&#8217;.method(evt)&#8217;);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Javascript Ã¨Âµâ€žÃ¦ÂºÂÃ§Â«â„¢Ã§â€šÂ¹ - Ã¨Â°Â­Ã¦Å’Â¯Ã¦Å¾â€” - Ã¥ÂÅ¡Ã¥Â®Â¢Ã¥â€ºÂ­</title>
		<link>http://robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-11629</link>
		<dc:creator>Javascript Ã¨Âµâ€žÃ¦ÂºÂÃ§Â«â„¢Ã§â€šÂ¹ - Ã¨Â°Â­Ã¦Å’Â¯Ã¦Å¾â€” - Ã¥ÂÅ¡Ã¥Â®Â¢Ã¥â€ºÂ­</dc:creator>
		<pubDate>Sat, 07 Oct 2006 06:20:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-11629</guid>
		<description>[...]      http://jeffhowden.com/code/javascript/     http://www.twinhelix.com/javascript/     http://www.robertnyman.com/category/javascript/     http://ditchnet.org/dhtmlgallery/     http: [...]</description>
		<content:encoded><![CDATA[<p>[...]      <a href="http://jeffhowden.com/code/javascript/" rel="nofollow">http://jeffhowden.com/code/javascript/</a><br />
     <a href="http://www.twinhelix.com/javascript/" rel="nofollow">http://www.twinhelix.com/javascript/</a><br />
     <a href="http://www.robertnyman.com/category/javascript/" rel="nofollow">http://www.robertnyman.com/category/javascript/</a><br />
     <a href="http://ditchnet.org/dhtmlgallery/" rel="nofollow">http://ditchnet.org/dhtmlgallery/</a><br />
     http: [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-11443</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Thu, 05 Oct 2006 06:50:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-11443</guid>
		<description>John,

Regarding the conditional comments, I&#039;m not a 100% sure. For that I used what was created and tested in &lt;a href=&quot;http://dean.edwards.name/weblog/2006/06/again/&quot; rel=&quot;nofollow&quot;&gt;Dean&#039;s script&lt;/a&gt;. So, you may very well be right, but since Dean&#039;s script has been thoroughly tested by lots of talented people and verified to work, I&#039;m a bit wary about changing that part.

The &lt;code&gt;window.onload&lt;/code&gt; part does indeed trigger the ELO method twice in web browsers that successfully applied the event in any of the ways above in the code. Therefore, the ELO object has a &lt;code&gt;loaded&lt;/code&gt; property which in turn prevents multiple execution of already called functions.</description>
		<content:encoded><![CDATA[<p>John,</p>
<p>Regarding the conditional comments, I&#8217;m not a 100% sure. For that I used what was created and tested in <a href="http://dean.edwards.name/weblog/2006/06/again/" rel="nofollow">Dean&#8217;s script</a>. So, you may very well be right, but since Dean&#8217;s script has been thoroughly tested by lots of talented people and verified to work, I&#8217;m a bit wary about changing that part.</p>
<p>The <code>window.onload</code> part does indeed trigger the ELO method twice in web browsers that successfully applied the event in any of the ways above in the code. Therefore, the ELO object has a <code>loaded</code> property which in turn prevents multiple execution of already called functions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Magnus</title>
		<link>http://robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-11423</link>
		<dc:creator>John Magnus</dc:creator>
		<pubDate>Wed, 04 Oct 2006 22:19:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-11423</guid>
		<description>Hi again Robert
I know that the &quot;@cc_on&quot; parts are conditional comments, but [in your script] don&#039;t you end it (@end) before going on to ask if the user-agent is Mozilla or Opera, then lastly asking for WebKit/Safari. Wouldn&#039;t this be asking the user-agent if it&#039;s Mozilla, Opera or Safari even if we&#039;ve identified it to be IE (via the inclusion of the conditional comment) earlier in the script....

If my coding is working correctly (my limited testing suggests so), the number of if&#039;s asked is kept at a minimum, including having the &lt;em&gt;normal&lt;/em&gt; &quot;if ... else if ...&quot; inside a conditional comment (so it&#039;s completly ignored by IE).

The last &quot;window.onload&quot; could be kept outside the &quot;if ... else if&quot; to trigger in all browsers, though wouldn&#039;t this fire the &quot;ELO event&quot; twice?

Sorry if I&#039;m not making any sense at all; JavaScript &lt;strong&gt;really&lt;/strong&gt; isn&#039;t my native language, especially when we&#039;re throwing in bits of this strange and sheldom spoken dialect from MS.... ;-)</description>
		<content:encoded><![CDATA[<p>Hi again Robert<br />
I know that the &#8220;@cc_on&#8221; parts are conditional comments, but [in your script] don&#8217;t you end it (@end) before going on to ask if the user-agent is Mozilla or Opera, then lastly asking for WebKit/Safari. Wouldn&#8217;t this be asking the user-agent if it&#8217;s Mozilla, Opera or Safari even if we&#8217;ve identified it to be IE (via the inclusion of the conditional comment) earlier in the script&#8230;.</p>
<p>If my coding is working correctly (my limited testing suggests so), the number of if&#8217;s asked is kept at a minimum, including having the <em>normal</em> &#8220;if &#8230; else if &#8230;&#8221; inside a conditional comment (so it&#8217;s completly ignored by IE).</p>
<p>The last &#8220;window.onload&#8221; could be kept outside the &#8220;if &#8230; else if&#8221; to trigger in all browsers, though wouldn&#8217;t this fire the &#8220;ELO event&#8221; twice?</p>
<p>Sorry if I&#8217;m not making any sense at all; JavaScript <strong>really</strong> isn&#8217;t my native language, especially when we&#8217;re throwing in bits of this strange and sheldom spoken dialect from MS&#8230;. <img src='http://robertnyman.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-11405</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Wed, 04 Oct 2006 18:50:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-11405</guid>
		<description>John,

Good question.

The first part of the script is a way to accomplish conditional comments in a script file that will only work in IE. And since one wants the &lt;code&gt;window.onload&lt;/code&gt; at the bottom for all web browsers as an extra insurance, that leaves only the &lt;code&gt;if&lt;/code&gt; clauses for Mozilla/Opera 9 and Safari, 

So yes, if you want to you can use &lt;code&gt;if...else&lt;/code&gt; for the Mozilla/Opera 9 and WebKit part, that is an option.</description>
		<content:encoded><![CDATA[<p>John,</p>
<p>Good question.</p>
<p>The first part of the script is a way to accomplish conditional comments in a script file that will only work in IE. And since one wants the <code>window.onload</code> at the bottom for all web browsers as an extra insurance, that leaves only the <code>if</code> clauses for Mozilla/Opera 9 and Safari, </p>
<p>So yes, if you want to you can use <code>if...else</code> for the Mozilla/Opera 9 and WebKit part, that is an option.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Magnus</title>
		<link>http://robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-11397</link>
		<dc:creator>John Magnus</dc:creator>
		<pubDate>Wed, 04 Oct 2006 15:19:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-11397</guid>
		<description>(Maybe I&#039;m missing something, but...)

Wouldn&#039;t it be better to integrate the different parts of the &quot;@if ... if ... else if ... else ...&quot; tighter together? Thus avoiding running browser specific/unnecessary parts of the code when the script allready have identified a browser...

Possibly something like;
&lt;code&gt;
/*@cc_on
/*@if (@_win32)
&#160;&#160;&#160;&#160;// IE on Win32
@else @ */
&#160;&#160;&#160;&#160;if (document.addEventListener) {
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;// Mozilla/Opera
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}
&#160;&#160;&#160;&#160;else if (navigator.userAgent.search(/WebKit/i) != -1) {
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;// WebKit (Safari)
&#160;&#160;&#160;&#160;else {
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;// Other browsers
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}
/*@end @ */
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>(Maybe I&#8217;m missing something, but&#8230;)</p>
<p>Wouldn&#8217;t it be better to integrate the different parts of the &#8220;@if &#8230; if &#8230; else if &#8230; else &#8230;&#8221; tighter together? Thus avoiding running browser specific/unnecessary parts of the code when the script allready have identified a browser&#8230;</p>
<p>Possibly something like;<br />
<code><br />
/*@cc_on<br />
/*@if (@_win32)<br />
&nbsp;&nbsp;&nbsp;&nbsp;// IE on Win32<br />
@else @ */<br />
&nbsp;&nbsp;&nbsp;&nbsp;if (document.addEventListener) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Mozilla/Opera<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;else if (navigator.userAgent.search(/WebKit/i) != -1) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// WebKit (Safari)<br />
&nbsp;&nbsp;&nbsp;&nbsp;else {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Other browsers<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
/*@end @ */<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-11396</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Wed, 04 Oct 2006 15:13:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-11396</guid>
		<description>Ash,

I wouldn&#039;t necessarily say that the &lt;code&gt;push&lt;/code&gt; implementation is wrong, but instead sufficient for its use here. If you want to make it more flexible and accept several parameters, you just have to loop through the &lt;code&gt;arguments&lt;/code&gt;, just like in your example.

I&#039;m not sure I&#039;d agree that the scope for the parameters would be just for the &lt;code&gt;eval&lt;/code&gt; call; it depends on what parameters/possible object properties you refer to.

And yes, you can fairly easily expand the functionality to accept functions as well as strings, and my initial version used only function references. In the end, though, I decided to take this route in this version presented here, because it was sufficient for my needs. 

If you want to enhance it with more support/flexibility for the cases you would use it in, by all means, add the functionality you seem fit. :-)</description>
		<content:encoded><![CDATA[<p>Ash,</p>
<p>I wouldn&#8217;t necessarily say that the <code>push</code> implementation is wrong, but instead sufficient for its use here. If you want to make it more flexible and accept several parameters, you just have to loop through the <code>arguments</code>, just like in your example.</p>
<p>I&#8217;m not sure I&#8217;d agree that the scope for the parameters would be just for the <code>eval</code> call; it depends on what parameters/possible object properties you refer to.</p>
<p>And yes, you can fairly easily expand the functionality to accept functions as well as strings, and my initial version used only function references. In the end, though, I decided to take this route in this version presented here, because it was sufficient for my needs. </p>
<p>If you want to enhance it with more support/flexibility for the cases you would use it in, by all means, add the functionality you seem fit. <img src='http://robertnyman.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ash Searle</title>
		<link>http://robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-11383</link>
		<dc:creator>Ash Searle</dc:creator>
		<pubDate>Wed, 04 Oct 2006 12:55:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2006/10/03/elo-encapsulated-load-object-the-ultimate-way-to-handle-window-load-events/#comment-11383</guid>
		<description>(missing the point entirely but...)

That &#039;push&#039; implementation is wrong.  Here&#039;s one that follows the spec (push multiple things onto the array at once, and return the new length of the array):
&lt;code&gt;
if (typeof Array.prototype.push != &quot;function&quot;) {
&#160; Array.prototype.push = function() {
&#160; &#160; for (var i = 0; i &lt; arguments.length; i++) {
&#160; &#160; &#160; this[this.length] = arguments[i];
&#160; &#160; }
&#160; &#160; return this.length;
&#160; }
}
&lt;/code&gt;

Also, if you used functions instead of strings on the call-stack, you&#039;d be able to use closures for parameterisation, instead of limiting yourself to parameters in the scope of the eval call.  Of course, it wouldn&#039;t take much effort to accept both strings and function references.</description>
		<content:encoded><![CDATA[<p>(missing the point entirely but&#8230;)</p>
<p>That &#8216;push&#8217; implementation is wrong.  Here&#8217;s one that follows the spec (push multiple things onto the array at once, and return the new length of the array):<br />
<code><br />
if (typeof Array.prototype.push != "function") {<br />
&nbsp; Array.prototype.push = function() {<br />
&nbsp; &nbsp; for (var i = 0; i &lt; arguments.length; i++) {<br />
&nbsp; &nbsp; &nbsp; this[this.length] = arguments[i];<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; return this.length;<br />
&nbsp; }<br />
}<br />
</code></p>
<p>Also, if you used functions instead of strings on the call-stack, you&#8217;d be able to use closures for parameterisation, instead of limiting yourself to parameters in the scope of the eval call.  Of course, it wouldn&#8217;t take much effort to accept both strings and function references.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
