<?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>dom111.co.uk &#187; Javascript</title>
	<atom:link href="http://www.dom111.co.uk/blog/tag/javascript/feed" rel="self" type="application/rss+xml" />
	<link>http://www.dom111.co.uk/blog</link>
	<description>Move along. Nothing to see here.</description>
	<lastBuildDate>Wed, 26 Oct 2011 16:37:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>jQuery serializeObject 0.1</title>
		<link>http://www.dom111.co.uk/blog/coding/jquery-serializeobject-0-1/283</link>
		<comments>http://www.dom111.co.uk/blog/coding/jquery-serializeobject-0-1/283#comments</comments>
		<pubDate>Thu, 31 Mar 2011 22:37:47 +0000</pubDate>
		<dc:creator>dom111</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[formToObject]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[post data]]></category>
		<category><![CDATA[serializeObject]]></category>

		<guid isPermaLink="false">http://www.dom111.co.uk/blog/?p=283</guid>
		<description><![CDATA[I found myself in a situation recently where I wanted to have access to variables that would have been posted, in a the same structure as if the form had been posted and returned the JSON, using this jQuery plugin and Douglas Crockford&#8217;s JSON library, I think I&#8217;ve done it! You can download the script [...]]]></description>
			<content:encoded><![CDATA[<p>I found myself in a situation recently where I wanted to have access to variables that would have been posted, in a the same structure as if the form had been posted and returned the JSON, using this jQuery plugin and <a href="https://github.com/douglascrockford/JSON-js">Douglas Crockford&#8217;s JSON library</a>, I think I&#8217;ve done it!</p>
<p>You can <a href="/files/jquery-serializeObject/jquery.serializeObject-0.1.tar.gz">download the script here</a> and there&#8217;s <a href="/files/jquery-serializeObject">a demo here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dom111.co.uk/blog/coding/jquery-serializeobject-0-1/283/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Ajaxify Lite</title>
		<link>http://www.dom111.co.uk/blog/coding/jquery-ajaxify-lite/275</link>
		<comments>http://www.dom111.co.uk/blog/coding/jquery-ajaxify-lite/275#comments</comments>
		<pubDate>Fri, 29 Oct 2010 09:33:19 +0000</pubDate>
		<dc:creator>dom111</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[ajax form]]></category>
		<category><![CDATA[ajaxify]]></category>
		<category><![CDATA[form]]></category>

		<guid isPermaLink="false">http://www.dom111.co.uk/blog/?p=275</guid>
		<description><![CDATA[I&#8217;ve been using the ajaxify plugin for a while now and felt it needed an update. Since .live() is supported for more events now, I thought it was time to get it working how I always wanted it to work. Using the same syntax on links as before, you can specify the target div, using [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using the ajaxify plugin for a while now and felt it needed an update.</p>
<p>Since .live() is supported for more events now, I thought it was time to get it working how I always wanted it to work.</p>
<p>Using the same syntax on links as before, you can specify the target div, using the target=&#8221;" attribute and the url is automatically extracted from the href=&#8221;" or action=&#8221;" attribute meaning you can keep your code simple and valid but have easily Ajax populated content, as since I&#8217;m using .live() any future links/forms that match the original selector will continue to be &#8216;ajaxified&#8217;.</p>
<p>There&#8217;s <a href="/files/ajaxify/lite/">a demo here</a> and <a href="/files/ajaxify/lite/jquery.ajaxify.lite.tar.gz">source code too</a>, as ever.</p>
<p>Also <a href="http://code.google.com/p/ajaxify/source/browse/#svn/branches/lite">available through Google Code</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dom111.co.uk/blog/coding/jquery-ajaxify-lite/275/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>autoPopulate 0.1</title>
		<link>http://www.dom111.co.uk/blog/coding/autopopulate-0-1/249</link>
		<comments>http://www.dom111.co.uk/blog/coding/autopopulate-0-1/249#comments</comments>
		<pubDate>Tue, 14 Sep 2010 17:40:17 +0000</pubDate>
		<dc:creator>dom111</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[auto populate]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[form fill]]></category>
		<category><![CDATA[html form]]></category>
		<category><![CDATA[lazy]]></category>

		<guid isPermaLink="false">http://www.dom111.co.uk/blog/?p=249</guid>
		<description><![CDATA[I&#8217;ve had it with filling in the same details repeatedly while testing a new form&#8217;s validation! So much so, that I&#8217;ve spent time writing a pointless bookmarklet that makes me even more lazy and probably isn&#8217;t doing anything for my typos to real words ratio, however, I thought it might be useful to other people [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve had it with filling in the same details repeatedly while testing a new form&#8217;s validation!</p>
<p>So much so, that I&#8217;ve spent time writing a pointless bookmarklet that makes me even more lazy and probably isn&#8217;t doing anything for my typos to real words ratio, however, I thought it might be useful to other people too.</p>
<p><a href="/files/autoPopulate/">There&#8217;s a demo here</a>, and <a href="/files/autoPopulate/generate.html">a generator for your own custom one here too</a>.</p>
<p>The uncompressed source is linked at the bottom of the demo page, in case you want to see how it works or extend it. There are some comments there too. (But not many&#8230;)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dom111.co.uk/blog/coding/autopopulate-0-1/249/feed</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Minify CSS &#8211; Shrink your CSS down to size</title>
		<link>http://www.dom111.co.uk/blog/coding/minify-css-shrink-your-css-down-to-size/238</link>
		<comments>http://www.dom111.co.uk/blog/coding/minify-css-shrink-your-css-down-to-size/238#comments</comments>
		<pubDate>Fri, 16 Apr 2010 18:07:11 +0000</pubDate>
		<dc:creator>dom111</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[minified css]]></category>
		<category><![CDATA[minify css]]></category>

		<guid isPermaLink="false">http://www.dom111.co.uk/blog/?p=238</guid>
		<description><![CDATA[I know there are probably many services offering it already out there, and it&#8217;s not too hard to run right in TextMate, but I haven&#8217;t been able to find it in 30 seconds of Googling (well, I couldn&#8217;t at work, but I&#8217;ve since found this&#8230; Oh well!), so I set up a quick script to [...]]]></description>
			<content:encoded><![CDATA[<p>I know there are probably many services offering it already out there, and it&#8217;s not too hard to run right in TextMate, but I haven&#8217;t been able to find it in 30 seconds of Googling (well, I couldn&#8217;t at work, but I&#8217;ve since found <a href="http://www.cssdrive.com/index.php/main/csscompressor/">this</a>&#8230; Oh well!), so I set up a quick script to do it for me:</p>
<p><a href="http://www.dom111.co.uk/files/minifycss/">http://www.dom111.co.uk/files/minifycss/</a></p>
<p>If it&#8217;s useful, I might set up a memorable URL, let me know in the comments <img src='http://www.dom111.co.uk/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I did set up <a href="http://marijn.haverbeke.nl/codemirror/">syntax highlighting, using codemirror</a>, which looked pretty nice, but made the minification (on large-ish files) take far too long. I haven&#8217;t really tested on any huge files, so try this at your own risk, but it seems faster that TextMate was.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dom111.co.uk/blog/coding/minify-css-shrink-your-css-down-to-size/238/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery &#8211; Persistent Input Labels</title>
		<link>http://www.dom111.co.uk/blog/coding/jquery-persistent-input-labels/236</link>
		<comments>http://www.dom111.co.uk/blog/coding/jquery-persistent-input-labels/236#comments</comments>
		<pubDate>Thu, 01 Apr 2010 08:03:58 +0000</pubDate>
		<dc:creator>dom111</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[User Interaction]]></category>
		<category><![CDATA[input hint]]></category>
		<category><![CDATA[input label]]></category>
		<category><![CDATA[persistent input hint]]></category>
		<category><![CDATA[persistent input label]]></category>

		<guid isPermaLink="false">http://www.dom111.co.uk/blog/?p=236</guid>
		<description><![CDATA[Do you forget whats supposed to go in the field the second you tab onto it? Are you concerned your users will too? Never fear! This simple plugin places an element of the same type underneath the current element and shows the contents of the title attribute (or whatever attribute you decide to use) as [...]]]></description>
			<content:encoded><![CDATA[<p>Do you forget whats supposed to go in the field the second you tab onto it?</p>
<p>Are you concerned your users will too?</p>
<p>Never fear! This simple plugin places an element of the same type underneath the current element and shows the contents of the title attribute (or whatever attribute you decide to use) as a label until you type text into the box!</p>
<p>It&#8217;s a very early version, and probably has a few bugs, but I&#8217;ve implemented enough to make it fairly useful I think. Unfortunately when you resize a textarea in webkit, it doesn&#8217;r fire the resize event, so I&#8217;ve added a workaround using mousemove (I tried to only capture mousemove if a mousedown had been detected, but to no avail&#8230;)</p>
<p>You can <a href="/files/jquery-inputLabelPersist">see a demo here</a>, and <a href="/files/jquery-inputLabelPersist/jquery.inputLabelPersist-0.1.tar.gz">get the files here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dom111.co.uk/blog/coding/jquery-persistent-input-labels/236/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dropdownify &#8211; Minimal effort dropdown</title>
		<link>http://www.dom111.co.uk/blog/coding/dropdownify-minimal-effort-dropdown/218</link>
		<comments>http://www.dom111.co.uk/blog/coding/dropdownify-minimal-effort-dropdown/218#comments</comments>
		<pubDate>Wed, 27 Jan 2010 12:19:38 +0000</pubDate>
		<dc:creator>dom111</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[drop-down]]></category>
		<category><![CDATA[drop-down menu]]></category>
		<category><![CDATA[drop-down navigation]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[top nav]]></category>

		<guid isPermaLink="false">http://www.dom111.co.uk/blog/?p=218</guid>
		<description><![CDATA[So recently I was asked to change a navigation style of an existing site to drop-down menus. Simple, I thought, just use one of the many existing drop-down plugins. I tried many, but most seemed to use hardcoded styles and I had a few problems (some of which I encountered again, writing this). So I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p>So recently I was asked to change a navigation style of an existing site to drop-down menus.</p>
<p>Simple, I thought, just use one of the many existing drop-down plugins. I tried many, but most seemed to use hardcoded styles and I had a few problems (some of which I encountered again, writing this).</p>
<p>So I&#8217;ve made this, I think it&#8217;s fairly robust, but I&#8217;m sure there&#8217;ll be problems with embedded objects (flash) and select boxes (in <= IE6), but for my needs, it sufficed, so I thought I'd share, in case anyone else needs a simple script to manage drop-downs.</p>
<p>To use, create a nest of elements like this:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;ul id=&quot;top&quot;&gt;
  &lt;li&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;</pre></div></div>

<p>or something similar (any elements, <strong><em>should</em></strong> work) and call:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// jQuery:</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'ul#top'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">dropdownify</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// mootools</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'top'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">dropdownify</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Which should create a simple drop-down.</p>
<p>There are a couple of examples, <a href="/files/dropdownify/jquery">one for jQuery</a> and <a href="/files/dropdownify/mootools">one for mootools</a>, and the files can downloaded <a href="/files/dropdownify/jquery.dropdownify-0.1.tar.gz">here</a> and <a href="/files/dropdownify/dropdownify-0.1.tar.gz">here</a>.</p>
<p>I did encounter a problem with IE, mainly due to z-index faults, so with HTML code like the following:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div class=&quot;nav-wrapper&quot;&gt;
  &lt;ul id=&quot;top&quot;&gt;
    &lt;li&gt;
      &lt;ul&gt;
        &lt;li&gt;&lt;/li&gt;
      &lt;/ul&gt;
    &lt;/li&gt;
  &lt;/ul&gt;
&lt;/div&gt;</pre></div></div>

<p>I used the following CSS:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">div.nav-wrapper<span style="color: #00AA00;">,</span>
div<span style="color: #6666ff;">.nav-wrapper</span> ul<span style="color: #00AA00;">,</span>
div<span style="color: #6666ff;">.nav-wrapper</span> ul li <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">static</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">100</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.dom111.co.uk/blog/coding/dropdownify-minimal-effort-dropdown/218/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Message &#8211; Letting the user know what&#8217;s going on</title>
		<link>http://www.dom111.co.uk/blog/coding/jquery-message-letting-the-user-know-whats-going-on/209</link>
		<comments>http://www.dom111.co.uk/blog/coding/jquery-message-letting-the-user-know-whats-going-on/209#comments</comments>
		<pubDate>Mon, 14 Dec 2009 09:40:14 +0000</pubDate>
		<dc:creator>dom111</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[User Interaction]]></category>
		<category><![CDATA[growl]]></category>
		<category><![CDATA[notification]]></category>

		<guid isPermaLink="false">http://www.dom111.co.uk/blog/?p=209</guid>
		<description><![CDATA[Recently I&#8217;ve seen a few implementation of Growl in Javascript and basically just thought I&#8217;d have a go too. Everyone&#8217;s doing it, or so it seems! This simple implementation is styled using pure CSS and you should be to easily modify it to suit your needs! I&#8217;ve set up a demo page and the files [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="size-medium wp-image-211 aligncenter" title="Screenshot" src="http://www.dom111.co.uk/blog/wp-content/2009/12/Screen-shot-2009-12-14-at-09.44.16-300x209.png" alt="Screenshot" width="300" height="209" /></p>
<p>Recently I&#8217;ve seen a few implementation of Growl in Javascript and basically just thought I&#8217;d have a go too. Everyone&#8217;s doing it, or so it seems!</p>
<p>This simple implementation is styled using pure CSS and you should be to easily modify it to suit your needs!</p>
<p>I&#8217;ve <a href="/files/jquery-message/">set up a demo page</a> and the <a href="/files/jquery-message/jquery-message-0.1.tar.gz">files can be grabbed from here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dom111.co.uk/blog/coding/jquery-message-letting-the-user-know-whats-going-on/209/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Ajaxify &#8211; Update</title>
		<link>http://www.dom111.co.uk/blog/coding/jquery-ajaxify-update/191</link>
		<comments>http://www.dom111.co.uk/blog/coding/jquery-ajaxify-update/191#comments</comments>
		<pubDate>Thu, 24 Sep 2009 14:17:56 +0000</pubDate>
		<dc:creator>dom111</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[ajax form]]></category>
		<category><![CDATA[ajaxify]]></category>
		<category><![CDATA[form]]></category>

		<guid isPermaLink="false">http://www.dom111.co.uk/blog/?p=191</guid>
		<description><![CDATA[I&#8217;ve been doing more work on the jQuery AJAXify plugin, it&#8217;s now a lot more robust (I think&#8230;) and I&#8217;ve squashed a few bugs that were in the previous version (with help from Andrea Battaglia) along with adding in a few new features (with their own bugs no doubt!). Theres an updated test page and [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been doing more work on the jQuery AJAXify plugin, it&#8217;s now a lot more robust (I think&#8230;) and I&#8217;ve squashed a few bugs that were in the previous version (with help from Andrea Battaglia) along with adding in a few new features (with their own bugs no doubt!).</p>
<p>Theres an <a href="/files/ajaxify/0.4/">updated test page</a> and as ever <a href="/files/ajaxify/0.4/jquery.ajaxify-0.4.tar.gz">a direct link to download here</a>.</p>
<p>Check out the <a href="/files/ajaxify/0.4/">test page</a> to see the new features!</p>
<p><strong>Edit</strong>: Further updates, all links have been updated to version 0.3b. Added (and documented existing) callbacks as requested by Sebioff! And a further fix for the &#8216;append&#8217; option. Also fixed IE6 compatibility.</p>
<p><strong>Further Update</strong>: Another update after the comment from David Lee about $(&#8216;form&#8217;).serialize();</p>
<p><strong>Another Further Update</strong>: I have <a href="http://ajaxify.googlecode.com/">set up a Google Code repository for this plugin,</a> which states that this code is released under the MIT license.</p>
<p><strong>Update October 2010</strong>: I have <a href="/blog/coding/jquery-ajaxify-lite/275">updated this plugin for jQuery 1.4.3 as a &#8216;lite&#8217; version</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dom111.co.uk/blog/coding/jquery-ajaxify-update/191/feed</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>String Variable Concatenation</title>
		<link>http://www.dom111.co.uk/blog/coding/string-variable-concatenation/149</link>
		<comments>http://www.dom111.co.uk/blog/coding/string-variable-concatenation/149#comments</comments>
		<pubDate>Fri, 14 Aug 2009 13:27:09 +0000</pubDate>
		<dc:creator>dom111</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[string concatenation]]></category>
		<category><![CDATA[variable concatenation]]></category>

		<guid isPermaLink="false">http://www.dom111.co.uk/blog/?p=149</guid>
		<description><![CDATA[I stumbled across something odd today in PHP: $r = ''; $r .= $r .= $r .= 'a'; Now, personally, I&#8217;d have expected a syntax error from the above code, but the result was even more confusing at first&#8230; print $r; // 'aaaa' Not sure if this was the expected output or not I tested [...]]]></description>
			<content:encoded><![CDATA[<p>I stumbled across something odd today in PHP:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$r</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$r</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$r</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$r</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'a'</span><span style="color: #339933;">;</span></pre></div></div>

<p>Now, personally, I&#8217;d have expected a syntax error from the above code, but the result was even more confusing at first&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">print</span> <span style="color: #000088;">$r</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// 'aaaa'</span></pre></div></div>

<p>Not sure if this was the expected output or not I tested similar code in other languages:</p>
<p>Ruby:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">r = <span style="color:#996600;">''</span>
r <span style="color:#006600; font-weight:bold;">+</span>= r <span style="color:#006600; font-weight:bold;">+</span>= r <span style="color:#006600; font-weight:bold;">+</span>= <span style="color:#996600;">'a'</span>
<span style="color:#CC0066; font-weight:bold;">puts</span> r <span style="color:#008000; font-style:italic;"># 'a'</span></pre></div></div>

<p>Python:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">r = <span style="color: #483d8b;">''</span>
r += r += r += <span style="color: #483d8b;">'a'</span>
<span style="color: #808080; font-style: italic;">#   File &quot;&quot;, line 1</span>
<span style="color: #808080; font-style: italic;">#     r += r += r += 'a'</span>
<span style="color: #808080; font-style: italic;">#             ^</span>
<span style="color: #808080; font-style: italic;"># SyntaxError: invalid syntax</span></pre></div></div>

<p>Javascript:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> r <span style="color: #339933;">=</span> <span style="color: #3366CC;">''</span><span style="color: #339933;">;</span>
r <span style="color: #339933;">+=</span> r <span style="color: #339933;">+=</span> r <span style="color: #339933;">+=</span> <span style="color: #3366CC;">'a'</span><span style="color: #339933;">;</span>
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>r<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// 'a'</span></pre></div></div>

<p>Perl:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$r</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">''</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$r</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">$r</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">$r</span> <span style="color: #339933;">.=</span> <span style="color: #ff0000;">'a'</span><span style="color: #339933;">;</span>
<span style="color: #000066;">print</span> <span style="color: #0000ff;">$r</span><span style="color: #339933;">;</span> <span style="color: #339933;">//</span> <span style="color: #ff0000;">'aaaa'</span></pre></div></div>

<p>That explains it!</p>
<p>So the reason the string is &#8216;aaaa&#8217; seems to be that the code is evaluated from right to left:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$r</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$r</span> <span style="color: #339933;">+=</span> <span style="color: #000088;">$r</span> <span style="color: #339933;">+=</span> <span style="color: #000088;">$r</span> <span style="color: #339933;">+=</span> <span style="color: #0000ff;">'a'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// How it works:</span>
<span style="color: #666666; font-style: italic;">//</span>
<span style="color: #666666; font-style: italic;">// $r += 'a'; // 'a'</span>
<span style="color: #666666; font-style: italic;">// $r += $r += 'a'; // 'a' + 'a';</span>
<span style="color: #666666; font-style: italic;">// $r += $r += $r += 'a'; // 'aa' + ('a' + 'a')</span></pre></div></div>

<p>I don&#8217;t think it&#8217;s a bug, well, at least I assume not, but is there a name for this?</p>
<p><strong>Update</strong>: I <a href="http://www.reddit.com/r/PHP/comments/9amid/string_concatenation/">asked some clever people for help understanding it</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dom111.co.uk/blog/coding/string-variable-concatenation/149/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Ajaxify</title>
		<link>http://www.dom111.co.uk/blog/coding/jquery-ajaxify/145</link>
		<comments>http://www.dom111.co.uk/blog/coding/jquery-ajaxify/145#comments</comments>
		<pubDate>Tue, 11 Aug 2009 21:58:03 +0000</pubDate>
		<dc:creator>dom111</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[ajaxify]]></category>
		<category><![CDATA[html forms]]></category>

		<guid isPermaLink="false">http://www.dom111.co.uk/blog/?p=145</guid>
		<description><![CDATA[Probably not the first person to implement this, but I wanted to make an automatic form AJAX-&#8217;ifier&#8217; that could capture which submit button had caused the submit event to be fired too. It&#8217;s implemented fairly simply: $&#40;'form'&#41;.ajaxify&#40;&#41;; There&#8217;s a demo page or you can just download it and have a look. Update: As pointed out [...]]]></description>
			<content:encoded><![CDATA[<p>Probably not the first person to implement this, but I wanted to make an automatic form AJAX-&#8217;ifier&#8217; that could capture which submit button had caused the submit event to be fired too.</p>
<p>It&#8217;s implemented fairly simply:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'form'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ajaxify</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>There&#8217;s a <a href="/files/ajaxify">demo page</a> or you can just <a href="/files/ajaxify/jquery.ajaxify-0.1a.tar.gz">download it and have a look</a>.</p>
<p><strong>Update</strong>: As pointed out by Andrea in the comments below, this would return the value of radio and checkboxes even if they weren&#8217;t selected. I have released 0.1a and updated the link above to fix this issue. Thanks Andrea!</p>
<p><strong>Update 2</strong>: I have updated this plugin, <a href="/blog/coding/jquery-ajaxify-update/191">view this post for more information</a>.</p>
<p><strong>Update October 2010</strong>: I have <a href="/blog/coding/jquery-ajaxify-lite/275">updated this plugin for jQuery 1.4.3 as a &#8216;lite&#8217; version</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dom111.co.uk/blog/coding/jquery-ajaxify/145/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

