<?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: Inline Script Wrapper and Dependencies</title>
	<atom:link href="http://ajaxian.com/archives/inline-script-wrapper-and-dependencies/feed" rel="self" type="application/rss+xml" />
	<link>http://ajaxian.com/archives/inline-script-wrapper-and-dependencies</link>
	<description>Cleaning up the web with Ajax</description>
	<lastBuildDate>Thu, 09 Feb 2012 06:55:33 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
	<item>
		<title>By: DanAtkinson</title>
		<link>http://ajaxian.com/archives/inline-script-wrapper-and-dependencies/comment-page-1#comment-266562</link>
		<dc:creator>DanAtkinson</dc:creator>
		<pubDate>Mon, 11 Aug 2008 09:30:52 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3969#comment-266562</guid>
		<description>I don&#039;t agree with this at all.

I&#039;m not the world&#039;s biggest fan of doing a load of style in your JS, as that defeats the object of CSS in my opinion.

If you really must do stuff like that in JS, then here&#039;s a simple solution...

On the first line directly after the body tag has been opened, add this:
document.body.className += &#039; hasJS &#039;;

Now, in your JS, you could do this:
body.hasJS #red {background-color: #F00;}
body.hasJS #green {background-color: #0F0;}

Isn&#039;t that better? This way you can still have your JS at the bottom of the page, and your elements will be styled correctly.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t agree with this at all.</p>
<p>I&#8217;m not the world&#8217;s biggest fan of doing a load of style in your JS, as that defeats the object of CSS in my opinion.</p>
<p>If you really must do stuff like that in JS, then here&#8217;s a simple solution&#8230;</p>
<p>On the first line directly after the body tag has been opened, add this:<br />
document.body.className += &#8216; hasJS &#8216;;</p>
<p>Now, in your JS, you could do this:<br />
body.hasJS #red {background-color: #F00;}<br />
body.hasJS #green {background-color: #0F0;}</p>
<p>Isn&#8217;t that better? This way you can still have your JS at the bottom of the page, and your elements will be styled correctly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Clay</title>
		<link>http://ajaxian.com/archives/inline-script-wrapper-and-dependencies/comment-page-1#comment-266343</link>
		<dc:creator>Steve Clay</dc:creator>
		<pubDate>Fri, 01 Aug 2008 20:53:46 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3969#comment-266343</guid>
		<description>I ran into this having a SCRIPT element within a WordPress post. I needed $, but it wasn&#039;t defined until the end of the page. Now a trivial &lt;a&gt;plugin&lt;/a&gt; loads directly after jQuery to call any queued functions. Usage is easy:

&lt;code&gt;// setup func to be called later
var _waitFor$ = function () {
  $(doSomething);
};
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>I ran into this having a SCRIPT element within a WordPress post. I needed $, but it wasn&#8217;t defined until the end of the page. Now a trivial <a>plugin</a> loads directly after jQuery to call any queued functions. Usage is easy:</p>
<p><code>// setup func to be called later<br />
var _waitFor$ = function () {<br />
  $(doSomething);<br />
};<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AriesBelgium</title>
		<link>http://ajaxian.com/archives/inline-script-wrapper-and-dependencies/comment-page-1#comment-266254</link>
		<dc:creator>AriesBelgium</dc:creator>
		<pubDate>Wed, 30 Jul 2008 18:51:29 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3969#comment-266254</guid>
		<description>Sorry, typo:
$(&quot;#green&quot;).css(&#039;background-color&#039;,&#039;green&#039;);</description>
		<content:encoded><![CDATA[<p>Sorry, typo:<br />
$(&#8220;#green&#8221;).css(&#8216;background-color&#8217;,'green&#8217;);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AriesBelgium</title>
		<link>http://ajaxian.com/archives/inline-script-wrapper-and-dependencies/comment-page-1#comment-266251</link>
		<dc:creator>AriesBelgium</dc:creator>
		<pubDate>Wed, 30 Jul 2008 18:43:08 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=3969#comment-266251</guid>
		<description>Okay, this is kinda of a paradox. He would put the JS on the bottom of the page because that would give him a performance boost (at least that is what YSlow is claiming) but then he creates an extra loop which isn&#039;t actually necessary because he could put the code that he does inline now right after loading jQuery. His solution would be more system intensive than loading the JS in the head-section.

And what&#039;s wrong with:
$(&quot;#green&quot;).css(&#039;background-color&#039;:&#039;green&#039;);?</description>
		<content:encoded><![CDATA[<p>Okay, this is kinda of a paradox. He would put the JS on the bottom of the page because that would give him a performance boost (at least that is what YSlow is claiming) but then he creates an extra loop which isn&#8217;t actually necessary because he could put the code that he does inline now right after loading jQuery. His solution would be more system intensive than loading the JS in the head-section.</p>
<p>And what&#8217;s wrong with:<br />
$(&#8220;#green&#8221;).css(&#8216;background-color&#8217;:'green&#8217;);?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

