<?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: Enable JavaScript specific CSS with one line of jQuery</title> <atom:link href="http://greatwebguy.com/programming/dom/enable-javascript-specific-css-with-one-line-of-jquery/feed/" rel="self" type="application/rss+xml" /><link>http://greatwebguy.com/programming/dom/enable-javascript-specific-css-with-one-line-of-jquery/</link> <description>Self-proclaimed greatness is a hard thing to prove.</description> <lastBuildDate>Tue, 15 May 2012 21:39:02 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <item><title>By: webguy</title><link>http://greatwebguy.com/programming/dom/enable-javascript-specific-css-with-one-line-of-jquery/#comment-391</link> <dc:creator>webguy</dc:creator> <pubDate>Tue, 04 May 2010 19:59:10 +0000</pubDate> <guid
isPermaLink="false">http://greatwebguy.com/?p=132#comment-391</guid> <description>document.documentElement.className = &quot;js&quot;;  at the top of the head section does the trick for me.  I wrote another more recent article http://greatwebguy.com/programming/css/writing-javascript-specific-css/, but everyone ends up reading this one because it has jQuery in the title.  Go figure.</description> <content:encoded><![CDATA[<p>document.documentElement.className = &#8220;js&#8221;;  at the top of the head section does the trick for me.  I wrote another more recent article <a
href="http://greatwebguy.com/programming/css/writing-javascript-specific-css/" rel="nofollow">http://greatwebguy.com/programming/css/writing-javascript-specific-css/</a>, but everyone ends up reading this one because it has jQuery in the title.  Go figure.</p> ]]></content:encoded> </item> <item><title>By: Andrew</title><link>http://greatwebguy.com/programming/dom/enable-javascript-specific-css-with-one-line-of-jquery/#comment-390</link> <dc:creator>Andrew</dc:creator> <pubDate>Tue, 04 May 2010 18:39:10 +0000</pubDate> <guid
isPermaLink="false">http://greatwebguy.com/?p=132#comment-390</guid> <description>agreed webguy. FWIW, I don&#039;t think document.body is standard JS, yet all modern browsers seem to support it :-)</description> <content:encoded><![CDATA[<p>agreed webguy. FWIW, I don&#8217;t think document.body is standard JS, yet all modern browsers seem to support it <img
src='http://greatwebguy.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p> ]]></content:encoded> </item> <item><title>By: webguy</title><link>http://greatwebguy.com/programming/dom/enable-javascript-specific-css-with-one-line-of-jquery/#comment-389</link> <dc:creator>webguy</dc:creator> <pubDate>Tue, 04 May 2010 18:23:16 +0000</pubDate> <guid
isPermaLink="false">http://greatwebguy.com/?p=132#comment-389</guid> <description>So everyone wants to recommend the use of the js class on the body element instead of the html element.  Call me rogue and tell me my html is invalid, I haven&#039;t found a browser yet that doesn&#039;t recognize what I&#039;m doing and I use this technique on the number 3 retail site in the world and it works well, with no flash of incorrectly styled content.  While I would tend to agree that valid markup is the best, in this case, why jump through hoops to prevent adding the class to the html node, it&#039;s like trying to get jQuery to run through jslint, ask yourself why you&#039;re jumping through hoops to end up with a less than adequate solution.</description> <content:encoded><![CDATA[<p>So everyone wants to recommend the use of the js class on the body element instead of the html element.  Call me rogue and tell me my html is invalid, I haven&#8217;t found a browser yet that doesn&#8217;t recognize what I&#8217;m doing and I use this technique on the number 3 retail site in the world and it works well, with no flash of incorrectly styled content.  While I would tend to agree that valid markup is the best, in this case, why jump through hoops to prevent adding the class to the html node, it&#8217;s like trying to get jQuery to run through jslint, ask yourself why you&#8217;re jumping through hoops to end up with a less than adequate solution.</p> ]]></content:encoded> </item> <item><title>By: Andrew</title><link>http://greatwebguy.com/programming/dom/enable-javascript-specific-css-with-one-line-of-jquery/#comment-388</link> <dc:creator>Andrew</dc:creator> <pubDate>Tue, 04 May 2010 18:15:56 +0000</pubDate> <guid
isPermaLink="false">http://greatwebguy.com/?p=132#comment-388</guid> <description>of course, upon trying to use the &quot;body&quot; tag instead of the &quot;html&quot; tag I ran into the now obvious issue of trying to access a nonexistend DOM element.
So.... i guess you can either use a non-standard attribute on the &quot;html&quot; tag, or take your line of JS out of the head and slip it in immediately after the opening body tag. I&#039;m trying the latter, with the modification to simply remove the &quot;nojs&quot; class (thereby preserving any other class that I might want to use in the future)
document.body.className = document.body.className.replace(/\s*nojs\s*/, &quot;&quot;);</description> <content:encoded><![CDATA[<p>of course, upon trying to use the &#8220;body&#8221; tag instead of the &#8220;html&#8221; tag I ran into the now obvious issue of trying to access a nonexistend DOM element.</p><p>So&#8230;. i guess you can either use a non-standard attribute on the &#8220;html&#8221; tag, or take your line of JS out of the head and slip it in immediately after the opening body tag. I&#8217;m trying the latter, with the modification to simply remove the &#8220;nojs&#8221; class (thereby preserving any other class that I might want to use in the future)</p><p>document.body.className = document.body.className.replace(/\s*nojs\s*/, &#8220;&#8221;);</p> ]]></content:encoded> </item> <item><title>By: Andrew</title><link>http://greatwebguy.com/programming/dom/enable-javascript-specific-css-with-one-line-of-jquery/#comment-387</link> <dc:creator>Andrew</dc:creator> <pubDate>Tue, 04 May 2010 16:59:41 +0000</pubDate> <guid
isPermaLink="false">http://greatwebguy.com/?p=132#comment-387</guid> <description>heh, filtered that out too. Use &quot;body&quot; tag rather than &quot;html&quot; tag. That&#039;s all :-)</description> <content:encoded><![CDATA[<p>heh, filtered that out too. Use &#8220;body&#8221; tag rather than &#8220;html&#8221; tag. That&#8217;s all <img
src='http://greatwebguy.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p> ]]></content:encoded> </item> </channel> </rss>
