<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Web Development &#38; Stuff &#187; Javascript</title>
	<atom:link href="http://web-development-blog.co.uk/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://web-development-blog.co.uk</link>
	<description>Some interesting findings from web-dev land...</description>
	<lastBuildDate>Thu, 22 Dec 2011 15:35:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>CKEditor in iFrame / jQuery UI dialog top offset bug</title>
		<link>http://web-development-blog.co.uk/2010/10/15/ckeditor-in-iframe-jquery-ui-dialog-top-offset-bug/</link>
		<comments>http://web-development-blog.co.uk/2010/10/15/ckeditor-in-iframe-jquery-ui-dialog-top-offset-bug/#comments</comments>
		<pubDate>Fri, 15 Oct 2010 16:37:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://web-development-blog.co.uk/?p=395</guid>
		<description><![CDATA[I had a couple of CKEditors in a jQuery UI dialog box today. The dialog box contained an iFrame with the actual CKEditors inside that.
On the odd occasion when the modal box opened (tested in FireFox 3.6 on the Mac and PC) the vertical scroll position of the iFrame would not be at the top. [...]]]></description>
			<content:encoded><![CDATA[<p>I had a couple of CKEditors in a jQuery UI dialog box today. The dialog box contained an iFrame with the actual CKEditors inside that.</p>
<p>On the odd occasion when the modal box opened (tested in FireFox 3.6 on the Mac and PC) the vertical scroll position of the iFrame would not be at the top. Instead it was focused on one of the lower CKEditors.</p>
<p>After some Googling and hacking and still no solution I placed this in each CKeditor onReady/instanceReady callback, which did the trick:</p>
<div class="codecolorer-container php " style="overflow:auto;white-space:nowrap;width:100%"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br />3<br /></div></td><td><div class="php codecolorer" style="font-family:Monaco,Lucida Console,monospace">CKEditor<span class="sy0">.</span>on<span class="br0">&#40;</span><span class="st0">&quot;instanceReady&quot;</span><span class="sy0">,</span> <span class="kw2">function</span><span class="br0">&#40;</span>event<span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; $<span class="br0">&#40;</span>window<span class="br0">&#41;</span><span class="sy0">.</span>scrollTop<span class="br0">&#40;</span><span class="nu0">0</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://web-development-blog.co.uk/2010/10/15/ckeditor-in-iframe-jquery-ui-dialog-top-offset-bug/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Stop Javascript event bubbling / propagation with nested html elements using jQuery</title>
		<link>http://web-development-blog.co.uk/2010/07/28/stop-javascript-event-bubbling-propagation-nested-html-elements/</link>
		<comments>http://web-development-blog.co.uk/2010/07/28/stop-javascript-event-bubbling-propagation-nested-html-elements/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 13:51:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://web-development-blog.co.uk/?p=359</guid>
		<description><![CDATA[You can stop nested elements triggering their parent element event handlers (DOM bubbling) using this handy jQuery method:
http://api.jquery.com/event.stopImmediatePropagation/
I ran into this issue whilst working on a calendar/scheduling app. Where day containing elements needed click events and their child elements needed click events too. 
Love the jQuery ;]
]]></description>
			<content:encoded><![CDATA[<p>You can stop nested elements triggering their parent element event handlers (DOM bubbling) using this handy jQuery method:</p>
<p><a href="http://api.jquery.com/event.stopImmediatePropagation/">http://api.jquery.com/event.stopImmediatePropagation/</a></p>
<p>I ran into this issue whilst working on a calendar/scheduling app. Where day containing elements needed click events and their child elements needed click events too. </p>
<p>Love the jQuery ;]</p>
]]></content:encoded>
			<wfw:commentRss>http://web-development-blog.co.uk/2010/07/28/stop-javascript-event-bubbling-propagation-nested-html-elements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t trust the output of innerHTML() or jQuery.html() in Internet Explorer</title>
		<link>http://web-development-blog.co.uk/2010/05/16/dont-trust-the-output-of-innerhtml-or-jquery-html-in-internet-explorer/</link>
		<comments>http://web-development-blog.co.uk/2010/05/16/dont-trust-the-output-of-innerhtml-or-jquery-html-in-internet-explorer/#comments</comments>
		<pubDate>Sun, 16 May 2010 13:52:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web development]]></category>

		<guid isPermaLink="false">http://web-development-blog.co.uk/?p=341</guid>
		<description><![CDATA[Especially if you&#8217;re trying to match attributes and their values!
Thankfully Kooilnc, the godsend has a solution:
http://stackoverflow.com/questions/1231770/innerhtml-removes-attribute-quotes-in-internet-explorer
I&#8217;ve wrapped that up into a jQuery function here:
123456789101112131415161718192021222324$.fn.ieInnerHTML = function&#40;&#41; &#123; 
&#160; var zz = this.html&#40;&#41;,
&#160; &#160; &#160; &#160;z = 
&#160; &#160; &#160;zz.match&#40;/&#60;\/?\w+((\s+\w+(\s*=\s*(?:&#34;.*?&#34;&#124;'.*?'&#124;[^'&#34;&#62;\s]+))?)+\s*&#124;\s*)\/?&#62;/g&#41;;
&#160; &#160; if &#40;z&#41;&#123;
&#160; &#160; &#160; for &#40;var i=0;i&#60;z.length;i++&#41;&#123;
&#160; &#160; &#160; &#160; var y, zSaved = z&#91;i&#93;;
&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Especially if you&#8217;re trying to match attributes and their values!</p>
<p>Thankfully Kooilnc, the godsend has a solution:</p>
<p><a href="http://stackoverflow.com/questions/1231770/innerhtml-removes-attribute-quotes-in-internet-explorer">http://stackoverflow.com/questions/1231770/innerhtml-removes-attribute-quotes-in-internet-explorer</a></p>
<p>I&#8217;ve wrapped that up into a jQuery function here:</p>
<div class="codecolorer-container javascript " style="overflow:auto;white-space:nowrap;width:100%;height:300px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br /></div></td><td><div class="javascript codecolorer" style="font-family:Monaco,Lucida Console,monospace">$.<span class="me1">fn</span>.<span class="me1">ieInnerHTML</span> <span class="sy0">=</span> <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span> <br />
&nbsp; <span class="kw2">var</span> zz <span class="sy0">=</span> <span class="kw1">this</span>.<span class="me1">html</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;z <span class="sy0">=</span> <br />
&nbsp; &nbsp; &nbsp;zz.<span class="me1">match</span><span class="br0">&#40;</span><span class="co2">/&lt;\/?\w+((\s+\w+(\s*=\s*(?:&quot;.*?&quot;|'.*?'|[^'&quot;&gt;\s]+))?)+\s*|\s*)\/?&gt;/g</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>z<span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw1">for</span> <span class="br0">&#40;</span><span class="kw2">var</span> i<span class="sy0">=</span><span class="nu0">0</span><span class="sy0">;</span>i<span class="sy0">&lt;</span>z.<span class="me1">length</span><span class="sy0">;</span>i<span class="sy0">++</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> y<span class="sy0">,</span> zSaved <span class="sy0">=</span> z<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; z<span class="br0">&#91;</span>i<span class="br0">&#93;</span> <span class="sy0">=</span> z<span class="br0">&#91;</span>i<span class="br0">&#93;</span>.<span class="me1">replace</span><span class="br0">&#40;</span><span class="co2">/(&lt;?\w+)|(&lt;\/?\w+)\s/</span><span class="sy0">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">function</span><span class="br0">&#40;</span>a<span class="br0">&#41;</span><span class="br0">&#123;</span><span class="kw1">return</span> a.<span class="me1">toLowerCase</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; y <span class="sy0">=</span> z<span class="br0">&#91;</span>i<span class="br0">&#93;</span>.<span class="me1">match</span><span class="br0">&#40;</span><span class="co2">/\=\w+[?\s+|?&gt;]/g</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">if</span> <span class="br0">&#40;</span>y<span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">for</span> <span class="br0">&#40;</span><span class="kw2">var</span> j<span class="sy0">=</span><span class="nu0">0</span><span class="sy0">;</span>j<span class="sy0">&lt;</span>y.<span class="me1">length</span><span class="sy0">;</span>j<span class="sy0">++</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; z<span class="br0">&#91;</span>i<span class="br0">&#93;</span> <span class="sy0">=</span> z<span class="br0">&#91;</span>i<span class="br0">&#93;</span>.<span class="me1">replace</span><span class="br0">&#40;</span>y<span class="br0">&#91;</span>j<span class="br0">&#93;</span><span class="sy0">,</span>y<span class="br0">&#91;</span>j<span class="br0">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.<span class="me1">replace</span><span class="br0">&#40;</span><span class="co2">/\=(\w+)([?\s+|?&gt;])/g</span><span class="sy0">,</span><span class="st0">'=&quot;$1&quot;$2'</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;zz <span class="sy0">=</span> zz.<span class="me1">replace</span><span class="br0">&#40;</span>zSaved<span class="sy0">,</span>z<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp;<span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="kw1">return</span> zz<span class="sy0">;</span><br />
<span class="br0">&#125;</span><br />
<br />
<span class="co1">// Usage:</span><br />
$<span class="br0">&#40;</span><span class="st0">'#getInnerHtmlOfThis'</span><span class="br0">&#41;</span>.<span class="me1">ieInnerHTML</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://web-development-blog.co.uk/2010/05/16/dont-trust-the-output-of-innerhtml-or-jquery-html-in-internet-explorer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Access dynamic jQuery elements that have been added to the DOM after page has loaded</title>
		<link>http://web-development-blog.co.uk/2009/11/08/access-dynamic-jquery-elements-added-to-dom-after-page-has-loaded/</link>
		<comments>http://web-development-blog.co.uk/2009/11/08/access-dynamic-jquery-elements-added-to-dom-after-page-has-loaded/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 10:43:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://web-development-blog.co.uk/?p=229</guid>
		<description><![CDATA[If you wanted to manipulate elements you&#8217;d added to a page with jQuery after the DOM had loaded, you used to have to specify event handlers when adding them.
jQuery v1.3 has a handy new &#8216;live&#8217; method. Which basically allows you to access all elements, whether present at page load or added dynamically afterward with jQuery.
jQuery [...]]]></description>
			<content:encoded><![CDATA[<p>If you wanted to manipulate elements you&#8217;d added to a page with jQuery after the DOM had loaded, you used to have to specify event handlers when adding them.</p>
<p>jQuery v1.3 has a handy new &#8216;live&#8217; method. Which basically allows you to access all elements, whether present at page load or added dynamically afterward with jQuery.</p>
<p><a href="http://docs.jquery.com/Events/live">jQuery documentation</a></p>
<p>Quick click event example:</p>
<div class="codecolorer-container javascript " style="overflow:auto;white-space:nowrap;width:100%"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br />3<br /></div></td><td><div class="javascript codecolorer" style="font-family:Monaco,Lucida Console,monospace">$<span class="br0">&#40;</span><span class="st0">&quot;a.deleteRow&quot;</span><span class="br0">&#41;</span>.<span class="me1">live</span><span class="br0">&#40;</span><span class="st0">&quot;click&quot;</span><span class="sy0">,</span> <span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; # Code to manipulate all matching elements added before or after the DOM has loaded.<br />
<span class="br0">&#125;</span></div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://web-development-blog.co.uk/2009/11/08/access-dynamic-jquery-elements-added-to-dom-after-page-has-loaded/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Submit form with jQuery gotcha</title>
		<link>http://web-development-blog.co.uk/2009/10/29/submit-form-with-jquery-gotcha/</link>
		<comments>http://web-development-blog.co.uk/2009/10/29/submit-form-with-jquery-gotcha/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 15:40:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://web-development-blog.co.uk/?p=211</guid>
		<description><![CDATA[It seems that you can&#8217;t submit a form with jQuery using:
1$&#40;'form#myform'&#41;.submit&#40;&#41;;
If you have an input in the form with the name attribute set to submit. So this doesn&#8217;t work:
1&#60;input type=&#34;submit&#34; name=&#34;submit&#34; value=&#34;Press to continue&#34; /&#62;
Change the name attribute to something else other than submit and it works fine ;]
]]></description>
			<content:encoded><![CDATA[<p>It seems that you can&#8217;t submit a form with jQuery using:</p>
<div class="codecolorer-container css " style="overflow:auto;white-space:nowrap;width:100%"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="css codecolorer" style="font-family:Monaco,Lucida Console,monospace">$<span class="br0">&#40;</span><span class="st0">'form#myform'</span><span class="br0">&#41;</span>.submit<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div></td></tr></tbody></table></div>
<p>If you have an input in the form with the name attribute set to submit. So this doesn&#8217;t work:</p>
<div class="codecolorer-container css " style="overflow:auto;white-space:nowrap;width:100%"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="css codecolorer" style="font-family:Monaco,Lucida Console,monospace">&lt;input type<span class="sy0">=</span><span class="st0">&quot;submit&quot;</span> name<span class="sy0">=</span><span class="st0">&quot;submit&quot;</span> value<span class="sy0">=</span><span class="st0">&quot;Press to continue&quot;</span> /<span class="sy0">&gt;</span></div></td></tr></tbody></table></div>
<p>Change the name attribute to something else other than submit and it works fine ;]</p>
]]></content:encoded>
			<wfw:commentRss>http://web-development-blog.co.uk/2009/10/29/submit-form-with-jquery-gotcha/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SWFUpload returns HTTP 401 error after Apache authentication / password protected directory</title>
		<link>http://web-development-blog.co.uk/2009/04/30/swfupload-returns-http-401-error-after-apache-authentication-password-protected-directory/</link>
		<comments>http://web-development-blog.co.uk/2009/04/30/swfupload-returns-http-401-error-after-apache-authentication-password-protected-directory/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 16:38:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web development]]></category>

		<guid isPermaLink="false">http://web-development-blog.co.uk/?p=152</guid>
		<description><![CDATA[Uploaded my first site today that uses SWF Upload to handle large file uploads. The admin area of that site had basic Apache HTTP authentication via a .htaccess file.
SWF Upload failed with a 401 error after testing. It seems you can&#8217;t use this style of authentication with the current version of SWF Upload. Something to [...]]]></description>
			<content:encoded><![CDATA[<p>Uploaded my first site today that uses SWF Upload to handle large file uploads. The admin area of that site had basic Apache HTTP authentication via a .htaccess file.</p>
<p>SWF Upload failed with a 401 error after testing. It seems you can&#8217;t use this style of authentication with the current version of SWF Upload. Something to do with a bug/short-fall in Flash.</p>
<p>Anyways, good news as SWF Upload will handle PHP sessions (not looked into RoR sessions yet) therefore you can build your own PHP user system. You need to pass the PHP session variables through, you can use code along the lines of this to pass them:</p>
<div class="codecolorer-container javascript " style="overflow:auto;white-space:nowrap;width:100%"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="javascript codecolorer" style="font-family:Monaco,Lucida Console,monospace"># The post_params variables being the ones of interest.<br />
<span class="me1">upload_url</span> <span class="sy0">:</span> <span class="st0">&quot;/media-uploads/upload/&quot;</span><span class="sy0">,</span> &nbsp;&nbsp; &nbsp; <br />
post_params<span class="sy0">:</span> <span class="br0">&#123;</span><br />
&nbsp; <span class="st0">&quot;PHPSESSID&quot;</span> <span class="sy0">:</span> <span class="st0">&quot;&lt;?php echo session_id(); ?&gt;&quot;</span><span class="sy0">,</span><br />
&nbsp; <span class="st0">&quot;PHPSESSNAME&quot;</span><span class="sy0">:</span> <span class="sy0">&lt;?</span>php echo session_name<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="sy0">?&gt;</span><span class="st0">&quot;<br />
},<br />
flash_url : &quot;</span><span class="sy0">/</span>flash<span class="sy0">/</span>swfupload.<span class="me1">swf</span><span class="st0">&quot;,</span></div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://web-development-blog.co.uk/2009/04/30/swfupload-returns-http-401-error-after-apache-authentication-password-protected-directory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HEAD NOSCRIPT CSS validation workaround</title>
		<link>http://web-development-blog.co.uk/2008/03/23/head-noscript-css-validation-workaround/</link>
		<comments>http://web-development-blog.co.uk/2008/03/23/head-noscript-css-validation-workaround/#comments</comments>
		<pubDate>Sun, 23 Mar 2008 11:40:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web development]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web accessibility]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://web-development-blog.co.uk/2008/03/23/head-noscript-css-validation-workaround/</guid>
		<description><![CDATA[I wanted to apply a different set of css styles to a degraded non-javascript version of a page to maintain some accessibility aspects.
I wrestled for a while with the &#60;noscript&#62; tag but this fails to validate in the head section of a HTML/XHTML document. This wasn&#8217;t a good enough way to do things.
Eventually (with a [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to apply a different set of css styles to a degraded non-javascript version of a page to maintain some accessibility aspects.</p>
<p>I wrestled for a while with the &lt;noscript&gt; tag but this fails to validate in the head section of a HTML/XHTML document. This wasn&#8217;t a good enough way to do things.</p>
<p>Eventually (with a little help from a friend!) I found a solution and that was to add a class attribute to the &lt;html&gt; tag with Javascript. So I added this in the &lt;head&gt; section:</p>
<div class="codecolorer-container html4strict " style="overflow:auto;white-space:nowrap;width:100%"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="html4strict codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="sc2">&lt;<span class="kw2">script</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;text/javascript&quot;</span> <span class="kw3">language</span><span class="sy0">=</span><span class="st0">&quot;javascript&quot;</span>&gt;</span><br />
<br />
&nbsp; /* This adds the class js to the html tag. Allowing us<br />
&nbsp; &nbsp; &nbsp; &nbsp; to apply different styles if javascript is enabled.*/<br />
&nbsp; &nbsp; document.documentElement.className = “js”;<br />
<br />
<span class="sc2">&lt;<span class="sy0">/</span><span class="kw2">script</span>&gt;</span></div></td></tr></tbody></table></div>
<p>So if Javascript is enabled my &lt;html&gt; tag now has this class &lt;html class=&#8221;js&#8221;&gt;</p>
<p>Allowing me to apply different styling to both the Javascript enabled or degraded versions:</p>
<p>No Javascript</p>
<div class="codecolorer-container css " style="overflow:auto;white-space:nowrap;width:100%"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="css codecolorer" style="font-family:Monaco,Lucida Console,monospace">html h1 <span class="br0">&#123;</span> <span class="kw1">font-size</span><span class="sy0">:</span> <span class="re3"><span class="nu0">100</span>%</span><span class="sy0">;</span> <span class="br0">&#125;</span></div></td></tr></tbody></table></div>
<p>Javascript</p>
<div class="codecolorer-container css " style="overflow:auto;white-space:nowrap;width:100%"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="css codecolorer" style="font-family:Monaco,Lucida Console,monospace">html<span class="re1">.js</span> h1 <span class="br0">&#123;</span> <span class="kw1">font-size</span><span class="sy0">:</span> <span class="re3"><span class="nu0">200</span>%</span><span class="sy0">;</span> <span class="br0">&#125;</span></div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://web-development-blog.co.uk/2008/03/23/head-noscript-css-validation-workaround/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

