<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>JavaScriptly</title>
	
	<link>http://javascriptly.com</link>
	<description>JavaScript on Modern Web</description>
	<pubDate>Tue, 14 Oct 2008 03:23:22 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
	<language>en</language>
			<image><link>http://javascriptly.com</link><url>http://javascriptly.com/wp-content/themes/Padangan/images/javascriptly-logo.gif</url><title>JavaScriptly</title></image><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/javascriptly" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>JQuery Code Content Assistance for Eclipse WTP</title>
		<link>http://feedproxy.google.com/~r/javascriptly/~3/ueb1HbEYJIc/</link>
		<comments>http://javascriptly.com/2008/10/jquery-eclipse-wtp/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 03:16:23 +0000</pubDate>
		<dc:creator>Jimmy Vu</dc:creator>
		
		<category><![CDATA[JQuery]]></category>

		<category><![CDATA[Eclipse]]></category>

		<category><![CDATA[WTP]]></category>

		<guid isPermaLink="false">http://javascriptly.com/?p=48</guid>
		<description><![CDATA[<div style="position:relative; width: 100%; padding: 0 0 90px 0;"><div style="position: absolute; bottom: 10px; width: 42px;"><script type="text/javascript">
<!--
var dzone_url = 'http://javascriptly.com/2008/10/jquery-eclipse-wtp/';
var dzone_title = 'JQuery Code Content Assistance for Eclipse WTP';
var dzone_blurb = '';
var dzone_style = '1';
//-->
</script>
<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script> 
</div>
JavaScript code content assistance built in Eclipse WTP does very good job that I found even better than the same functionality in some commercial solutions, however, JQuery&#8217;s syntax is not supported (no surprise). That&#8217;s why jQueryWTP tool comes to help adding JQuery support to Eclipse WTP (and Eclipse PDT, MyEclipse which are based on WTP [...]]]></description>
			<content:encoded><![CDATA[<div style="position:relative; width: 100%; padding: 0 0 90px 0;"><div style="position: absolute; bottom: 10px; width: 42px;"><script type="text/javascript">
<!--
var dzone_url = 'http://javascriptly.com/2008/10/jquery-eclipse-wtp/';
var dzone_title = 'JQuery Code Content Assistance for Eclipse WTP';
var dzone_blurb = '';
var dzone_style = '1';
//-->
</script>
<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script> 
</div>
<p style="text-align: justify;">JavaScript code content assistance built in Eclipse WTP does very good job that I found even better than the same functionality in some commercial solutions, however, JQuery&#8217;s syntax is not supported (no surprise). That&#8217;s why jQueryWTP tool comes to help adding JQuery support to Eclipse WTP (and Eclipse PDT, MyEclipse which are based on WTP too.)</p>
<p style="text-align: justify;">This is not an Eclipse plugin instead a tool to patch the existing plugin and inject JQuery&#8217;s syntax support into it. First <a href="http://sourceforge.net/project/showfiles.php?group_id=202840&amp;package_id=241633&amp;release_id=631407" onclick="javascript:pageTracker._trackPageview('/outbound/article/sourceforge.net');">download the tool from SourceForce</a>; it&#8217;s a Java executable JAR so you can double-click to it or run it from command line:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;">java <span style="color: #660033;">-jar</span> jqueryWTP0.2forJQuery1.2.6.jar</pre></div></div>

<p style="text-align: justify;">Now browse to plugin file</p>
<p style="text-align: justify;"><code>org.eclipse.wst.javascript.ui_xxxxxxx.jar</code></p>
<p style="text-align: justify;">and set output directory to generate the patch. Please backup the original file and set output directory different from source one.</p>
<p>&nbsp;</p>
<p style="text-align: justify;"><img class="alignnone size-full wp-image-49" title="jquery-eclipse-wtp-ui" src="http://javascriptly.com/wp-content/uploads/2008/10/jquery-eclipse-wtp-ui.gif" alt="jquery-eclipse-wtp-ui.gif" width="492" height="138" /></p>
<p>&nbsp;</p>
<p style="text-align: justify;">Select &#8220;<strong>Generate</strong>&#8221; button to get the patched file then copy over original file. Start Eclipse and open a HTML or script file to see JQuery&#8217;s functions listed on code assistance like image below.</p>
<p>&nbsp;</p>
<p style="text-align: justify;"><img class="alignnone size-full wp-image-50" title="jquery-eclipse-wtp-code-assistance" src="http://javascriptly.com/wp-content/uploads/2008/10/jquery-eclipse-wtp-code-assistance.gif" alt="wtp-code-assistance.gif" width="500" height="429" /></p>
<p>&nbsp;</p>
<p style="text-align: justify;">Find more info about JQueryWTP and donate for project <a href="http://www.langtags.com/jquerywtp/index.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.langtags.com');" target="_blank">here</a>.</p>

</div><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/javascriptly?a=ueb1HbEYJIc:NO0YRJ2ZHEQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=ueb1HbEYJIc:NO0YRJ2ZHEQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=ueb1HbEYJIc:NO0YRJ2ZHEQ:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=ueb1HbEYJIc:NO0YRJ2ZHEQ:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=ueb1HbEYJIc:NO0YRJ2ZHEQ:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=ueb1HbEYJIc:NO0YRJ2ZHEQ:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=ueb1HbEYJIc:NO0YRJ2ZHEQ:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=ueb1HbEYJIc:NO0YRJ2ZHEQ:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=ueb1HbEYJIc:NO0YRJ2ZHEQ:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=ueb1HbEYJIc:NO0YRJ2ZHEQ:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=ueb1HbEYJIc:NO0YRJ2ZHEQ:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=l6gmwiTKsz0" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://javascriptly.com/2008/10/jquery-eclipse-wtp/feed/</wfw:commentRss>
		<feedburner:origLink>http://javascriptly.com/2008/10/jquery-eclipse-wtp/</feedburner:origLink></item>
		<item>
		<title>Simple Web Chat with Meteor Comet Server</title>
		<link>http://feedproxy.google.com/~r/javascriptly/~3/_1RmeRM3dMM/</link>
		<comments>http://javascriptly.com/2008/09/comet-chat-app-meteor-server/#comments</comments>
		<pubDate>Fri, 19 Sep 2008 11:29:15 +0000</pubDate>
		<dc:creator>Jimmy Vu</dc:creator>
		
		<category><![CDATA[Solution]]></category>

		<category><![CDATA[Ajax]]></category>

		<category><![CDATA[Comet]]></category>

		<category><![CDATA[Meteor]]></category>

		<guid isPermaLink="false">http://javascriptly.com/?p=43</guid>
		<description><![CDATA[<div style="position:relative; width: 100%; padding: 0 0 90px 0;"><div style="position: absolute; bottom: 10px; width: 42px;"><script type="text/javascript">
<!--
var dzone_url = 'http://javascriptly.com/2008/09/comet-chat-app-meteor-server/';
var dzone_title = 'Simple Web Chat with Meteor Comet Server';
var dzone_blurb = '';
var dzone_style = '1';
//-->
</script>
<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script> 
</div>

Comet is not really brand-new (Ajax) term today; however, with most of people how it works remains somewhat mysterious.
I have a little hand-on experience with Comet when creating a hobby game project with DWR Reverse Ajax sometime ago. It (DWR) was simple to start and really worked but required a Java web server (Tomcat, Jetty&#8230;) [...]]]></description>
			<content:encoded><![CDATA[<div style="position:relative; width: 100%; padding: 0 0 90px 0;"><div style="position: absolute; bottom: 10px; width: 42px;"><script type="text/javascript">
<!--
var dzone_url = 'http://javascriptly.com/2008/09/comet-chat-app-meteor-server/';
var dzone_title = 'Simple Web Chat with Meteor Comet Server';
var dzone_blurb = '';
var dzone_style = '1';
//-->
</script>
<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script> 
</div>
<p><a href="http://meteorserver.org/" onclick="javascript:pageTracker._trackPageview('/outbound/article/meteorserver.org');"><img src="http://javascriptly.com/wp-content/uploads/2008/09/meteor-logo.png" alt="" title="meteor-logo" width="342" height="207" class="alignnone size-full wp-image-45" /></a></p>
<p style="text-align: justify;"><a href="http://alex.dojotoolkit.org/?p=545" onclick="javascript:pageTracker._trackPageview('/outbound/article/alex.dojotoolkit.org');">Comet</a> is not really brand-new (Ajax) term today; however, with most of people how it works remains somewhat mysterious.</p>
<p style="text-align: justify;">I have a little hand-on experience with Comet when creating a hobby game project with <a href="http://directwebremoting.org/dwr/reverse-ajax" onclick="javascript:pageTracker._trackPageview('/outbound/article/directwebremoting.org');">DWR Reverse Ajax</a> sometime ago. It (DWR) was simple to start and really worked but required a Java web server (Tomcat, Jetty&#8230;) that I found rather expensive (in term of resources) for such small application. I want a small, dedicated and reliable server for Comet apps while don&#8217;t like to be deeply sunk in technical terms like &#8220;Bayeux&#8221; or &#8220;Continuation&#8221;.</p>
<p style="text-align: justify;">After reviewing the <a href="http://cometdaily.com/maturity.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/cometdaily.com');">Comet Maturity Guide</a> from Comet Daily I decided to give <a href="http://meteorserver.org/" onclick="javascript:pageTracker._trackPageview('/outbound/article/meteorserver.org');">Meteor Comet server</a> a try for several reasons, especially because it&#8217;s built on Perl that can be easily deployed in any server with Perl installed (i.e. almost all Linux servers, no?) and it should be lightweight (up to my experience with Perl). Here is <a href="http://cometdaily.com/2008/03/14/comet-gazing-maturity/" onclick="javascript:pageTracker._trackPageview('/outbound/article/cometdaily.com');">other info about Meteor server</a>:</p>
<blockquote><ol type="1">
<li>Server daemon will run on any      platform for which Perl is available.</li>
<li style="text-align: justify;">In live use typically 1,000      clients per node receiving 2 msgs (~400 bytes) per sec each. Tested up to      5,000 clients per node receiving 1 msg/sec each.</li>
<li style="text-align: justify;">Nodes exist independently,      supports broadcasting for message distribution. Cluster of three Meteor      nodes runs <a href="http://cometdaily.com/2007/11/07/developing-markets-live-for-the-ft/" onclick="javascript:pageTracker._trackPageview('/outbound/article/cometdaily.com');">FT      Alphaville</a>.</li>
<li>Transports are completely      configurable within simple constraints.</li>
<li>Server supports client      ‘catch-up&#8217;, allowing clients to regulate quality of service themselves.</li>
<li>Stable, in production use.</li>
<li>GPL v2. Free.</li>
</ol>
</blockquote>
<h2>Install &amp; Setup Meteor Server</h2>
<p style="text-align: justify;">You can find very good how-to guide for installing Meteor server from <a href="http://meteorserver.org/installation/" onclick="javascript:pageTracker._trackPageview('/outbound/article/meteorserver.org');">Meteorserver.org</a>; actually it&#8217;s quite simple to follow. Just download, extract to default location (/usr/local/meteor) and configure daemon service as guided. One notice is on Fedora/Cent OS the start function in init scripts must be changed from:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> –u root .<span style="color: #000000; font-weight: bold;">/</span>meteord <span style="color: #000000; font-weight: bold;">&gt;/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>meteord <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">&amp;</span></pre></div></div>

<p>to:</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>meteord <span style="color: #000000; font-weight: bold;">&gt;/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>meteord <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">&amp;</span></pre></div></div>

<p style="text-align: justify;">After installed and run, the server will listen on 2 ports: 4670 and 4671 as default - the first port is &#8220;Subscriber port&#8221; and the second is &#8220;Controller port&#8221;. However, you typically want to serve your website on port 80 to avoid cross-site scripting restrictions, therefore, Meteor must also serve on the same port. Yes, the installation guide points out three possible ways to do that:</p>
<blockquote>
<p style="text-align: justify;">1. Set SubscriberPort to 80 and SubscriberIP to a specific      IP, say X.X.X.1, in the Meteor config file. This will bind Meteor to a      particular IP address on port 80 and leave Apache to bind to port 80 on a      different IP. To make this work you will need to run Meteor as root, and      configure Apache (or whatever web-server you&#8217;re using) to bind to port 80      on a <em>different IP</em>, say X.X.X.2.</p>
<p style="text-align: justify;">2. Configure a firewall to redirect traffic on      port 80 of one specific IP, to the Meteor Subscriber port (typically      4670). Then both Meteor and Apache can run in their default      configurations, and Meteor can be run as a non-privileged user. So, if      you&#8217;re using iptables you need the following commands:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="bash bash" style="font-family:monospace;">iptables <span style="color: #660033;">-t</span> nat <span style="color: #660033;">-I</span> PREROUTING <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--dport</span> <span style="color: #000000;">80</span> <span style="color: #660033;">--destination</span> X.X.X.1 <span style="color: #660033;">-j</span> REDIRECT <span style="color: #660033;">--to-port</span> <span style="color: #000000;">4670</span>
iptables <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--dport</span> <span style="color: #000000;">4670</span> <span style="color: #660033;">-j</span> ACCEPT
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>iptables save</pre></td></tr></table></div>

<p>or if you&#8217;ve got a hardware firewall, set up an equivilent set of rules on that.</p>
<p style="text-align: justify;">3. Run Meteor on a different physical server to      the one running Apache. Then each server need only have one IP, and Apache      can be run in its default configuration. Meteor must be set to use port 80      and be run as root.</p>
</blockquote>
<p style="text-align: justify;">Well, in brief, you&#8217;ll need either another dedicated (virtual) server or to obtain another IP. But if you don&#8217;t have another server and don&#8217;t want to buy extra IP just for testing, I can tell you <strong>the forth way</strong> to get Meteor server work in the same machine and the same IP. The answer is to configure &#8220;Reverse Proxy&#8221; to pass all requests from specific domain to Meteor. Fortunately, it&#8217;s very simple to do that with Apache&#8217;s mod proxy. Here are what I did.</p>
<p style="text-align: justify;">    1. Make  sure Apache to load &#8220;mod proxy&#8221; by commenting out the following line in  <code>httpd.conf</code> file.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="bash bash" style="font-family:monospace;">LoadModule proxy_module modules<span style="color: #000000; font-weight: bold;">/</span>mod_proxy.so
LoadModule proxy_connect_module modules<span style="color: #000000; font-weight: bold;">/</span>mod_proxy_connect.so
LoadModule proxy_http_module modules<span style="color: #000000; font-weight: bold;">/</span>mod_proxy_http.so</pre></td></tr></table></div>

<p style="text-align: justify;">    2. Add      &#8220;reverse proxy&#8221; for the sub-domain (like data.yourdomain.com) that points to Meteor</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="bash bash" style="font-family:monospace;">NameVirtualHost <span style="color: #000000; font-weight: bold;">*</span>:<span style="color: #000000;">80</span>
<span style="color: #666666; font-style: italic;"># other virtual hosts</span>
<span style="color: #666666; font-style: italic;">#...</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>VirtualHost <span style="color: #000000; font-weight: bold;">*</span>:<span style="color: #000000;">80</span><span style="color: #000000; font-weight: bold;">&gt;</span>
    	ServerAdmin admin<span style="color: #000000; font-weight: bold;">@</span>localhost
    	ServerName data.yourdomain.com
&nbsp;
 	    	ProxyPass  <span style="color: #000000; font-weight: bold;">/</span>  http:<span style="color: #000000; font-weight: bold;">//</span>127.0.0.1:<span style="color: #000000;">4670</span><span style="color: #000000; font-weight: bold;">/</span>
    	    	ProxyPassReverse  <span style="color: #000000; font-weight: bold;">/</span>  http:<span style="color: #000000; font-weight: bold;">//</span>127.0.0.1:<span style="color: #000000;">4670</span><span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #000000; font-weight: bold;">&lt;/</span>VirtualHost<span style="color: #000000; font-weight: bold;">&gt;</span></pre></td></tr></table></div>

<p style="text-align: left;">Restart Apache and you&#8217;ll see the magic work!</p>
<h2>The Chat Application</h2>
<p style="text-align: justify;">I often start with a Comet solution by building an online chat so that I can test how fast and reliable the solution is across different browsers. Also, it&#8217;s interesting to see messages coming in real-time manner.</p>
<p style="text-align: left;">Of course, there is no rocket science here; it looks simple like the demo below.</p>
<div id="attachment_44" class="wp-caption alignnone" style="width: 510px"><a href="http://javascriptly.com/examples/comet/" ><img src="http://javascriptly.com/wp-content/uploads/2008/09/comet-chat-meteor.gif" alt="Web Chat on Meteor Comet Server" title="comet-chat-meteor" width="500" height="402" class="size-full wp-image-44" /></a><p class="wp-caption-text">Web Chat on Meteor Comet Server</p></div>
<p style="text-align: justify;">Essentially, you&#8217;ll have to include Meteor&#8217;s scripts from sub-domain, <code>data.javascriptly.com</code> in this demo. This script file comes from Meteor server we configured as above and enclose all functions to pull messages in (near) real time.</p>

<div class="wp_syntax"><div class="code"><pre class="xml xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;http://data.javascriptly.com/meteor.js&quot;</span> <span style="color: #000066;">charset</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p style="text-align: left;">Then, setup Comet connection on page load:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="javascript javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// Set this to something unique to this client</span>
Meteor.<span style="color: #660066;">hostid</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;1234567&quot;</span>;
<span style="color: #006600; font-style: italic;">// Our Meteor server is on the data. subdomain</span>
Meteor.<span style="color: #660066;">host</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;data.&quot;</span> <span style="color: #339933;">+</span> location.<span style="color: #660066;">hostname</span>;
<span style="color: #006600; font-style: italic;">// Call the addMsg() function when data arrives</span>
Meteor.<span style="color: #660066;">registerEventCallback</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;process&quot;</span><span style="color: #339933;">,</span> addMsg<span style="color: #009900;">&#41;</span>;
<span style="color: #006600; font-style: italic;">// Join the chat channel and get last 10 events, then stream</span>
Meteor.<span style="color: #660066;">joinChannel</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;chat&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">10</span><span style="color: #009900;">&#41;</span>;
Meteor.<span style="color: #660066;">mode</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'stream'</span>;
<span style="color: #006600; font-style: italic;">// Start streaming!</span>
Meteor.<span style="color: #660066;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;</pre></td></tr></table></div>

<p style="text-align: justify;">Every time a message arrives, the <code>addMsg()</code> function will be executed to add it to chat console, simple enough!</p>
<p style="text-align: justify;">Now, when you click &#8220;Send&#8221; button the message you&#8217;ve typed in will be sent to Apache/PHP server (not the Meteor server) using an Ajax POST.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="javascript javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> sendMsg<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> msg <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#message'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>msg.<span style="color: #660066;">length</span> <span style="color: #339933;">==</span> 0<span style="color: #009900;">&#41;</span> 
		<span style="color: #000066; font-weight: bold;">return</span>;
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> user <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#user'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>user.<span style="color: #660066;">length</span> <span style="color: #339933;">==</span> 0<span style="color: #009900;">&#41;</span> user <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;Guest&quot;</span>;
&nbsp;
	$.<span style="color: #660066;">post</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'chat.php'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
		user<span style="color: #339933;">:</span> toCharRef<span style="color: #009900;">&#40;</span>user<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> 
		message<span style="color: #339933;">:</span> toCharRef<span style="color: #009900;">&#40;</span>msg<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#message'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>;
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#message'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p style="text-align: justify;">On receipt Apache/PHP will parse the message and write it to Meteor&#8217;s Controller which is listening on port 4671 like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="php php" style="font-family:monospace;"><span style="color: #339933;">...</span>
<span style="color: #000088;">$ch</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;chat&quot;</span>;
<span style="color: #000088;">$op</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">false</span>;
<span style="color: #666666; font-style: italic;">// Open a controller channel to Meteor server</span>
<span style="color: #990000;">echo</span> <span style="color: #0000ff;">&quot;Connecting to Meteor<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$op</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fsockopen</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;127.0.0.1&quot;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">4671</span><span style="color: #339933;">,</span> <span style="color: #000088;">$errno</span><span style="color: #339933;">,</span> <span style="color: #000088;">$errstr</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #990000;">echo</span> <span style="color: #0000ff;">&quot;Meteor not responding<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
	<span style="color: #990000;">socket_set_blocking</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$op</span><span style="color: #339933;">,</span><span style="color: #000000; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>;
	<span style="color: #990000;">echo</span> <span style="color: #0000ff;">&quot;Connected<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
	<span style="color: #000088;">$haswritten</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">false</span>;
	<span style="color: #000088;">$buf</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span>;
	<span style="color: #000088;">$out</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;ADDMESSAGE &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$ch</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; &lt;strong&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$user</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$time</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/strong&gt; &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$message</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
	<span style="color: #339933;">...</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p style="text-align: justify;">Meteor server, then, delivers added message to all clients subscribing to &#8220;chat&#8221; channel. That&#8217;s all.</p>
<p style="text-align: justify;">The app works seamlessly on IE6/7/8, Firefox 3, Safari 3.1 while on Opera 9.2 and Google Chrome Meteor uses &#8220;simple forever IFRAME&#8221; technique for streaming which makes hourglass pointer display all the time. Hope Andrew Betts and team will find some workaround to avoid this issue in next version?</p>
<p style="text-align: justify;">Chat message supports Unicode (the feature many developers ignore) so you can chat in any language you like: German, French, Chinese, Japanese and English of course. Please feel free to leave your comments/questions here.</p>
<ul>
<li><strong><a href="http://javascriptly.com/examples/comet/"  title="Demo">View solution online</a></strong></li>
<li><strong><a href="http://javascriptly.com/examples/comet.zip" onclick="javascript:pageTracker._trackPageview('/downloads/examples/comet.zip');" title="Download">Download source code</a></strong></li>
</ul>

</div><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/javascriptly?a=_1RmeRM3dMM:iTLmvAJwg3Y:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=_1RmeRM3dMM:iTLmvAJwg3Y:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=_1RmeRM3dMM:iTLmvAJwg3Y:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=_1RmeRM3dMM:iTLmvAJwg3Y:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=_1RmeRM3dMM:iTLmvAJwg3Y:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=_1RmeRM3dMM:iTLmvAJwg3Y:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=_1RmeRM3dMM:iTLmvAJwg3Y:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=_1RmeRM3dMM:iTLmvAJwg3Y:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=_1RmeRM3dMM:iTLmvAJwg3Y:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=_1RmeRM3dMM:iTLmvAJwg3Y:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=_1RmeRM3dMM:iTLmvAJwg3Y:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=l6gmwiTKsz0" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://javascriptly.com/2008/09/comet-chat-app-meteor-server/feed/</wfw:commentRss>
		<feedburner:origLink>http://javascriptly.com/2008/09/comet-chat-app-meteor-server/</feedburner:origLink></item>
		<item>
		<title>Quick &amp; Useful JQuery Plugins</title>
		<link>http://feedproxy.google.com/~r/javascriptly/~3/GfmlFDkgN7c/</link>
		<comments>http://javascriptly.com/2008/09/quick-useful-jquery-plugins/#comments</comments>
		<pubDate>Tue, 16 Sep 2008 19:55:49 +0000</pubDate>
		<dc:creator>Jimmy Vu</dc:creator>
		
		<category><![CDATA[Solution]]></category>

		<category><![CDATA[JQuery]]></category>

		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://javascriptly.com/?p=39</guid>
		<description><![CDATA[<div style="position:relative; width: 100%; padding: 0 0 90px 0;"><div style="position: absolute; bottom: 10px; width: 42px;"><script type="text/javascript">
<!--
var dzone_url = 'http://javascriptly.com/2008/09/quick-useful-jquery-plugins/';
var dzone_title = 'Quick &#038; Useful JQuery Plugins';
var dzone_blurb = '';
var dzone_style = '1';
//-->
</script>
<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script> 
</div>
Here are some quick and useful JQuery plugins from Jason Frame&#8217;s &#8220;JQuery Grab Bag&#8220;.
Auto-Grow TextArea
The technique is borrowed from Facebook that uses an off-screen &#60;div&#62; to calculate the required dimensions of the textarea to reveal all texts inside instead of to display vertical scrollbar. Run the following code line to enable auto-grow behavior to all [...]]]></description>
			<content:encoded><![CDATA[<div style="position:relative; width: 100%; padding: 0 0 90px 0;"><div style="position: absolute; bottom: 10px; width: 42px;"><script type="text/javascript">
<!--
var dzone_url = 'http://javascriptly.com/2008/09/quick-useful-jquery-plugins/';
var dzone_title = 'Quick &#038; Useful JQuery Plugins';
var dzone_blurb = '';
var dzone_style = '1';
//-->
</script>
<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script> 
</div>
<p style="text-align: justify;">Here are some quick and useful JQuery plugins from Jason Frame&#8217;s &#8220;<a href="http://github.com/jaz303/jquery-grab-bag/tree/master" onclick="javascript:pageTracker._trackPageview('/outbound/article/github.com');" target="_blank">JQuery Grab Bag</a>&#8220;.</p>
<h2>Auto-Grow TextArea</h2>
<p style="text-align: justify;">The technique is borrowed from Facebook that uses an off-screen &lt;div&gt; to calculate the required dimensions of the textarea to reveal all texts inside instead of to display vertical scrollbar. Run the following code line to enable auto-grow behavior to all textareas on page.</p>

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

<p><strong>Online Demo</strong></p>
<p><a href="http://javascriptly.com/examples/jquery-grab-bag/autogrow-textarea.html" ><img class="alignnone size-full wp-image-40" title="auto-grow-textarea" src="http://javascriptly.com/wp-content/uploads/2008/09/auto-grow-textarea.gif" alt="" width="342" height="221" /></a></p>
<h2>Input Hint</h2>
<p style="text-align: justify;">It&#8217;s not always necessary to attach label to every text field in web form, instead you can use hint to tell user what to type in the fields. This plugin will help keeping away from tedious codes to add hints to input boxes.</p>
<p style="text-align: left;">First, add <code>hint</code> attribute to input fields.</p>

<div class="wp_syntax"><div class="code"><pre class="xml xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">hint</span>=<span style="color: #ff0000;">&quot;Your first name&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;firstname&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;input</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">hint</span>=<span style="color: #ff0000;">&quot;Your last name&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;lastname&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p style="text-align: left;">Then, simply get the functionality work on the fields.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'*[@hint]'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">inputHint</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;</pre></div></div>

<p><strong>Online Demo</strong></p>
<p><a href="http://javascriptly.com/examples/jquery-grab-bag/input-hint.html" ><img class="alignnone size-full wp-image-41" title="input-hint-example" src="http://javascriptly.com/wp-content/uploads/2008/09/input-hint-example.gif" alt="" width="424" height="54" /></a></p>
<h2>Text Resizing from Cookie</h2>
<p style="text-align: justify;">This is not a JQuery&#8217;s plugin but still depends on JQuery to allow user to select appropriate text size on reading. Of course, some modern browsers feature zoom functionality but not equally good. So, users still want to resize text on fly.</p>
<p style="text-align: left;">We&#8217;ll need to define some styles with different font sizes for body tag.</p>

<div class="wp_syntax"><div class="code"><pre class="css css" style="font-family:monospace;">body<span style="color: #6666ff;">.small</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span>; <span style="color: #00AA00;">&#125;</span>
body<span style="color: #6666ff;">.medium</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">12px</span>; <span style="color: #00AA00;">&#125;</span>
body<span style="color: #6666ff;">.large</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">14px</span>; <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p style="text-align: left;">And some links for size selection accordantly.</p>

<div class="wp_syntax"><div class="code"><pre class="xml xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">'sizer'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">'#'</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">'small'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>small<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">'#'</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">'medium'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>medium<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">'#'</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">'large'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>large<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p style="text-align: left;">Then call <code>cookieResize()</code> function on load. Done.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript javascript" style="font-family:monospace;">cookieResize<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#sizer a'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'medium'</span><span style="color: #009900;">&#41;</span>;</pre></div></div>

<p><strong>Online Demo</strong></p>
<p><a href="http://javascriptly.com/examples/jquery-grab-bag/cookie-text-size.html" ><img class="alignnone size-full wp-image-42" title="cookie-resize" src="http://javascriptly.com/wp-content/uploads/2008/09/cookie-resize.gif" alt="" width="282" height="211" /></a></p>
<p><a title="Download source codes" href="http://javascriptly.com/examples/jquery-grab-bag.zip" onclick="javascript:pageTracker._trackPageview('/downloads/examples/jquery-grab-bag.zip');"><strong>Download example codes</strong></a></p>

</div><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/javascriptly?a=GfmlFDkgN7c:G_4SG-HFON8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=GfmlFDkgN7c:G_4SG-HFON8:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=GfmlFDkgN7c:G_4SG-HFON8:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=GfmlFDkgN7c:G_4SG-HFON8:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=GfmlFDkgN7c:G_4SG-HFON8:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=GfmlFDkgN7c:G_4SG-HFON8:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=GfmlFDkgN7c:G_4SG-HFON8:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=GfmlFDkgN7c:G_4SG-HFON8:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=GfmlFDkgN7c:G_4SG-HFON8:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=GfmlFDkgN7c:G_4SG-HFON8:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=GfmlFDkgN7c:G_4SG-HFON8:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=l6gmwiTKsz0" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://javascriptly.com/2008/09/quick-useful-jquery-plugins/feed/</wfw:commentRss>
		<feedburner:origLink>http://javascriptly.com/2008/09/quick-useful-jquery-plugins/</feedburner:origLink></item>
		<item>
		<title>Unobtrusive Draggable Tabbed Navigation</title>
		<link>http://feedproxy.google.com/~r/javascriptly/~3/OtRactcbxI0/</link>
		<comments>http://javascriptly.com/2008/09/unobtrusive-draggable-tabbed-navigation/#comments</comments>
		<pubDate>Tue, 16 Sep 2008 03:52:02 +0000</pubDate>
		<dc:creator>Jimmy Vu</dc:creator>
		
		<category><![CDATA[Solution]]></category>

		<category><![CDATA[Chain.js]]></category>

		<category><![CDATA[Interaction.js]]></category>

		<category><![CDATA[tabbed navigation]]></category>

		<guid isPermaLink="false">http://javascriptly.com/?p=35</guid>
		<description><![CDATA[<div style="position:relative; width: 100%; padding: 0 0 90px 0;"><div style="position: absolute; bottom: 10px; width: 42px;"><script type="text/javascript">
<!--
var dzone_url = 'http://javascriptly.com/2008/09/unobtrusive-draggable-tabbed-navigation/';
var dzone_title = 'Unobtrusive Draggable Tabbed Navigation';
var dzone_blurb = '';
var dzone_style = '1';
//-->
</script>
<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script> 
</div>
There are many examples on creating tabbed navigation with (or without) help of JavaScript frameworks like Prototype, MooTools or JQuery. However, I find that it&#8217;s much easier to create draggable tabbed navigation using Chain.js and its great extension: Interaction.js.
Riziq, creator of Chain.js &#38; Interaction.js, already showed an example on how to utilize the libs to [...]]]></description>
			<content:encoded><![CDATA[<div style="position:relative; width: 100%; padding: 0 0 90px 0;"><div style="position: absolute; bottom: 10px; width: 42px;"><script type="text/javascript">
<!--
var dzone_url = 'http://javascriptly.com/2008/09/unobtrusive-draggable-tabbed-navigation/';
var dzone_title = 'Unobtrusive Draggable Tabbed Navigation';
var dzone_blurb = '';
var dzone_style = '1';
//-->
</script>
<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script> 
</div>
<p style="text-align: justify;">There are many examples on creating tabbed navigation with (or without) help of JavaScript frameworks like Prototype, MooTools or JQuery. However, I find that it&#8217;s much easier to create <strong>draggable</strong> tabbed navigation using <a href="http://github.com/raid-ox/chain.js/wikis" onclick="javascript:pageTracker._trackPageview('/outbound/article/github.com');">Chain.js</a> and its great extension: <a href="http://github.com/raid-ox/interaction.js/wikis/" onclick="javascript:pageTracker._trackPageview('/outbound/article/github.com');">Interaction.js</a>.</p>
<p style="text-align: justify;">Riziq, creator of Chain.js &amp; Interaction.js, already showed <a href="http://rizqi.namaku.de/2008/08/tab-interface-using-chainjs/" onclick="javascript:pageTracker._trackPageview('/outbound/article/rizqi.namaku.de');">an example</a> on how to utilize the libs to build tab interface in a few JS code lines. However, for its own purpose, the example is not SEO-friendly &#8212; disabling JavaScript in your browser will result in empty content and search engines will see nothing on your page consequently. Now say, you want to create a tabbed navigation for your blog to show/hide &#8220;Latest Posts&#8221;, &#8220;Latest Comments&#8221; etc. and you want the links can be seen no matter if JavaScript is enabled or not in reader&#8217;s browser &#8212; something looks like this:</p>
<div id="attachment_36" class="wp-caption alignnone" style="width: 441px"><a href="http://javascriptly.com/examples/chain-tab/tab.html" ><img src="http://javascriptly.com/wp-content/uploads/2008/09/tabbed-navigation-final.gif" alt="Tabbed navigation for my blog" title="tabbed-navigation-final" width="431" height="285" class="size-full wp-image-36" border="0" /></a><p class="wp-caption-text">Blog's tabbed navigation</p></div>
<h2>Step 1: HTML &amp; CSS</h2>
<p style="text-align: justify;">Just create a template in HTML and full links to latest posts, comments and most popular articles:</p>

<div class="wp_syntax"><div class="code"><pre class="xml xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;wrapper&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ul</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;tabs&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;li</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;tab&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;#&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;title&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Tab<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/li<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ul<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;content&quot;</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;latest_posts&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h2<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Latest Posts<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h2<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>…<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;content&quot;</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;latest_comments&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h2<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Latest Comments<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h2<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>…<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;content&quot;</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;most_pop&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;h2<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Most Popular<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h2<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>…<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p style="text-align: left;">And here is the style sheet to get tabbed look:</p>

<div class="wp_syntax"><div class="code"><pre class="css css" style="font-family:monospace;"><span style="color: #cc00cc;">#wrapper</span> <span style="color: #00AA00;">*</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> 0;
    <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> 0;
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#wrapper</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#000</span>;
    <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> Arial<span style="color: #00AA00;">,</span> Helvetica<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span>;
    <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0.8em</span>;
    <span style="color: #000000; font-weight: bold;">padding-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span>;
    <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">15px</span>;
    <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">400px</span>;
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#wrapper</span> ul <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span>;
    <span style="color: #000000; font-weight: bold;">list-style</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span>;
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#wrapper</span> li <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span>;
    <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span>;
    <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> 0 <span style="color: #933;">6px</span> 0 0;
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#wrapper</span> li a<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span>;
    <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span>;
    <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">9px</span> <span style="color: #933;">15px</span>;
    <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span>;
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#wrapper</span> div <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span>;
    <span style="color: #000000; font-weight: bold;">clear</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span>;
    <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">200px</span>;
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#wrapper</span> .<span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span> <span style="color: #933;">15px</span>;
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#wrapper</span> <span style="color: #6666ff;">.content</span> p<span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1.6em</span>;
    <span style="color: #000000; font-weight: bold;">padding-top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0.5em</span>;
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#wrapper</span> <span style="color: #6666ff;">.content</span> a<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#666</span>;
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.tab</span> a <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">&quot;off_tab.png&quot;</span><span style="color: #00AA00;">&#41;</span> <span style="color: #000000; font-weight: bold;">top</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #993333;">repeat-x</span>;
    <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#f2f2f2</span>;
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.tab</span><span style="color: #6666ff;">.selected</span> a<span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">&quot;active_tab.png&quot;</span><span style="color: #00AA00;">&#41;</span> <span style="color: #000000; font-weight: bold;">top</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #993333;">repeat-x</span>;
    <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#000</span>;
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p style="text-align: justify;">At this point, the page looks fairly good and search engines (Yahoo, Google&#8230;) will be surely happy with it.</p>
<p><img src="http://javascriptly.com/wp-content/uploads/2008/09/tabbed-navigation-noscript.gif" alt="" title="tabbed-navigation-noscript" width="432" height="527" class="alignnone size-full wp-image-37" /></p>
<h2>Step 2 - Creating Tabs and Link Them to Contents</h2>
<p style="text-align: justify;">It&#8217;s very simple to create tabs with Chain.js. The following scripts will do the job (for those who are not familiar with Chain.js, please read my articles <a href="http://javascriptly.com/2008/08/a-better-javascript-template-engine/" >here</a> and <a href="http://javascriptly.com/2008/09/chainjs-02-updated-examples/" >here</a>).</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="javascript javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#tabs'</span><span style="color: #009900;">&#41;</span>
	.<span style="color: #660066;">items</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span>
		<span style="color: #009900;">&#123;</span>id<span style="color: #339933;">:</span> <span style="color: #3366CC;">'latest_posts'</span><span style="color: #339933;">,</span> title<span style="color: #339933;">:</span><span style="color: #3366CC;">'Latest Posts'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
		<span style="color: #009900;">&#123;</span>id<span style="color: #339933;">:</span> <span style="color: #3366CC;">'latest_comments'</span><span style="color: #339933;">,</span> title<span style="color: #339933;">:</span><span style="color: #3366CC;">'Latest Comments'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
		<span style="color: #009900;">&#123;</span>id<span style="color: #339933;">:</span> <span style="color: #3366CC;">'most_pop'</span><span style="color: #339933;">,</span> title<span style="color: #339933;">:</span><span style="color: #3366CC;">'Most Popular'</span><span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
	.<span style="color: #660066;">selectable</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>required<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span> <span style="color: #009966; font-style: italic;">/* force the first tab selected */</span>
	.<span style="color: #660066;">chain</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;</pre></td></tr></table></div>

<p style="text-align: justify;">Now, we need to link tabs with related contents in div tags specified by <code>id</code> field. On tab clicked, all other contents should be hidden but linked one; this function is to accomplish that.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="javascript javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> showContent<span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.content'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">,</span> el<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		$<span style="color: #009900;">&#40;</span>el<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>; <span style="color: #006600; font-style: italic;">// hide all tabs</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#'</span> <span style="color: #339933;">+</span> id<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>; <span style="color: #006600; font-style: italic;">// show selected tab</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>By customizing default <code>chain()</code> method, we can inject <code>onclick</code> event to each tab.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>8
9
10
11
12
13
</pre></td><td class="code"><pre class="javascript javascript" style="font-family:monospace;">.<span style="color: #660066;">chain</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> self <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>;
	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		showContent<span style="color: #009900;">&#40;</span>self.<span style="color: #000066; font-weight: bold;">item</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">id</span><span style="color: #009900;">&#41;</span>;
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p style="text-align: left;">All codes are as follows:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="javascript javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#tabs'</span><span style="color: #009900;">&#41;</span>
		.<span style="color: #660066;">items</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span>
			<span style="color: #009900;">&#123;</span>id<span style="color: #339933;">:</span> <span style="color: #3366CC;">'latest_posts'</span><span style="color: #339933;">,</span> title<span style="color: #339933;">:</span><span style="color: #3366CC;">'Latest Posts'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
			<span style="color: #009900;">&#123;</span>id<span style="color: #339933;">:</span> <span style="color: #3366CC;">'latest_comments'</span><span style="color: #339933;">,</span> title<span style="color: #339933;">:</span><span style="color: #3366CC;">'Latest Comments'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
			<span style="color: #009900;">&#123;</span>id<span style="color: #339933;">:</span> <span style="color: #3366CC;">'most_pop'</span><span style="color: #339933;">,</span> title<span style="color: #339933;">:</span><span style="color: #3366CC;">'Most Popular'</span><span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
		.<span style="color: #660066;">selectable</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>required<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span> <span style="color: #009966; font-style: italic;">/* force the first tab selected */</span>
		.<span style="color: #660066;">chain</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #003366; font-weight: bold;">var</span> self <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>;
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span>	<span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				showContent<span style="color: #009900;">&#40;</span>self.<span style="color: #000066; font-weight: bold;">item</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">id</span><span style="color: #009900;">&#41;</span>;
			<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
	showContent<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'latest_posts'</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> showContent<span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.content'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">,</span> el<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		$<span style="color: #009900;">&#40;</span>el<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>; <span style="color: #006600; font-style: italic;">// hide all tabs</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#'</span> <span style="color: #339933;">+</span> id<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>; <span style="color: #006600; font-style: italic;">// show selected tab</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h2>Step 3 - Enable Drag-n-Drop</h2>
<p style="text-align: justify;">Of course, in practice, there is almost no need to make tabs draggable for a blog&#8217;s tabbed navigation. But if required, it can be fulfilled by just adding 2 more functions, <code>draggable()</code> and  <code>sortable()</code>, before the <code>chain()</code> method.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="javascript javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#tabs'</span><span style="color: #009900;">&#41;</span>
	.<span style="color: #660066;">items</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span>
		<span style="color: #009900;">&#123;</span>id<span style="color: #339933;">:</span> <span style="color: #3366CC;">'latest_posts'</span><span style="color: #339933;">,</span> title<span style="color: #339933;">:</span><span style="color: #3366CC;">'Latest Posts'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
		<span style="color: #009900;">&#123;</span>id<span style="color: #339933;">:</span> <span style="color: #3366CC;">'latest_comments'</span><span style="color: #339933;">,</span> title<span style="color: #339933;">:</span><span style="color: #3366CC;">'Latest Comments'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
		<span style="color: #009900;">&#123;</span>id<span style="color: #339933;">:</span> <span style="color: #3366CC;">'most_pop'</span><span style="color: #339933;">,</span> title<span style="color: #339933;">:</span><span style="color: #3366CC;">'Most Popular'</span><span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>
	.<span style="color: #660066;">selectable</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>required<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span> <span style="color: #009966; font-style: italic;">/* force the first tab selected */</span>
	.<span style="color: #660066;">draggable</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>axis<span style="color: #339933;">:</span><span style="color: #3366CC;">'x'</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>  <span style="color: #009966; font-style: italic;">/* enable drag-n-drop */</span>
	.<span style="color: #660066;">sortable</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>align<span style="color: #339933;">:</span><span style="color: #3366CC;">'horizontal'</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
	.<span style="color: #660066;">chain</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> self <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>;
		<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span>	<span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			showContent<span style="color: #009900;">&#40;</span>self.<span style="color: #000066; font-weight: bold;">item</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">id</span><span style="color: #009900;">&#41;</span>;
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;</pre></td></tr></table></div>

<p style="text-align: justify;">So now we have a tabbed navigation with advanced functionality implemented in a few code lines which are completely separated from HTML. And like other examples here, you can see demo and download source codes from links below:</p>
<ul type="disc">
<li><strong><a href="http://javascriptly.com/examples/chain-tab/tab.html" >View Online Demo</a></strong></li>
<li><strong><a href="http://javascriptly.com/examples/chain-tab/chain-tab.zip" onclick="javascript:pageTracker._trackPageview('/downloads/examples/chain-tab/chain-tab.zip');">Download example codes</a></strong></li>
</ul>

</div><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/javascriptly?a=OtRactcbxI0:SqkPvv9W5Tc:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=OtRactcbxI0:SqkPvv9W5Tc:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=OtRactcbxI0:SqkPvv9W5Tc:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=OtRactcbxI0:SqkPvv9W5Tc:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=OtRactcbxI0:SqkPvv9W5Tc:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=OtRactcbxI0:SqkPvv9W5Tc:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=OtRactcbxI0:SqkPvv9W5Tc:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=OtRactcbxI0:SqkPvv9W5Tc:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=OtRactcbxI0:SqkPvv9W5Tc:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=OtRactcbxI0:SqkPvv9W5Tc:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=OtRactcbxI0:SqkPvv9W5Tc:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=l6gmwiTKsz0" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://javascriptly.com/2008/09/unobtrusive-draggable-tabbed-navigation/feed/</wfw:commentRss>
		<feedburner:origLink>http://javascriptly.com/2008/09/unobtrusive-draggable-tabbed-navigation/</feedburner:origLink></item>
		<item>
		<title>LightningDOM to Balance DOM vs innerHTML</title>
		<link>http://feedproxy.google.com/~r/javascriptly/~3/DzapuhImKVE/</link>
		<comments>http://javascriptly.com/2008/09/lightningdom-to-balance-dom-vs-innerhtml/#comments</comments>
		<pubDate>Fri, 12 Sep 2008 11:19:04 +0000</pubDate>
		<dc:creator>Jimmy Vu</dc:creator>
		
		<category><![CDATA[Solution]]></category>

		<category><![CDATA[DOM API]]></category>

		<category><![CDATA[innerHTML]]></category>

		<category><![CDATA[LighteningDOM]]></category>

		<guid isPermaLink="false">http://javascriptly.com/?p=34</guid>
		<description><![CDATA[<div style="position:relative; width: 100%; padding: 0 0 90px 0;"><div style="position: absolute; bottom: 10px; width: 42px;"><script type="text/javascript">
<!--
var dzone_url = 'http://javascriptly.com/2008/09/lightningdom-to-balance-dom-vs-innerhtml/';
var dzone_title = 'LightningDOM to Balance DOM vs innerHTML';
var dzone_blurb = '';
var dzone_style = '1';
//-->
</script>
<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script> 
</div>
Using DOM API versus innerHTML to create/change content on webpage has been in discussion for years. The pain (slow DOM manipulation speed) left by Internet Explorer causes a big concern over DOM API for serious use in practice because the browser is still holding big slice of market share today (about 80%).
We can guess that [...]]]></description>
			<content:encoded><![CDATA[<div style="position:relative; width: 100%; padding: 0 0 90px 0;"><div style="position: absolute; bottom: 10px; width: 42px;"><script type="text/javascript">
<!--
var dzone_url = 'http://javascriptly.com/2008/09/lightningdom-to-balance-dom-vs-innerhtml/';
var dzone_title = 'LightningDOM to Balance DOM vs innerHTML';
var dzone_blurb = '';
var dzone_style = '1';
//-->
</script>
<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script> 
</div>
<p style="text-align: justify;">Using DOM API versus innerHTML to create/change content on webpage has been in discussion for years. The pain (slow DOM manipulation speed) left by Internet Explorer causes a big concern over DOM API for serious use in practice because the browser is still holding big slice of market share today (about 80%).</p>
<p style="text-align: justify;">We can guess that the browser war (re)started by Firefox and stirred up by Google Chrome lately will result in better IE versions, yet that bright day won&#8217;t come any time soon.</p>
<p style="text-align: justify;">Recently, I had reviews on <a href="http://beebole.com/pure/" onclick="javascript:pageTracker._trackPageview('/outbound/article/beebole.com');">PURE</a> and <a href="http://github.com/raid-ox/chain.js/wikis" onclick="javascript:pageTracker._trackPageview('/outbound/article/github.com');">Chain.js</a> as client-side template engines. Though both libraries take pure, unobtrusive JavaScript approach for implementation, PURE seems more eager about speed when using innerHTML to create elements while Chain.js depends on DOM API for more flexible and direct manipulation.</p>
<p style="text-align: justify;">I cannot say what approach is better. PURE may have some advantage on page with huge number of DOM elements to be created/changed but I think most of projects will be happy with Chain.js for its power. It grows a question: any chance that we can achieve both flexibility and speed in these libs? Probably, <a href="http://blog.cornerstonenw.com/2008/09/10/donating-lightningdom/" onclick="javascript:pageTracker._trackPageview('/outbound/article/blog.cornerstonenw.com');">LightningDOM donated by Peter Rust</a> will be a right answer.</p>
<p style="text-align: justify;">In the post, Peter places LightningDOM as &#8220;<em>a layer between the raw HTML and your templating/data-mapping code, without the slowness of the DOM.</em>&#8221; So how it works? Just see the example.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="javascript javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> strMarkup <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'destination'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">innerHTML</span>;
<span style="color: #003366; font-weight: bold;">var</span> dom <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> LightningDOM<span style="color: #009900;">&#40;</span>strMarkup<span style="color: #009900;">&#41;</span>;
dom.<span style="color: #660066;">firstChild</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">innerText</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;I Love speed!&quot;</span><span style="color: #009900;">&#41;</span>;
document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'destination'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> dom.<span style="color: #660066;">outerHTML</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;</pre></td></tr></table></div>

<p style="text-align: justify;">Not too difficult to understand, right? You give all HTML markups to LightningDOM, do anything you want with familiar getters/setters like you can do with DOM API then assign the result back to real DOM&#8217;s innerHTML.</p>
<p style="text-align: justify;">Peter tells more about internal implementation to get both speed and lightness in the library.</p>
<blockquote><p>The LightningDOM parses the given HTML using Regexes. I have two different parse algorithms (but both using the same regex). IE is much faster at parsing the whole markup by doing a single regex replace to convert the markup into JSON and then to eval the JSON. FF (and I&#8217;m guessing Chrome &amp; Opera) is much faster at looping through the markup with a global regex.</p>
<p>All the tags are parsed into a two-dimensional array (well, technically an array of arrays), which represents all the information in the tags. Here&#8217;s a pretty look at the internal data structure representing a chunk of HMTL (note that we use a simpler object model inspired by <a href="http://effbot.org/zone/element-index.htm" onclick="javascript:pageTracker._trackPageview('/outbound/article/effbot.org');">ElementTree</a> to representing the inner-text as a &#8220;tail&#8221; of the previous tag, rather than a nested &#8220;Text Node&#8221;).</p></blockquote>
<p><em>Array of Arrays (_aMarkup):</em></p>
<p><a href="http://csnw.files.wordpress.com/2008/09/lightningdom.png" onclick="javascript:pageTracker._trackPageview('/outbound/article/csnw.files.wordpress.com');"><img class="alignnone size-full wp-image-5" title="LightningDOM data architecture" src="http://csnw.files.wordpress.com/2008/09/lightningdom.png?w=500&amp;h=148" alt="" width="500" height="148" /></a></p>
<p style="text-align: justify;">Of course, the decision to utilize LightningDOM for PURE or Chain.js depends on leaders of projects but it does not prevent you from taking advantage of the lib if you see true value from it. Personally, I think it&#8217;s a good solution though I&#8217;ll have more tests/benchmarks to evaluate its stability across browsers.</p>

</div><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/javascriptly?a=DzapuhImKVE:ET7WrWFGkas:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=DzapuhImKVE:ET7WrWFGkas:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=DzapuhImKVE:ET7WrWFGkas:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=DzapuhImKVE:ET7WrWFGkas:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=DzapuhImKVE:ET7WrWFGkas:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=DzapuhImKVE:ET7WrWFGkas:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=DzapuhImKVE:ET7WrWFGkas:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=DzapuhImKVE:ET7WrWFGkas:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=DzapuhImKVE:ET7WrWFGkas:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=DzapuhImKVE:ET7WrWFGkas:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=DzapuhImKVE:ET7WrWFGkas:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=l6gmwiTKsz0" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://javascriptly.com/2008/09/lightningdom-to-balance-dom-vs-innerhtml/feed/</wfw:commentRss>
		<feedburner:origLink>http://javascriptly.com/2008/09/lightningdom-to-balance-dom-vs-innerhtml/</feedburner:origLink></item>
		<item>
		<title>Chain.js v0.2 – Updated Examples</title>
		<link>http://feedproxy.google.com/~r/javascriptly/~3/egb_qCFGidI/</link>
		<comments>http://javascriptly.com/2008/09/chainjs-02-updated-examples/#comments</comments>
		<pubDate>Wed, 10 Sep 2008 04:42:37 +0000</pubDate>
		<dc:creator>Jimmy Vu</dc:creator>
		
		<category><![CDATA[Solution]]></category>

		<category><![CDATA[Chain.js]]></category>

		<guid isPermaLink="false">http://javascriptly.com/?p=32</guid>
		<description><![CDATA[<div style="position:relative; width: 100%; padding: 0 0 90px 0;"><div style="position: absolute; bottom: 10px; width: 42px;"><script type="text/javascript">
<!--
var dzone_url = 'http://javascriptly.com/2008/09/chainjs-02-updated-examples/';
var dzone_title = 'Chain.js v0.2 – Updated Examples';
var dzone_blurb = '';
var dzone_style = '1';
//-->
</script>
<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script> 
</div>
In previous post, I had a chance to introduce Chain.js with 3 examples and found a few issues due to both bugs in version 0.1 and my unawareness of implemented features. Now version 0.2 of Chain.js has just come out, I&#8217;d like to revise the examples to show better implementation we can do with the [...]]]></description>
			<content:encoded><![CDATA[<div style="position:relative; width: 100%; padding: 0 0 90px 0;"><div style="position: absolute; bottom: 10px; width: 42px;"><script type="text/javascript">
<!--
var dzone_url = 'http://javascriptly.com/2008/09/chainjs-02-updated-examples/';
var dzone_title = 'Chain.js v0.2 – Updated Examples';
var dzone_blurb = '';
var dzone_style = '1';
//-->
</script>
<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script> 
</div>
<p style="text-align: justify;">In <a href="http://javascriptly.com/2008/08/a-better-javascript-template-engine/" >previous post</a>, I had a chance to introduce <a href="http://github.com/raid-ox/chain.js/wikis" onclick="javascript:pageTracker._trackPageview('/outbound/article/github.com');" target="_blank">Chain.js</a> with 3 examples and found a few issues due to both bugs in version 0.1 and my unawareness of implemented features. Now version 0.2 of Chain.js has just come out, I&#8217;d like to revise the examples to show better implementation we can do with the library in practice.</p>
<p style="text-align: justify;">Basically, we don&#8217;t need to call <code>chain()</code> function every time we add or replace items instead just execute it once on DOM ready event, and we can utilize <code>anchor</code> property to define where items to be rendered within table tag.</p>
<p><strong><a href="http://javascriptly.com/examples/chain/example1-2.html" >Example 1</a>:</strong> All codes to get it works are here.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="javascript javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> render<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	$.<span style="color: #660066;">getJSON</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'json.php'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'lang='</span> <span style="color: #339933;">+</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#langList'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>books<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#table_book'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">items</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'replace'</span><span style="color: #339933;">,</span> books<span style="color: #009900;">&#41;</span>;
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#table_book'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">chain</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
		anchor<span style="color: #339933;">:</span> <span style="color: #3366CC;">'tbody'</span> <span style="color: #009966; font-style: italic;">/* defines, where items will be rendered*/</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#langList'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">change</span><span style="color: #009900;">&#40;</span>render<span style="color: #009900;">&#41;</span>; 	<span style="color: #006600; font-style: italic;">// handle change event of drop-down list</span>
	setTimeout<span style="color: #009900;">&#40;</span>render<span style="color: #339933;">,</span> <span style="color: #CC0000;">100</span><span style="color: #009900;">&#41;</span>; 		<span style="color: #006600; font-style: italic;">// call render function on load</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;</pre></td></tr></table></div>

<p style="text-align: center;"><a href="http://javascriptly.com/examples/chain/example1-2.html" ><img title="chain-example1" src="http://javascriptly.com/wp-content/uploads/2008/08/chain-example1.gif" border="0" alt="" width="500" height="146" /></a></p>
<p style="text-align: justify;"><strong><a href="http://javascriptly.com/examples/chain/example2-2.html" >Example 2</a>:</strong> Almost the same codes as example 1 plus add, remove and sort functions.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
</pre></td><td class="code"><pre class="javascript javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> render<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	$.<span style="color: #660066;">getJSON</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'json.php'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'lang='</span> <span style="color: #339933;">+</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#langList'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>books<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#table_book'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">items</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'replace'</span><span style="color: #339933;">,</span> books<span style="color: #009900;">&#41;</span>;
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> addData<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> data <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>title<span style="color: #339933;">:</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#input_title'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		publisher<span style="color: #339933;">:</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#input_publisher'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		price<span style="color: #339933;">:</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#input_price'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span>;
&nbsp;
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#table_book'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">items</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'add'</span><span style="color: #339933;">,</span> data<span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> sortBy<span style="color: #009900;">&#40;</span>col<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#table_book'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">items</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'sort'</span><span style="color: #339933;">,</span> col<span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>toggle<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#table_book'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">chain</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
		anchor<span style="color: #339933;">:</span> <span style="color: #3366CC;">'tbody'</span><span style="color: #339933;">,</span> <span style="color: #009966; font-style: italic;">/* defines, where items will be rendered*/</span>
		bind<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #009966; font-style: italic;">/* bind event */</span>
			<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">dblclick</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066; font-weight: bold;">item</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'remove'</span><span style="color: #009900;">&#41;</span>;
			<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#langList'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">change</span><span style="color: #009900;">&#40;</span>render<span style="color: #009900;">&#41;</span>; 	<span style="color: #006600; font-style: italic;">// handle change event of drop-down list</span>
	setTimeout<span style="color: #009900;">&#40;</span>render<span style="color: #339933;">,</span> <span style="color: #CC0000;">100</span><span style="color: #009900;">&#41;</span>; 		<span style="color: #006600; font-style: italic;">// call render function on load</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;</pre></td></tr></table></div>

<p style="text-align: center;"><a href="http://javascriptly.com/examples/chain/example2-2.html" ><img title="chain-example2" src="http://javascriptly.com/wp-content/uploads/2008/08/chain-example2.gif" border="0" alt="" width="500" height="169" /></a></p>
<p style="text-align: justify;"><strong><a href="http://javascriptly.com/examples/chain/example3-2.html" >Example 3</a>:</strong> Custom data binding looks much easier now.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
</pre></td><td class="code"><pre class="javascript javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> render<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	$.<span style="color: #660066;">getJSON</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'json.php'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'lang='</span> <span style="color: #339933;">+</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#langList'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>books<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#table_book'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">items</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'replace'</span><span style="color: #339933;">,</span> books<span style="color: #009900;">&#41;</span>;
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #009966; font-style: italic;">/* Custom data binding */</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#table_book'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">chain</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
		anchor <span style="color: #339933;">:</span> <span style="color: #3366CC;">'tbody'</span><span style="color: #339933;">,</span> <span style="color: #009966; font-style: italic;">/* defines, where items will be rendered*/</span>
		<span style="color: #3366CC;">'.price'</span> <span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
			style<span style="color: #339933;">:</span> <span style="color: #3366CC;">'text-align: right'</span><span style="color: #339933;">,</span>
			content<span style="color: #339933;">:</span> <span style="color: #3366CC;">'${price.toFixed(2)}'</span>
		<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
		<span style="color: #3366CC;">'.order .order-link'</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
			style<span style="color: #339933;">:</span> <span style="color: #3366CC;">'color: red;'</span><span style="color: #339933;">,</span>
			href<span style="color: #339933;">:</span> <span style="color: #3366CC;">'{orderLink}'</span><span style="color: #339933;">,</span>
			target<span style="color: #339933;">:</span> <span style="color: #3366CC;">'_blank'</span><span style="color: #339933;">,</span>
			content<span style="color: #339933;">:</span> <span style="color: #3366CC;">'Order Now!'</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#langList'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">change</span><span style="color: #009900;">&#40;</span>render<span style="color: #009900;">&#41;</span>; 	<span style="color: #006600; font-style: italic;">// handle change event of drop-down list</span>
	setTimeout<span style="color: #009900;">&#40;</span>render<span style="color: #339933;">,</span> <span style="color: #CC0000;">100</span><span style="color: #009900;">&#41;</span>; 		<span style="color: #006600; font-style: italic;">// call render function on load</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;</pre></td></tr></table></div>

<p style="text-align: center;"><a href="http://javascriptly.com/examples/chain/example3-2.html" ><img title="chain-example3" src="http://javascriptly.com/wp-content/uploads/2008/08/chain-example3.gif" border="0" alt="" width="500" height="155" /></a></p>
<p style="text-align: justify;">Thanks Rizqi Ahmad for kind support to complete these examples.</p>
<p style="text-align: justify;"><strong></strong><strong><a  href="http://javascriptly.com/examples/chain/chain-2.zip" onclick="javascript:pageTracker._trackPageview('/downloads/examples/chain/chain-2.zip');">Download updated example codes</a></strong></p>

</div><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/javascriptly?a=egb_qCFGidI:-vQtDEfE1Dk:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=egb_qCFGidI:-vQtDEfE1Dk:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=egb_qCFGidI:-vQtDEfE1Dk:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=egb_qCFGidI:-vQtDEfE1Dk:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=egb_qCFGidI:-vQtDEfE1Dk:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=egb_qCFGidI:-vQtDEfE1Dk:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=egb_qCFGidI:-vQtDEfE1Dk:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=egb_qCFGidI:-vQtDEfE1Dk:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=egb_qCFGidI:-vQtDEfE1Dk:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=egb_qCFGidI:-vQtDEfE1Dk:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=egb_qCFGidI:-vQtDEfE1Dk:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=l6gmwiTKsz0" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://javascriptly.com/2008/09/chainjs-02-updated-examples/feed/</wfw:commentRss>
		<feedburner:origLink>http://javascriptly.com/2008/09/chainjs-02-updated-examples/</feedburner:origLink></item>
		<item>
		<title>Zend Framework 1.6 Comes with Dojo and FirePHP Integrated</title>
		<link>http://feedproxy.google.com/~r/javascriptly/~3/Aw7muy0ata4/</link>
		<comments>http://javascriptly.com/2008/09/zend-16-comes-dojo-firephp-integrated/#comments</comments>
		<pubDate>Tue, 09 Sep 2008 04:42:39 +0000</pubDate>
		<dc:creator>Jimmy Vu</dc:creator>
		
		<category><![CDATA[Development News]]></category>

		<category><![CDATA[Dojo]]></category>

		<category><![CDATA[Firebug]]></category>

		<category><![CDATA[FirePHP]]></category>

		<category><![CDATA[Zend]]></category>

		<guid isPermaLink="false">http://javascriptly.com/?p=30</guid>
		<description><![CDATA[

Probably the biggest change in Zend Framework (ZF) 1.6 is about Ajax support with integration of famous Dojo JavaScript toolkit. ZF 1.6 comes with several new helpers, elements and components that help to display/interact with Dojo widgets as announced on Zend&#8217;s official site.


A dojo() placeholder view helper to facilitate Dojo integration in    [...]]]></description>
			<content:encoded><![CDATA[<p><!--dzoneZ=none--></p>
<p style="text-align: justify;"><a href="http://framework.zend.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/framework.zend.com');"><img class="alignnone size-full wp-image-31" title="Zend Framework 1.6 with Dojo Integration" src="http://javascriptly.com/wp-content/uploads/2008/09/zend_16_dojo.png" alt="" width="500" height="135" border="0" /></a></p>
<p style="text-align: justify;">Probably the biggest change in Zend Framework (ZF) 1.6 is about Ajax support with integration of famous <a href="http://www.dojotoolkit.org/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.dojotoolkit.org');">Dojo JavaScript toolkit</a>. ZF 1.6 comes with several new helpers, elements and components that help to display/interact with Dojo widgets as <a href="http://framework.zend.com/announcements/2008-09-03-dojo" onclick="javascript:pageTracker._trackPageview('/outbound/article/framework.zend.com');">announced on Zend&#8217;s official site</a>.</p>
<blockquote>
<ul type="disc">
<li style="text-align: justify;">A dojo() placeholder view helper to facilitate Dojo integration in      your views, including setting up the required script and style tags, dojo.require      statements, and more. In essence, this supports and enhances Dojo&#8217;s      modularity at the application level.</li>
<li style="text-align: justify;">Zend_View helpers and Zend_Form elements and decorators that      utilize Dijit, Dojo&#8217;s layout and widget platform. This simplifies creation      of Zend_Form elements that can be rendered as Dijits. For instance, highly      interactive widgets such as calendar choosers, time selectors, and      combo-boxes are provided.</li>
<li style="text-align: justify;">Zend_Dojo_Data, a component for creating dojo.data-compatible      response payloads. dojo.data defines a standard storage interface;      services providing data in this format can then be consumed by a variety      of Dojo facilities to provide highly flexible and dynamic content for your      user interfaces.</li>
<li style="text-align: justify;">A JSON-RPC server component: Zend_Json_Server. JSON-RPC is a      lightweight remote procedure call protocol, utilizing JSON for its      serialization format; it is useful for sites that require a high volume of      interaction between the user interface and server-side data stores, as it      allows exposing your server-side APIs in a format directly accessible via      your client. Dojo has native JSON-RPC capabilities, and Zend Framework      provides a JSON-RPC implementation that is both compatible with Dojo and      the published specifications.</li>
</ul>
</blockquote>
<p align="center"><!--[if gte vml 1]> <![endif]--></p>
<p style="text-align: justify;">In order to help developer track JavaScript bugs, ZF 1.6 also provides native support for <a href="http://www.firephp.org/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.firephp.org');">FirePHP</a>, a Firebug extension for PHP-Ajax development. Using ZF 1.6 now you can log to Firebug Console via FirePHP instantly, no need to download the <a href="http://www.firephp.org/Wiki/Libraries/FirePHPCore" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.firephp.org');" target="_blank">FirePHPCore</a> library.</p>
<p style="text-align: justify;">Two primary components are available &#8212; Zend_Log_Writer_Firebug and Zend_Db_Profiler_Firebug - providing functionality to log (any info you want) and profile database queries to Firebug console. Read more how to utilize FirePHP in ZF 1.6 <a href="http://www.christophdorn.com/Blog/2008/09/02/firephp-and-zend-framework-16/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.christophdorn.com');">here</a>.</p>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/javascriptly?a=Aw7muy0ata4:cvP164C-ako:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=Aw7muy0ata4:cvP164C-ako:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=Aw7muy0ata4:cvP164C-ako:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=Aw7muy0ata4:cvP164C-ako:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=Aw7muy0ata4:cvP164C-ako:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=Aw7muy0ata4:cvP164C-ako:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=Aw7muy0ata4:cvP164C-ako:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=Aw7muy0ata4:cvP164C-ako:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=Aw7muy0ata4:cvP164C-ako:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=Aw7muy0ata4:cvP164C-ako:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=Aw7muy0ata4:cvP164C-ako:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=l6gmwiTKsz0" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://javascriptly.com/2008/09/zend-16-comes-dojo-firephp-integrated/feed/</wfw:commentRss>
		<feedburner:origLink>http://javascriptly.com/2008/09/zend-16-comes-dojo-firephp-integrated/</feedburner:origLink></item>
		<item>
		<title>JavaScript to Detect Google Chrome</title>
		<link>http://feedproxy.google.com/~r/javascriptly/~3/eqvPU72Gezo/</link>
		<comments>http://javascriptly.com/2008/09/javascript-to-detect-google-chrome/#comments</comments>
		<pubDate>Fri, 05 Sep 2008 07:04:22 +0000</pubDate>
		<dc:creator>Jimmy Vu</dc:creator>
		
		<category><![CDATA[JQuery]]></category>

		<category><![CDATA[Solution]]></category>

		<category><![CDATA[Google Chrome]]></category>

		<guid isPermaLink="false">http://javascriptly.com/?p=26</guid>
		<description><![CDATA[<div style="position:relative; width: 100%; padding: 0 0 90px 0;"><div style="position: absolute; bottom: 10px; width: 42px;"><script type="text/javascript">
<!--
var dzone_url = 'http://javascriptly.com/2008/09/javascript-to-detect-google-chrome/';
var dzone_title = 'JavaScript to Detect Google Chrome';
var dzone_blurb = '';
var dzone_style = '1';
//-->
</script>
<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script> 
</div>
The negative side of having a new (and promisingly become popular) browser, no matter how good it can be, is you&#8217;ll have to test your web apps with it among many others.
Probably, the first step is to detect the browser from JavaScript code by parsing browser&#8217;s user agent, and here is what of Google Chrome.

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US)
AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13

I [...]]]></description>
			<content:encoded><![CDATA[<div style="position:relative; width: 100%; padding: 0 0 90px 0;"><div style="position: absolute; bottom: 10px; width: 42px;"><script type="text/javascript">
<!--
var dzone_url = 'http://javascriptly.com/2008/09/javascript-to-detect-google-chrome/';
var dzone_title = 'JavaScript to Detect Google Chrome';
var dzone_blurb = '';
var dzone_style = '1';
//-->
</script>
<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script> 
</div>
<p style="text-align: justify;">The negative side of having a new (and promisingly become popular) browser, no matter how good it can be, is you&#8217;ll have to test your web apps with it among many others.</p>
<p style="text-align: justify;">Probably, the first step is to detect the browser from JavaScript code by parsing browser&#8217;s user agent, and here is what of Google Chrome.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US)
AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13</pre></div></div>

<p style="text-align: justify;">I guess old JavaScript codes can mistakenly tell it Safari like when running the code snippet below using JQuery&#8217;s browser utility.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="javascript javascript" style="font-family:monospace;">$.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">browser</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">,</span> val<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	 $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;div&gt;&quot;</span> <span style="color: #339933;">+</span> i <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot; : &lt;span&gt;&quot;</span> <span style="color: #339933;">+</span> val <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;&lt;/span&gt;&lt;/div&gt;&quot;</span><span style="color: #009900;">&#41;</span>
		.<span style="color: #660066;">appendTo</span><span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">body</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>;</pre></td></tr></table></div>

<p><img class="size-full wp-image-27" title="jquery-browser-detection" src="http://javascriptly.com/wp-content/uploads/2008/09/jquery-browser-detection.gif" alt="" width="279" height="206" /></p>
<p style="text-align: justify;">It may be no problem until you find something wrong when your apps running on Chrome only. So, here is the code line to detect Chrome generally:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="javascript javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> is_chrome <span style="color: #339933;">=</span> <span style="color: #009966; font-style: italic;">/chrome/</span>.<span style="color: #660066;">test</span><span style="color: #009900;">&#40;</span> navigator.<span style="color: #660066;">userAgent</span>.<span style="color: #660066;">toLowerCase</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>;</pre></td></tr></table></div>

<p style="text-align: justify;">We&#8217;ll have to change the JQuery browser utility to support Chrome detection as follows:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="javascript javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> userAgent <span style="color: #339933;">=</span> navigator.<span style="color: #660066;">userAgent</span>.<span style="color: #660066;">toLowerCase</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
<span style="color: #006600; font-style: italic;">// Figure out what browser is being used</span>
jQuery.<span style="color: #660066;">browser</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
	version<span style="color: #339933;">:</span> <span style="color: #009900;">&#40;</span>userAgent.<span style="color: #660066;">match</span><span style="color: #009900;">&#40;</span> <span style="color: #009966; font-style: italic;">/.+(?:rv|it|ra|ie|me)[\/: ]([\d.]+)/</span> <span style="color: #009900;">&#41;</span> || <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
	chrome<span style="color: #339933;">:</span> <span style="color: #009966; font-style: italic;">/chrome/</span>.<span style="color: #660066;">test</span><span style="color: #009900;">&#40;</span> userAgent <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	safari<span style="color: #339933;">:</span> <span style="color: #009966; font-style: italic;">/webkit/</span>.<span style="color: #660066;">test</span><span style="color: #009900;">&#40;</span> userAgent <span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!/</span>chrome<span style="color: #339933;">/</span>.<span style="color: #660066;">test</span><span style="color: #009900;">&#40;</span> userAgent <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	opera<span style="color: #339933;">:</span> <span style="color: #009966; font-style: italic;">/opera/</span>.<span style="color: #660066;">test</span><span style="color: #009900;">&#40;</span> userAgent <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	msie<span style="color: #339933;">:</span> <span style="color: #009966; font-style: italic;">/msie/</span>.<span style="color: #660066;">test</span><span style="color: #009900;">&#40;</span> userAgent <span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!/</span>opera<span style="color: #339933;">/</span>.<span style="color: #660066;">test</span><span style="color: #009900;">&#40;</span> userAgent <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	mozilla<span style="color: #339933;">:</span> <span style="color: #009966; font-style: italic;">/mozilla/</span>.<span style="color: #660066;">test</span><span style="color: #009900;">&#40;</span> userAgent <span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!/</span><span style="color: #009900;">&#40;</span>compatible|webkit<span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span>.<span style="color: #660066;">test</span><span style="color: #009900;">&#40;</span> userAgent <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span>;</pre></td></tr></table></div>

<p style="text-align: justify;">Now, correct result shows on test screen:</p>
<p><img class="alignnone size-full wp-image-28" title="jquery-browser-detection2" src="http://javascriptly.com/wp-content/uploads/2008/09/jquery-browser-detection2.gif" alt="" width="280" height="234" /></p>
<p style="text-align: justify;">Just one notice: Current version of JQuery (1.2.6) is treating Chrome as if it was Safari and basically no serious problem has been found yet. Modifying browser detection can cause the lib render pages/elements incorrectly for it has no knowledge of Chrome&#8217;s rendering engine. To keep compatibility, you can change line 7 back to:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>7
</pre></td><td class="code"><pre class="javascript javascript" style="font-family:monospace;">	safari<span style="color: #339933;">:</span> <span style="color: #009966; font-style: italic;">/webkit/</span>.<span style="color: #660066;">test</span><span style="color: #009900;">&#40;</span> userAgent <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span></pre></td></tr></table></div>

<p>But in this case the browser will be detected as both Chrome and Safari &#8212; not nice solution, I accept.</p>
<p style="text-align: justify;">Anyway, it&#8217;s very likely that JQuery and other JavaScript frameworks will include Chrome to browser list for detection in next versions.</p>

</div><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/javascriptly?a=eqvPU72Gezo:jt_YAIvE_3I:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=eqvPU72Gezo:jt_YAIvE_3I:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=eqvPU72Gezo:jt_YAIvE_3I:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=eqvPU72Gezo:jt_YAIvE_3I:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=eqvPU72Gezo:jt_YAIvE_3I:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=eqvPU72Gezo:jt_YAIvE_3I:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=eqvPU72Gezo:jt_YAIvE_3I:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=eqvPU72Gezo:jt_YAIvE_3I:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=eqvPU72Gezo:jt_YAIvE_3I:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=eqvPU72Gezo:jt_YAIvE_3I:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=eqvPU72Gezo:jt_YAIvE_3I:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=l6gmwiTKsz0" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://javascriptly.com/2008/09/javascript-to-detect-google-chrome/feed/</wfw:commentRss>
		<feedburner:origLink>http://javascriptly.com/2008/09/javascript-to-detect-google-chrome/</feedburner:origLink></item>
		<item>
		<title>10 Alternative JavaScript Frameworks</title>
		<link>http://feedproxy.google.com/~r/javascriptly/~3/mm65Ay4ILg8/</link>
		<comments>http://javascriptly.com/2008/09/10-alternative-javascript-frameworks/#comments</comments>
		<pubDate>Fri, 05 Sep 2008 04:28:38 +0000</pubDate>
		<dc:creator>Jimmy Vu</dc:creator>
		
		<category><![CDATA[Solution]]></category>

		<category><![CDATA[framework]]></category>

		<guid isPermaLink="false">http://javascriptly.com/?p=24</guid>
		<description><![CDATA[<div style="position:relative; width: 100%; padding: 0 0 90px 0;"><div style="position: absolute; bottom: 10px; width: 42px;"><script type="text/javascript">
<!--
var dzone_url = 'http://javascriptly.com/2008/09/10-alternative-javascript-frameworks/';
var dzone_title = '10 Alternative JavaScript Frameworks';
var dzone_blurb = '';
var dzone_style = '1';
//-->
</script>
<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script> 
</div>
In modern web development, some JavaScript frameworks have made their names like Prototype, Mootools, YUI, JQuery. But if you find them not wholly suitable to your next project there are some other good frameworks out there.
Jacob Gube has given out a nice introduction of &#8220;10 alternative and capable JavaScript frameworks/libraries to explore&#8221; going over the [...]]]></description>
			<content:encoded><![CDATA[<div style="position:relative; width: 100%; padding: 0 0 90px 0;"><div style="position: absolute; bottom: 10px; width: 42px;"><script type="text/javascript">
<!--
var dzone_url = 'http://javascriptly.com/2008/09/10-alternative-javascript-frameworks/';
var dzone_title = '10 Alternative JavaScript Frameworks';
var dzone_blurb = '';
var dzone_style = '1';
//-->
</script>
<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script> 
</div>
<p style="text-align: justify;">In modern web development, some JavaScript frameworks have made their names like Prototype, Mootools, YUI, JQuery. But if you find them not wholly suitable to your next project there are some other good frameworks out there.</p>
<p style="text-align: justify;">Jacob Gube has given out a nice introduction of &#8220;<strong><a href="http://sixrevisions.com/javascript/promising_javascript_frameworks/" onclick="javascript:pageTracker._trackPageview('/outbound/article/sixrevisions.com');" target="_blank">10 alternative and capable JavaScript frameworks/libraries to explore</a></strong>&#8221; going over the good of them. Here they are:</p>
<ol type="1">
<li><a href="http://www.sproutcore.com/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.sproutcore.com');">SproutCore</a></li>
<li><a title="Adobe Labs - Spry framework for Ajax" href="http://labs.adobe.com/technologies/spry/" onclick="javascript:pageTracker._trackPageview('/outbound/article/labs.adobe.com');">Spry</a></li>
<li><a href="http://javascriptmvc.com/" onclick="javascript:pageTracker._trackPageview('/outbound/article/javascriptmvc.com');">JavaScriptMVC</a></li>
<li><a href="http://qooxdoo.org/" onclick="javascript:pageTracker._trackPageview('/outbound/article/qooxdoo.org');">qooxdoo</a></li>
<li><a href="http://www.midorijs.com/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.midorijs.com');">midori</a></li>
<li><a title="Archetype JavaScript Framework - Archetype JavaScript framework presentation" href="http://archetypejs.org/" onclick="javascript:pageTracker._trackPageview('/outbound/article/archetypejs.org');">Archetype      JavaScript Framework</a></li>
<li><a title="June JavaScript Framework" href="http://june-js.com/" onclick="javascript:pageTracker._trackPageview('/outbound/article/june-js.com');">June      Framework</a></li>
<li><a href="http://www.uize.com/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.uize.com');">UIZE</a></li>
<li><a href="http://simplejs.bleebot.com/" onclick="javascript:pageTracker._trackPageview('/outbound/article/simplejs.bleebot.com');">SimpleJS</a></li>
<li><a href="http://js.fleegix.org/" onclick="javascript:pageTracker._trackPageview('/outbound/article/js.fleegix.org');">Fleegix.js</a></li>
</ol>
<p style="text-align: justify;">Some of them provide comprehensive solutions that allow you to build a (complicated) desktop-like application with ready-made components (<strong>SproutCore</strong>, <strong>Spry</strong>, <strong>qooxdoo</strong>,<strong> UIZE</strong>), other focus on DOM selector and effects with minimal weight and, specifically, framework <strong>JavaScriptMVC</strong> presents the <a href="http://en.wikipedia.org/wiki/Model-view-controller" onclick="javascript:pageTracker._trackPageview('/outbound/article/en.wikipedia.org');">Model-View-Controller</a> (MVC) architectural pattern to JavaScript.</p>
<div id="attachment_25" class="wp-caption aligncenter" style="width: 510px"><img class="size-full wp-image-25" title="js-framework-find-your-way" src="http://javascriptly.com/wp-content/uploads/2008/09/js-framework-find-your-way.png" alt="Find your own JavaScript framework (archetypejs.org)" width="500" height="387" /><p class="wp-caption-text">Find your own JavaScript framework (archetypejs.org)</p></div>
<p style="text-align: justify;">Of course, no framework is perfect and it costs some time to get acquaintance with new one. However, you may find one is better than others for specific requirements so it&#8217;s good to have alternatives.</p>
<p style="text-align: justify;">I&#8217;ll have more reviews on each framework with hand-on experiences and examples from time to time (hopefully).</p>

</div><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/javascriptly?a=mm65Ay4ILg8:moa79MFiyZ4:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=mm65Ay4ILg8:moa79MFiyZ4:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=mm65Ay4ILg8:moa79MFiyZ4:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=mm65Ay4ILg8:moa79MFiyZ4:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=mm65Ay4ILg8:moa79MFiyZ4:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=mm65Ay4ILg8:moa79MFiyZ4:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=mm65Ay4ILg8:moa79MFiyZ4:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=mm65Ay4ILg8:moa79MFiyZ4:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=mm65Ay4ILg8:moa79MFiyZ4:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=mm65Ay4ILg8:moa79MFiyZ4:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=mm65Ay4ILg8:moa79MFiyZ4:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=l6gmwiTKsz0" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://javascriptly.com/2008/09/10-alternative-javascript-frameworks/feed/</wfw:commentRss>
		<feedburner:origLink>http://javascriptly.com/2008/09/10-alternative-javascript-frameworks/</feedburner:origLink></item>
		<item>
		<title>JavaScript in Google Chrome Not So Fast</title>
		<link>http://feedproxy.google.com/~r/javascriptly/~3/27W9LMuT8t0/</link>
		<comments>http://javascriptly.com/2008/09/javascript-in-google-chrome/#comments</comments>
		<pubDate>Wed, 03 Sep 2008 08:00:00 +0000</pubDate>
		<dc:creator>Jimmy Vu</dc:creator>
		
		<category><![CDATA[Development News]]></category>

		<category><![CDATA[Firefox 3.1]]></category>

		<category><![CDATA[Google Chrome]]></category>

		<category><![CDATA[performance test]]></category>

		<guid isPermaLink="false">http://javascriptly.com/?p=19</guid>
		<description><![CDATA[<div style="position:relative; width: 100%; padding: 0 0 90px 0;"><div style="position: absolute; bottom: 10px; width: 42px;"><script type="text/javascript">
<!--
var dzone_url = 'http://javascriptly.com/2008/09/javascript-in-google-chrome/';
var dzone_title = 'JavaScript in Google Chrome Not So Fast';
var dzone_blurb = '';
var dzone_style = '1';
//-->
</script>
<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script> 
</div>
How well JavaScript works is what I highly concern about Google Chrome &#8212; the browser on headlines of all tech news today.
The JavaScript engine embedded in Chrome, named V8, is developed by Google which implements ECMAScript 3 and can run standalone as stated on project website.


 V8 is Google&#8217;s open source JavaScript engine.
 V8 is [...]]]></description>
			<content:encoded><![CDATA[<div style="position:relative; width: 100%; padding: 0 0 90px 0;"><div style="position: absolute; bottom: 10px; width: 42px;"><script type="text/javascript">
<!--
var dzone_url = 'http://javascriptly.com/2008/09/javascript-in-google-chrome/';
var dzone_title = 'JavaScript in Google Chrome Not So Fast';
var dzone_blurb = '';
var dzone_style = '1';
//-->
</script>
<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script> 
</div>
<p style="text-align: justify;">How well JavaScript works is what I highly concern about Google Chrome &#8212; the browser on headlines of all tech news today.</p>
<p style="text-align: justify;">The JavaScript engine embedded in Chrome, named V8, is developed by Google which implements ECMAScript 3 and can run standalone as stated on <a href="http://code.google.com/p/v8/" onclick="javascript:pageTracker._trackPageview('/outbound/article/code.google.com');" target="_blank">project website</a>.</p>
<blockquote>
<ul class="unIndentedList">
<li> V8 is Google&#8217;s open source JavaScript engine.</li>
<li> V8 is written in C++ and is used in Google Chrome, the open source browser from Google.</li>
<li> V8 implements ECMAScript as specified in ECMA-262, 3rd edition, and runs on Windows XP and Vista, Mac OS X 10.5 (Leopard), and Linux systems that use IA-32 or ARM processors.</li>
<li> V8 can run standalone, or can be embedded into any C++ application.</li>
</ul>
</blockquote>
<p style="text-align: justify;">Of course, we&#8217;ll have to mention the tests given out by Google itself that show JavaScript speed in Chrome  many times faster than in all other major browsers: IE, Firefox and Safari.</p>
<div id="attachment_20" class="wp-caption aligncenter" style="width: 510px"><img class="size-full wp-image-20" title="chrome_subbenchmark_png" src="http://javascriptly.com/wp-content/uploads/2008/08/chrome_subbenchmark_png.png" alt="Google Chrome Benchmarks" width="500" height="386" /><p class="wp-caption-text">Google Chrome Benchmarks</p></div>
<p style="text-align: justify;">Anyway, they are tests guided by Google and I suspect that they seem be optimized toward the best of V8. So, the better way to see how good V8 perform in action is to run tests with popular JavaScript libraries like JQuery, Prototype, Dojo, Mootools, YUI which are being used in most of web applications in real world.</p>
<p>In a typical web application, JavaScript is mainly used for DOM selection/ manipulation rather than for heavy calculation. That’s why all libraries try to optimize DOM selection speed for (said) faster application.</p>
<p style="text-align: justify;">To have practical view, I decided to run Mootools’ SlickSpeed tests on Google Chrome 0.2 in comparison with Firefox 3.0.1, Safari 3.1 (Windows), IE6, Opera 9.5 and especially on the nightly build of Firefox 3.1b1pre with Tracemonkey &#8212; Mozilla&#8217;s recent effort to integrate Tamarin tracing into the existing SpiderMonkey JavaScript engine &#8212; enabled and disabled. Here are the results:</p>
<div id="attachment_21" class="wp-caption aligncenter" style="width: 510px"><img class="size-full wp-image-21" title="slickspeed-benchmarks-chart" src="http://javascriptly.com/wp-content/uploads/2008/08/slickspeed-benchmarks-chart.png" alt="Chart: Mootools SlickSpeed Test Result" width="500" height="331" /><p class="wp-caption-text">Chart: Mootools SlickSpeed Test Results</p></div>
<div id="attachment_22" class="wp-caption aligncenter" style="width: 510px"><img class="size-full wp-image-22" title="slickspeed-benchmarks" src="http://javascriptly.com/wp-content/uploads/2008/08/slickspeed-benchmarks.png" alt="SlickSpeed Benchmarks in details" width="500" height="304" /><p class="wp-caption-text">SlickSpeed Benchmarks in details</p></div>
<p><em>(All tests were run 10 times for each browser on Windows XP SP3, AMD x64 4400+ with 2GB RAM machine)</em></p>
<p style="text-align: justify;">It turns out that Google Chrome reached 6th place ahead the poor IE6 only, <strong>49% slower than the fastest browser: Opera 9.5</strong>. Firefox 3.1 has not proved faster than the previous version in the tests, even enabling JIT engine made the results worse. (I acknowledge that it’s just pre-release beta version and Tracemonkey is not designed for optimizing DOM manipulation).</p>
<p style="text-align: justify;">Some other conclusions we can get out from the above results (ruling out IE6 which falls far behind others in all tests) are:</p>
<ul>
<li>MooTools, Prototype and Dojo get the worst performance in Chrome and surprisingly JQuery enjoys the second best result.</li>
<li>JQuery’s selector performs best while YUI 2.5 provides the worst results across browsers (295% slower than JQuery) and Prototype is just slightly better than the worst (269% slower).</li>
<li>JQuery’s performance is quite browser-neutral while Dojo’s defers a lot from browser to browser, yet both are well optimized for speed.</li>
<li>Dojo’s selector does not play well in Firefox 3.1 currently causing several errors in tests.</li>
</ul>
<p style="text-align: justify;">Though DOM selector test does not tell everything about how fast a JavaScript engine is in real-world browsers, it brings out another aspect you may want to consider over what Google is advertising about V8 and Chrome.</p>
<p style="text-align: justify;">I recognize that Google Chrome is really good at rendering web pages (which contributes a lot to overall performance of an application) but I’ll stick with Firefox in most of cases for I cannot find a dozen of plugins/extensions I love in Chrome yet.</p>

</div><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/javascriptly?a=27W9LMuT8t0:IKoFXpHEagc:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=27W9LMuT8t0:IKoFXpHEagc:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=27W9LMuT8t0:IKoFXpHEagc:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=27W9LMuT8t0:IKoFXpHEagc:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=27W9LMuT8t0:IKoFXpHEagc:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=27W9LMuT8t0:IKoFXpHEagc:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=27W9LMuT8t0:IKoFXpHEagc:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=27W9LMuT8t0:IKoFXpHEagc:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/javascriptly?i=27W9LMuT8t0:IKoFXpHEagc:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=27W9LMuT8t0:IKoFXpHEagc:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/javascriptly?a=27W9LMuT8t0:IKoFXpHEagc:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/javascriptly?d=l6gmwiTKsz0" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://javascriptly.com/2008/09/javascript-in-google-chrome/feed/</wfw:commentRss>
		<feedburner:origLink>http://javascriptly.com/2008/09/javascript-in-google-chrome/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 6.499 seconds. --><!-- Cached page generated by WP-Super-Cache on 2009-11-07 03:04:27 -->
