<?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: onDOMReady: No Browser Sniffing!</title>
	<atom:link href="http://ryanmorr.com/archives/ondomready-no-browser-sniffing/feed" rel="self" type="application/rss+xml" />
	<link>http://ryanmorr.com/archives/ondomready-no-browser-sniffing</link>
	<description>JavaScript, CSS, and Web Apps</description>
	<lastBuildDate>Tue, 24 Aug 2010 12:22:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Ryan Morr</title>
		<link>http://ryanmorr.com/archives/ondomready-no-browser-sniffing/comment-page-1#comment-1636</link>
		<dc:creator>Ryan Morr</dc:creator>
		<pubDate>Sun, 22 Aug 2010 14:49:20 +0000</pubDate>
		<guid isPermaLink="false">http://ryanmorr.com/?p=105#comment-1636</guid>
		<description>@Robin Nixon

I would be honored to have my work represented in a book. Thanks for the consideration!</description>
		<content:encoded><![CDATA[<p>@Robin Nixon</p>
<p>I would be honored to have my work represented in a book. Thanks for the consideration!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robin Nixon</title>
		<link>http://ryanmorr.com/archives/ondomready-no-browser-sniffing/comment-page-1#comment-1632</link>
		<dc:creator>Robin Nixon</dc:creator>
		<pubDate>Sun, 22 Aug 2010 07:48:21 +0000</pubDate>
		<guid isPermaLink="false">http://ryanmorr.com/?p=105#comment-1632</guid>
		<description>(Ooops, should mention the URL: http://pluginjavascript.com)</description>
		<content:encoded><![CDATA[<p>(Ooops, should mention the URL: <a href="http://pluginjavascript.com)" rel="nofollow">http://pluginjavascript.com)</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robin Nixon</title>
		<link>http://ryanmorr.com/archives/ondomready-no-browser-sniffing/comment-page-1#comment-1631</link>
		<dc:creator>Robin Nixon</dc:creator>
		<pubDate>Sun, 22 Aug 2010 07:47:30 +0000</pubDate>
		<guid isPermaLink="false">http://ryanmorr.com/?p=105#comment-1631</guid>
		<description>This is an excellent function which seems to work well. If you don&#039;t mind I&#039;d like to point to it as a recommended replacement for window.onload in the downloadable files accompanying my forthcoming book.</description>
		<content:encoded><![CDATA[<p>This is an excellent function which seems to work well. If you don&#8217;t mind I&#8217;d like to point to it as a recommended replacement for window.onload in the downloadable files accompanying my forthcoming book.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Julie</title>
		<link>http://ryanmorr.com/archives/ondomready-no-browser-sniffing/comment-page-1#comment-486</link>
		<dc:creator>Julie</dc:creator>
		<pubDate>Thu, 15 Oct 2009 13:54:05 +0000</pubDate>
		<guid isPermaLink="false">http://ryanmorr.com/?p=105#comment-486</guid>
		<description>Hi Ryan,

Many thanks for getting back so quickly, and yep you&#039;ve sure answered my question! I hadn&#039;t taken it in properly that you&#039;re passing a function into the onDOMReady. I&#039;ll have to delve into this in more detail, it&#039;s a bit of a revelation to me, but sounds a great technique to keep things out of the global context. Sounds like you&#039;ve really got something here :))</description>
		<content:encoded><![CDATA[<p>Hi Ryan,</p>
<p>Many thanks for getting back so quickly, and yep you&#8217;ve sure answered my question! I hadn&#8217;t taken it in properly that you&#8217;re passing a function into the onDOMReady. I&#8217;ll have to delve into this in more detail, it&#8217;s a bit of a revelation to me, but sounds a great technique to keep things out of the global context. Sounds like you&#8217;ve really got something here <img src='http://ryanmorr.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> )</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Morr</title>
		<link>http://ryanmorr.com/archives/ondomready-no-browser-sniffing/comment-page-1#comment-485</link>
		<dc:creator>Ryan Morr</dc:creator>
		<pubDate>Thu, 15 Oct 2009 02:30:10 +0000</pubDate>
		<guid isPermaLink="false">http://ryanmorr.com/?p=105#comment-485</guid>
		<description>@Julie

If I am understanding your question correctly, the function is able to fire because it is still within the context of the onDOMReady function, any function definitions (fireDOMReady) that reside within that context are part of the scope chain and therefore have access to all variables at any level equal to or higher than its own. The event handlers hold a reference to fireDOMReady which in turn holds a reference to the user-provided function.

I am not to sure what your eluding to with this; &quot;things will only fire if, say onload, is placed outside the function (ie globally).&quot; But I can tell you, that onDOMReady can be called within any context, but it is important to note it can only be called once per page (I hope to upgrade this ability in the future to unlimited calls). It is typically best to pass the function directly to the method rather than a reference to avoid polluting the global namespace:

onDOMReady(function(){
          //do something
})

I hope this answers your question!</description>
		<content:encoded><![CDATA[<p>@Julie</p>
<p>If I am understanding your question correctly, the function is able to fire because it is still within the context of the onDOMReady function, any function definitions (fireDOMReady) that reside within that context are part of the scope chain and therefore have access to all variables at any level equal to or higher than its own. The event handlers hold a reference to fireDOMReady which in turn holds a reference to the user-provided function.</p>
<p>I am not to sure what your eluding to with this; &#8220;things will only fire if, say onload, is placed outside the function (ie globally).&#8221; But I can tell you, that onDOMReady can be called within any context, but it is important to note it can only be called once per page (I hope to upgrade this ability in the future to unlimited calls). It is typically best to pass the function directly to the method rather than a reference to avoid polluting the global namespace:</p>
<p>onDOMReady(function(){<br />
          //do something<br />
})</p>
<p>I hope this answers your question!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Julie</title>
		<link>http://ryanmorr.com/archives/ondomready-no-browser-sniffing/comment-page-1#comment-484</link>
		<dc:creator>Julie</dc:creator>
		<pubDate>Sun, 11 Oct 2009 19:12:26 +0000</pubDate>
		<guid isPermaLink="false">http://ryanmorr.com/?p=105#comment-484</guid>
		<description>Looks like this could be a nice little function. Sounds rather like Dean Edwards&#039; method (see for instance http://peter.michaux.ca/articles/the-window-onload-problem-still), but I do like the idea of mopping up all the event listeners at the end.  One question though, and probably because I just don&#039;t understand it properly, but how does this function fire? I ask because all the event handlers and calls to fire the function actually reside within a function definition, there seems to be no trigger outside this? I&#039;ve tried running your (fully documented) version myself, and things will only fire if, say onload, is placed outside the function (ie globally). What am I missing?</description>
		<content:encoded><![CDATA[<p>Looks like this could be a nice little function. Sounds rather like Dean Edwards&#8217; method (see for instance <a href="http://peter.michaux.ca/articles/the-window-onload-problem-still)" rel="nofollow">http://peter.michaux.ca/articles/the-window-onload-problem-still)</a>, but I do like the idea of mopping up all the event listeners at the end.  One question though, and probably because I just don&#8217;t understand it properly, but how does this function fire? I ask because all the event handlers and calls to fire the function actually reside within a function definition, there seems to be no trigger outside this? I&#8217;ve tried running your (fully documented) version myself, and things will only fire if, say onload, is placed outside the function (ie globally). What am I missing?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Morr</title>
		<link>http://ryanmorr.com/archives/ondomready-no-browser-sniffing/comment-page-1#comment-425</link>
		<dc:creator>Ryan Morr</dc:creator>
		<pubDate>Mon, 28 Sep 2009 05:04:12 +0000</pubDate>
		<guid isPermaLink="false">http://ryanmorr.com/?p=105#comment-425</guid>
		<description>@Leo

The code is still the same but to be honest, I haven&#039;t looked at it in a while, so perhaps some tweaking is in order. Although I had initially created an alternate version which employed a deferred script instead of Diego Perini&#039;s doScroll hack for IE. 

Now that I think about it, I had planned on adding the ability to call the function multiple times with multiple callbacks rather than just once.

As per browser support, I have tested the method to success in IE6+, FF2+, Opera 9+, Safari 2+, and Chrome 1+ but haven&#039;t been able to get my hands on any older browsers so I can&#039;t be too sure. However, the function should degrade gracefully to window.onload in any browsers that do not support the more advanced methods the script utilizes thanks to the lack of browser detection.</description>
		<content:encoded><![CDATA[<p>@Leo</p>
<p>The code is still the same but to be honest, I haven&#8217;t looked at it in a while, so perhaps some tweaking is in order. Although I had initially created an alternate version which employed a deferred script instead of Diego Perini&#8217;s doScroll hack for IE. </p>
<p>Now that I think about it, I had planned on adding the ability to call the function multiple times with multiple callbacks rather than just once.</p>
<p>As per browser support, I have tested the method to success in IE6+, FF2+, Opera 9+, Safari 2+, and Chrome 1+ but haven&#8217;t been able to get my hands on any older browsers so I can&#8217;t be too sure. However, the function should degrade gracefully to window.onload in any browsers that do not support the more advanced methods the script utilizes thanks to the lack of browser detection.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leo</title>
		<link>http://ryanmorr.com/archives/ondomready-no-browser-sniffing/comment-page-1#comment-414</link>
		<dc:creator>Leo</dc:creator>
		<pubDate>Sat, 26 Sep 2009 13:42:39 +0000</pubDate>
		<guid isPermaLink="false">http://ryanmorr.com/?p=105#comment-414</guid>
		<description>This seems like a great idea. I&#039;m surprised nobody else has commented, as this seems to be one of the few standalone solutions available.  I&#039;m wondering, is this still the current code you&#039;re using, or has it been tweaked?  Any problems with older browsers?</description>
		<content:encoded><![CDATA[<p>This seems like a great idea. I&#8217;m surprised nobody else has commented, as this seems to be one of the few standalone solutions available.  I&#8217;m wondering, is this still the current code you&#8217;re using, or has it been tweaked?  Any problems with older browsers?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
