<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Lazycoder &#187; jQuery</title>
	<atom:link href="http://www.lazycoder.com/weblog/category/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lazycoder.com/weblog</link>
	<description></description>
	<lastBuildDate>Wed, 30 Jun 2010 20:09:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Quick jQuery hack to fix position:fixed toolbars in iPhone/iPad/iPod Touch</title>
		<link>http://www.lazycoder.com/weblog/2010/05/27/quick-jquery-hack-to-fix-positionfixed-toolbars-in-iphoneipadipod-touch/</link>
		<comments>http://www.lazycoder.com/weblog/2010/05/27/quick-jquery-hack-to-fix-positionfixed-toolbars-in-iphoneipadipod-touch/#comments</comments>
		<pubDate>Thu, 27 May 2010 18:29:43 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[iPod]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.lazycoder.com/weblog/?p=1357</guid>
		<description><![CDATA[This is just a quick fix if your postion:fixed elements end up in weird places when your site is viewed on the iPhone, iPad, or iPod Touch. Say you have a div with an id of "#footer" that you want to stay at the bottom of the page. If you set it's position to "fixed" [...]]]></description>
			<content:encoded><![CDATA[<p>This is just a quick fix if your postion:fixed elements end up in weird places when your site is viewed on the iPhone, iPad, or iPod Touch.</p>
<p> Say you have a div with an id of "#footer" that you want to stay at the bottom of the page. If you set it's position to "fixed" and set the bottom to "0px". When viewed on an iPad, iPhone or iPod Touch, the footer <a href="http://blog.mspace.fm/2009/10/01/iphone-mobile-safari-css-position-fixed/">may end up in the middle of your content</a> if you have a long page. </p>
<div class="igBar"><span id="lcode-2"><a href="#" onclick="javascript:showCodeTxt('code-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-2">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//stick the footer at the bottom of the page if we're on an iPad/iPhone due to viewport/page bugs in mobile webkit </span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">if<span style="color:#006600; font-weight:bold;">&#40;</span>navigator.<span style="">platform</span> == <span style="color:#CC0000;">'iPad'</span> || navigator.<span style="">platform</span> == <span style="color:#CC0000;">'iPhone'</span> || navigator.<span style="">platform</span> == <span style="color:#CC0000;">'iPod'</span><span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span> </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;$<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"#footer"</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">css</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"position"</span>, <span style="color:#CC0000;">"static"</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>



Share and Enjoy:


	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2010%2F05%2F27%2Fquick-jquery-hack-to-fix-positionfixed-toolbars-in-iphoneipadipod-touch%2F&amp;title=Quick%20jQuery%20hack%20to%20fix%20position%3Afixed%20toolbars%20in%20iPhone%2FiPad%2FiPod%20Touch&amp;notes=This%20is%20just%20a%20quick%20fix%20if%20your%20postion%3Afixed%20elements%20end%20up%20in%20weird%20places%20when%20your%20site%20is%20viewed%20on%20the%20iPhone%2C%20iPad%2C%20or%20iPod%20Touch.%0D%0A%0D%0A%20Say%20you%20have%20a%20div%20with%20an%20id%20of%20%22%23footer%22%20that%20you%20want%20to%20stay%20at%20the%20bottom%20of%20the%20page.%20If%20you%20set%20it%27" title="del.icio.us"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2010%2F05%2F27%2Fquick-jquery-hack-to-fix-positionfixed-toolbars-in-iphoneipadipod-touch%2F&amp;title=Quick%20jQuery%20hack%20to%20fix%20position%3Afixed%20toolbars%20in%20iPhone%2FiPad%2FiPod%20Touch" title="DotNetKicks"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2010%2F05%2F27%2Fquick-jquery-hack-to-fix-positionfixed-toolbars-in-iphoneipadipod-touch%2F&amp;title=Quick%20jQuery%20hack%20to%20fix%20position%3Afixed%20toolbars%20in%20iPhone%2FiPad%2FiPod%20Touch" title="DZone"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2010%2F05%2F27%2Fquick-jquery-hack-to-fix-positionfixed-toolbars-in-iphoneipadipod-touch%2F&amp;title=Quick%20jQuery%20hack%20to%20fix%20position%3Afixed%20toolbars%20in%20iPhone%2FiPad%2FiPod%20Touch" title="Reddit"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2010%2F05%2F27%2Fquick-jquery-hack-to-fix-positionfixed-toolbars-in-iphoneipadipod-touch%2F&amp;title=Quick%20jQuery%20hack%20to%20fix%20position%3Afixed%20toolbars%20in%20iPhone%2FiPad%2FiPod%20Touch&amp;bodytext=This%20is%20just%20a%20quick%20fix%20if%20your%20postion%3Afixed%20elements%20end%20up%20in%20weird%20places%20when%20your%20site%20is%20viewed%20on%20the%20iPhone%2C%20iPad%2C%20or%20iPod%20Touch.%0D%0A%0D%0A%20Say%20you%20have%20a%20div%20with%20an%20id%20of%20%22%23footer%22%20that%20you%20want%20to%20stay%20at%20the%20bottom%20of%20the%20page.%20If%20you%20set%20it%27" title="Digg"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2010%2F05%2F27%2Fquick-jquery-hack-to-fix-positionfixed-toolbars-in-iphoneipadipod-touch%2F&amp;title=Quick%20jQuery%20hack%20to%20fix%20position%3Afixed%20toolbars%20in%20iPhone%2FiPad%2FiPod%20Touch" title="StumbleUpon"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2010%2F05%2F27%2Fquick-jquery-hack-to-fix-positionfixed-toolbars-in-iphoneipadipod-touch%2F&amp;title=Quick%20jQuery%20hack%20to%20fix%20position%3Afixed%20toolbars%20in%20iPhone%2FiPad%2FiPod%20Touch&amp;source=Lazycoder+&amp;summary=This%20is%20just%20a%20quick%20fix%20if%20your%20postion%3Afixed%20elements%20end%20up%20in%20weird%20places%20when%20your%20site%20is%20viewed%20on%20the%20iPhone%2C%20iPad%2C%20or%20iPod%20Touch.%0D%0A%0D%0A%20Say%20you%20have%20a%20div%20with%20an%20id%20of%20%22%23footer%22%20that%20you%20want%20to%20stay%20at%20the%20bottom%20of%20the%20page.%20If%20you%20set%20it%27" title="LinkedIn"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2010%2F05%2F27%2Fquick-jquery-hack-to-fix-positionfixed-toolbars-in-iphoneipadipod-touch%2F&amp;t=Quick%20jQuery%20hack%20to%20fix%20position%3Afixed%20toolbars%20in%20iPhone%2FiPad%2FiPod%20Touch" title="Facebook"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=Quick%20jQuery%20hack%20to%20fix%20position%3Afixed%20toolbars%20in%20iPhone%2FiPad%2FiPod%20Touch&amp;link=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2010%2F05%2F27%2Fquick-jquery-hack-to-fix-positionfixed-toolbars-in-iphoneipadipod-touch%2F" title="FriendFeed"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2010%2F05%2F27%2Fquick-jquery-hack-to-fix-positionfixed-toolbars-in-iphoneipadipod-touch%2F&amp;t=Quick%20jQuery%20hack%20to%20fix%20position%3Afixed%20toolbars%20in%20iPhone%2FiPad%2FiPod%20Touch" title="HackerNews"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=Quick%20jQuery%20hack%20to%20fix%20position%3Afixed%20toolbars%20in%20iPhone%2FiPad%2FiPod%20Touch&amp;url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2010%2F05%2F27%2Fquick-jquery-hack-to-fix-positionfixed-toolbars-in-iphoneipadipod-touch%2F" title="Netvibes"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://posterous.com/share?linkto=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2010%2F05%2F27%2Fquick-jquery-hack-to-fix-positionfixed-toolbars-in-iphoneipadipod-touch%2F&amp;title=Quick%20jQuery%20hack%20to%20fix%20position%3Afixed%20toolbars%20in%20iPhone%2FiPad%2FiPod%20Touch&amp;selection=This%20is%20just%20a%20quick%20fix%20if%20your%20postion%3Afixed%20elements%20end%20up%20in%20weird%20places%20when%20your%20site%20is%20viewed%20on%20the%20iPhone%2C%20iPad%2C%20or%20iPod%20Touch.%0D%0A%0D%0A%20Say%20you%20have%20a%20div%20with%20an%20id%20of%20%22%23footer%22%20that%20you%20want%20to%20stay%20at%20the%20bottom%20of%20the%20page.%20If%20you%20set%20it%27" title="Posterous"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/posterous.png" title="Posterous" alt="Posterous" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2010%2F05%2F27%2Fquick-jquery-hack-to-fix-positionfixed-toolbars-in-iphoneipadipod-touch%2F&amp;t=Quick%20jQuery%20hack%20to%20fix%20position%3Afixed%20toolbars%20in%20iPhone%2FiPad%2FiPod%20Touch&amp;s=This%20is%20just%20a%20quick%20fix%20if%20your%20postion%3Afixed%20elements%20end%20up%20in%20weird%20places%20when%20your%20site%20is%20viewed%20on%20the%20iPhone%2C%20iPad%2C%20or%20iPod%20Touch.%0D%0A%0D%0A%20Say%20you%20have%20a%20div%20with%20an%20id%20of%20%22%23footer%22%20that%20you%20want%20to%20stay%20at%20the%20bottom%20of%20the%20page.%20If%20you%20set%20it%27" title="Tumblr"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Quick%20jQuery%20hack%20to%20fix%20position%3Afixed%20toolbars%20in%20iPhone%2FiPad%2FiPod%20Touch%20-%20http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2010%2F05%2F27%2Fquick-jquery-hack-to-fix-positionfixed-toolbars-in-iphoneipadipod-touch%2F" title="Twitter"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.lazycoder.com/weblog/2010/05/27/quick-jquery-hack-to-fix-positionfixed-toolbars-in-iphoneipadipod-touch/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Announcing the Border Radius Support plugin</title>
		<link>http://lazycoder.com/jqueryplugins/?p=4</link>
		<comments>http://lazycoder.com/jqueryplugins/?p=4#comments</comments>
		<pubDate>Wed, 17 Mar 2010 15:26:27 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[plugins]]></category>

		<guid isPermaLink="false">http://lazycoder.com/jqueryplugins/?p=4</guid>
		<description><![CDATA[I&#8217;ve developed a jQuery plugin that will detect the specific css styles for setting the border radius of elements that the browser supports. The plugin will return an object containing three boolean properties: moz, webkit, and css3. Each property corresponds to a corresponding css style property
moz &#8211; MozBorderRadius
webkit &#8211; webkitBorderRadius
css3 &#8211; BorderRadius
[javascript]
var supported = $(&#8220;#foo&#8221;).borderRadiusSupport();
console.log(supported.moz); [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve developed a jQuery plugin that will detect the specific css styles for setting the border radius of elements that the browser supports. The plugin will return an object containing three boolean properties: moz, webkit, and css3. Each property corresponds to a corresponding css style property</p>
<p>moz &#8211; MozBorderRadius</p>
<p>webkit &#8211; webkitBorderRadius</p>
<p>css3 &#8211; BorderRadius</p>
<div class="igBar"><span id="ljavascript-3"><a href="#" onclick="javascript:showCodeTxt('javascript-3'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JAVASCRIPT:</span>
<div id="javascript-3">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> supported = $<span style="color: #66cc66;">&#40;</span>&amp;#8220;#foo&amp;#8221;<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">borderRadiusSupport</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">console.<span style="color: #006600;">log</span><span style="color: #66cc66;">&#40;</span>supported.<span style="color: #006600;">moz</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #009900; font-style: italic;">//true for Mozilla</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">console.<span style="color: #006600;">log</span><span style="color: #66cc66;">&#40;</span>supported.<span style="color: #006600;">webkit</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #009900; font-style: italic;">//true for Safari, Webkit, and Chrome</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">console.<span style="color: #006600;">log</span><span style="color: #66cc66;">&#40;</span>supported.<span style="color: #006600;">css3</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #009900; font-style: italic;">//true for Chrome </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Support for more browsers may be added in the future.</p>
<p><a href="http://github.com/skoon/jQuery-plugins">Link to the repository on GitHub</a></p>



Share and Enjoy:


	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Flazycoder.com%2Fjqueryplugins%2F%3Fp%3D4&amp;title=Announcing%20the%20Border%20Radius%20Support%20plugin&amp;notes=I%26%238217%3Bve%20developed%20a%20jQuery%20plugin%20that%20will%20detect%20the%20specific%20css%20styles%20for%20setting%20the%20border%20radius%20of%20elements%20that%20the%20browser%20supports.%20The%20plugin%20will%20return%20an%20object%20containing%20three%20boolean%20properties%3A%20moz%2C%20webkit%2C%20and%20css3.%20Each%20property%20corresponds%20to%20a%20corresponding%20css%20style%20property%0D%0Amoz%20%26%238211%3B%20MozBorderRadius%0D%0Awebkit%20%26%238211%3B%20webkitBorderRadius%0D%0Acss3%20%26%238211%3B%20BorderRadius%0D%0A%5Bjavascript%5D%0D%0Avar%20supported%20%3D%20%24%28%26%238220%3B%23foo%26%238221%3B%29.borderRadiusSupport%28%29%3B%0D%0Aconsole.log%28supported.moz%29%3B%20%5B...%5D" title="del.icio.us"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Flazycoder.com%2Fjqueryplugins%2F%3Fp%3D4&amp;title=Announcing%20the%20Border%20Radius%20Support%20plugin" title="DotNetKicks"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Flazycoder.com%2Fjqueryplugins%2F%3Fp%3D4&amp;title=Announcing%20the%20Border%20Radius%20Support%20plugin" title="DZone"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Flazycoder.com%2Fjqueryplugins%2F%3Fp%3D4&amp;title=Announcing%20the%20Border%20Radius%20Support%20plugin" title="Reddit"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Flazycoder.com%2Fjqueryplugins%2F%3Fp%3D4&amp;title=Announcing%20the%20Border%20Radius%20Support%20plugin&amp;bodytext=I%26%238217%3Bve%20developed%20a%20jQuery%20plugin%20that%20will%20detect%20the%20specific%20css%20styles%20for%20setting%20the%20border%20radius%20of%20elements%20that%20the%20browser%20supports.%20The%20plugin%20will%20return%20an%20object%20containing%20three%20boolean%20properties%3A%20moz%2C%20webkit%2C%20and%20css3.%20Each%20property%20corresponds%20to%20a%20corresponding%20css%20style%20property%0D%0Amoz%20%26%238211%3B%20MozBorderRadius%0D%0Awebkit%20%26%238211%3B%20webkitBorderRadius%0D%0Acss3%20%26%238211%3B%20BorderRadius%0D%0A%5Bjavascript%5D%0D%0Avar%20supported%20%3D%20%24%28%26%238220%3B%23foo%26%238221%3B%29.borderRadiusSupport%28%29%3B%0D%0Aconsole.log%28supported.moz%29%3B%20%5B...%5D" title="Digg"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Flazycoder.com%2Fjqueryplugins%2F%3Fp%3D4&amp;title=Announcing%20the%20Border%20Radius%20Support%20plugin" title="StumbleUpon"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Flazycoder.com%2Fjqueryplugins%2F%3Fp%3D4&amp;title=Announcing%20the%20Border%20Radius%20Support%20plugin&amp;source=Lazycoder+&amp;summary=I%26%238217%3Bve%20developed%20a%20jQuery%20plugin%20that%20will%20detect%20the%20specific%20css%20styles%20for%20setting%20the%20border%20radius%20of%20elements%20that%20the%20browser%20supports.%20The%20plugin%20will%20return%20an%20object%20containing%20three%20boolean%20properties%3A%20moz%2C%20webkit%2C%20and%20css3.%20Each%20property%20corresponds%20to%20a%20corresponding%20css%20style%20property%0D%0Amoz%20%26%238211%3B%20MozBorderRadius%0D%0Awebkit%20%26%238211%3B%20webkitBorderRadius%0D%0Acss3%20%26%238211%3B%20BorderRadius%0D%0A%5Bjavascript%5D%0D%0Avar%20supported%20%3D%20%24%28%26%238220%3B%23foo%26%238221%3B%29.borderRadiusSupport%28%29%3B%0D%0Aconsole.log%28supported.moz%29%3B%20%5B...%5D" title="LinkedIn"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Flazycoder.com%2Fjqueryplugins%2F%3Fp%3D4&amp;t=Announcing%20the%20Border%20Radius%20Support%20plugin" title="Facebook"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=Announcing%20the%20Border%20Radius%20Support%20plugin&amp;link=http%3A%2F%2Flazycoder.com%2Fjqueryplugins%2F%3Fp%3D4" title="FriendFeed"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Flazycoder.com%2Fjqueryplugins%2F%3Fp%3D4&amp;t=Announcing%20the%20Border%20Radius%20Support%20plugin" title="HackerNews"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=Announcing%20the%20Border%20Radius%20Support%20plugin&amp;url=http%3A%2F%2Flazycoder.com%2Fjqueryplugins%2F%3Fp%3D4" title="Netvibes"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://posterous.com/share?linkto=http%3A%2F%2Flazycoder.com%2Fjqueryplugins%2F%3Fp%3D4&amp;title=Announcing%20the%20Border%20Radius%20Support%20plugin&amp;selection=I%26%238217%3Bve%20developed%20a%20jQuery%20plugin%20that%20will%20detect%20the%20specific%20css%20styles%20for%20setting%20the%20border%20radius%20of%20elements%20that%20the%20browser%20supports.%20The%20plugin%20will%20return%20an%20object%20containing%20three%20boolean%20properties%3A%20moz%2C%20webkit%2C%20and%20css3.%20Each%20property%20corresponds%20to%20a%20corresponding%20css%20style%20property%0D%0Amoz%20%26%238211%3B%20MozBorderRadius%0D%0Awebkit%20%26%238211%3B%20webkitBorderRadius%0D%0Acss3%20%26%238211%3B%20BorderRadius%0D%0A%5Bjavascript%5D%0D%0Avar%20supported%20%3D%20%24%28%26%238220%3B%23foo%26%238221%3B%29.borderRadiusSupport%28%29%3B%0D%0Aconsole.log%28supported.moz%29%3B%20%5B...%5D" title="Posterous"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/posterous.png" title="Posterous" alt="Posterous" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Flazycoder.com%2Fjqueryplugins%2F%3Fp%3D4&amp;t=Announcing%20the%20Border%20Radius%20Support%20plugin&amp;s=I%26%238217%3Bve%20developed%20a%20jQuery%20plugin%20that%20will%20detect%20the%20specific%20css%20styles%20for%20setting%20the%20border%20radius%20of%20elements%20that%20the%20browser%20supports.%20The%20plugin%20will%20return%20an%20object%20containing%20three%20boolean%20properties%3A%20moz%2C%20webkit%2C%20and%20css3.%20Each%20property%20corresponds%20to%20a%20corresponding%20css%20style%20property%0D%0Amoz%20%26%238211%3B%20MozBorderRadius%0D%0Awebkit%20%26%238211%3B%20webkitBorderRadius%0D%0Acss3%20%26%238211%3B%20BorderRadius%0D%0A%5Bjavascript%5D%0D%0Avar%20supported%20%3D%20%24%28%26%238220%3B%23foo%26%238221%3B%29.borderRadiusSupport%28%29%3B%0D%0Aconsole.log%28supported.moz%29%3B%20%5B...%5D" title="Tumblr"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Announcing%20the%20Border%20Radius%20Support%20plugin%20-%20http%3A%2F%2Flazycoder.com%2Fjqueryplugins%2F%3Fp%3D4" title="Twitter"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://lazycoder.com/jqueryplugins/?feed=rss2&amp;p=4</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Benchmarking a simple DOM based cloning template</title>
		<link>http://www.lazycoder.com/weblog/2009/12/10/benchmarking-a-simple-dom-based-cloning-template/</link>
		<comments>http://www.lazycoder.com/weblog/2009/12/10/benchmarking-a-simple-dom-based-cloning-template/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 20:28:02 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.lazycoder.com/weblog/?p=1232</guid>
		<description><![CDATA[Sara Chipps recently posted a simple DOM based clone template method she uses in one of her apps. "Easy HTML Templating with JQuery" My template looks like this: PLAIN TEXT CODE: &#60;script id="ItemTemplate" type="text/html" &#160; &#160; &#160; &#160; &#60;li class="item" value="&#124;rowNumber&#124;"&#62; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#60;input type=”text” id=”input&#124;rowNumber&#124;” /&#62; &#160; &#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Sara Chipps recently posted a simple <acronym title='Document Object Model'><span class='caps'>DOM</span></acronym> based clone template method she uses in one of her apps. "<a href="http://girldeveloper.com/waxing-dev/easy-html-templating-with-jquery/">Easy <acronym title='HyperText Markup Language'><span class='caps'>HTML</span></acronym> Templating with JQuery</a>"</p>
<blockquote><p>
My template looks like this:</p>
<div class="igBar"><span id="lcode-10"><a href="#" onclick="javascript:showCodeTxt('code-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-10">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script id=<span style="color:#CC0000;">"ItemTemplate"</span> type=<span style="color:#CC0000;">"text/html"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;li class=<span style="color:#CC0000;">"item"</span> value=<span style="color:#CC0000;">"|rowNumber|"</span>&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input type=”text” id=”input|rowNumber|” /&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;/li&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/script&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p> <br />
Now within my code I need to put a place holder where I want my <acronym title='HyperText Markup Language'><span class='caps'>HTML</span></acronym> to go.  I have my unordered list called url_list.</p>
<div class="igBar"><span id="lcode-11"><a href="#" onclick="javascript:showCodeTxt('code-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-11">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;ul id=<span style="color:#CC0000;">"url_list"</span>&gt;&lt;/ul&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Now, you see that most of my items look like this “|rowNumber|” I have a variable in my code called nextUniqueItemID (I believe in extremely descriptive variable names). Here is my “addItem” function.</p>
<div class="igBar"><span id="ljavascript-12"><a href="#" onclick="javascript:showCodeTxt('javascript-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JAVASCRIPT:</span>
<div id="javascript-12">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span> addItem<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> list = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#url_list'</span><span style="color: #66cc66;">&#41;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; items = list.<span style="color: #006600;">find</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'li'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; list.<span style="color: #006600;">append</span><span style="color: #66cc66;">&#40;</span>$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#ItemTemplate’)</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #3366CC;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .html().replace(/<span style="color: #000099; font-weight: bold;">\|</span>rowNumber<span style="color: #000099; font-weight: bold;">\|</span>/gi, nextUniqueItemID++))</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #3366CC;">&nbsp; &nbsp; } </span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
</p></blockquote>
<p>The use of global variables aside (cough,cough),I looked at it and, having used something like this myself, thought that it would work find for data sets containing a very small number of items. The problem is these kinds of clone based templates are VERY slow compared to the templating engines that are available for various JavaScript libraries.</p>
<p>I happened to read a post by Brian Landau called "<a href="http://www.viget.com/extend/benchmarking-javascript-templating-libraries/">Benchmarking Javascript Templating Libraries</a>" this morning and wondered just HOW MUCH slower is the naive template method than a good template library?</p>
<p>I grabbed the benchmarking code and modified it to run the new clone based template method.</p>
<div class="igBar"><span id="ljavascript-13"><a href="#" onclick="javascript:showCodeTxt('javascript-13'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JAVASCRIPT:</span>
<div id="javascript-13">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> nextUniqueItemID = <span style="color: #CC0000;color:#800000;">0</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">function</span> addItem<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> list = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#url_list'</span><span style="color: #66cc66;">&#41;</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; items = list.<span style="color: #006600;">find</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'li'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; list.<span style="color: #006600;">append</span><span style="color: #66cc66;">&#40;</span>$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#ItemTemplate'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">html</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">replace</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066FF;">/\|rowNumber\|/gi</span>, nextUniqueItemID++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; $<span style="color: #66cc66;">&#40;</span>document<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">ready</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #003366; font-weight: bold;">var</span> output = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#output'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;$.<span style="color: #006600;">benchmarks</span> = <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; $.<span style="color: #006600;">benchmarks</span>.<span style="color: #006600;">test_simple</span> = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; addItem<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; $.<span style="color: #006600;">benchmarks</span>.<span style="color: #006600;">loop_test</span> = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i=<span style="color: #CC0000;color:#800000;">0</span>; i &lt;<span style="color: #CC0000;color:#800000;">5</span>; i++<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addItem<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// use these lines to run the benchmark tests in your browsers JS console</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// $.benchmark(1000, '#simple_test', $.benchmarks.test_simple);</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// $.benchmark(1000, '#loop_test', $.benchmarks.loop_test);</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Since the template Sara provided contains an input tag you get a different benchmark if you run the simple_test and the loop_test separately after refreshing your browser. You can run the tests for yourself<a href="http://lazycoder.com/code_examples/templatebenchmarks/"> here</a>, the loop test *may* cause your browser to give you a "script is running slow" message, hit continue as the loop <strong>will</strong> eventually end. You may also get different numbers if you run the tests in <acronym title='Internet Explorer'><span class='caps'>IE</span></acronym>, Chrome, and Safari.</p>
<p>results: using FF 3.5.5<br />
Simple Test: 1.71s<br />
Loop test: 31.534s</p>
<p>When you consider that the slowest loop test using a template library was just around 4.5s, you get a better idea of just how slow this method is when you have an input in your template. </p>
<p>So that's fine, but it's known that dynamically adding text inputs is slow in just about every browser and the original tests don't use inputs at all, just divs. So let's modify the template and see what the results are.</p>
<div class="igBar"><span id="lcode-14"><a href="#" onclick="javascript:showCodeTxt('code-14'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-14">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script id=<span style="color:#CC0000;">"ItemTemplate"</span> type=<span style="color:#CC0000;">"text/html"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;div class=<span style="color:#CC0000;">"test"</span>&gt;&lt;h2&gt;This is a test of |name|&lt;/h2&gt;&lt;p&gt;The homepage is &lt;a href=<span style="color:#CC0000;">"|url|"</span>&gt;|url|&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;The sources is: |source|&lt;/p&gt;&lt;/div&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/script&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>I modified the addItem function to account for the new data. n.b. The data I'm using is static, if you wanted to use a data source you would just modify this method to take in your data parameters.</p>
<div class="igBar"><span id="ljavascript-15"><a href="#" onclick="javascript:showCodeTxt('javascript-15'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JAVASCRIPT:</span>
<div id="javascript-15">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span> addItem<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> list = $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#url_list'</span><span style="color: #66cc66;">&#41;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; items = list.<span style="color: #006600;">find</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'li'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; list.<span style="color: #006600;">append</span><span style="color: #66cc66;">&#40;</span>$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'#ItemTemplate'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">html</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">replace</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066FF;">/\|name\|/gi</span>, <span style="color: #3366CC;">"Clone template method"</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">replace</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066FF;">/\|source\|/gi</span>, <span style="color: #3366CC;">"http://girldeveloper.com/waxing-dev/easy-html-templating-with-jquery/"</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">replace</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066FF;">/\|url\|/gi</span>, <span style="color: #3366CC;">"http://girldeveloper.com/waxing-dev/easy-html-templating-with-jquery/"</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
results using FF 3.5.5 - refresh between each test<br />
simple test: 1.285s<br />
loop test: 3.771</p>
<p>results using ff 3.5.5 with no refresh between tests<br />
simple test: 1.434<br />
loop test: 4.227</p>
<p>So that's looking a little bit better. Not too much slower than the template libraries.</p>
<p>So what do the template libraries give you? Well the replace method works find provides your data is escaped properly. But say instead of a url in the "source" replacement, you use a file path like "file:\\foodrive\source.txt". Well it still gets replaced, but the text looks like this "file:\foodrivesource.txt". So in addition to the replacement, you have to make sure your data is properly escaped. A lot of template libraries will do this for you. Also notice that the addItem method has to do a <acronym title='Document Object Model'><span class='caps'>DOM</span></acronym> lookup on every iteration of the loop to get the template. If you have a large <acronym title='Document Object Model'><span class='caps'>DOM</span></acronym>, this could impact the performance.</p>



Share and Enjoy:


	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F12%2F10%2Fbenchmarking-a-simple-dom-based-cloning-template%2F&amp;title=Benchmarking%20a%20simple%20DOM%20based%20cloning%20template&amp;notes=Sara%20Chipps%20recently%20posted%20a%20simple%20DOM%20based%20clone%20template%20method%20she%20uses%20in%20one%20of%20her%20apps.%20%22Easy%20HTML%20Templating%20with%20JQuery%22%0D%0A%0D%0AMy%20template%20looks%20like%20this%3A%0D%0A%5Bcode%5D%0D%0A%20%20" title="del.icio.us"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F12%2F10%2Fbenchmarking-a-simple-dom-based-cloning-template%2F&amp;title=Benchmarking%20a%20simple%20DOM%20based%20cloning%20template" title="DotNetKicks"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F12%2F10%2Fbenchmarking-a-simple-dom-based-cloning-template%2F&amp;title=Benchmarking%20a%20simple%20DOM%20based%20cloning%20template" title="DZone"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F12%2F10%2Fbenchmarking-a-simple-dom-based-cloning-template%2F&amp;title=Benchmarking%20a%20simple%20DOM%20based%20cloning%20template" title="Reddit"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F12%2F10%2Fbenchmarking-a-simple-dom-based-cloning-template%2F&amp;title=Benchmarking%20a%20simple%20DOM%20based%20cloning%20template&amp;bodytext=Sara%20Chipps%20recently%20posted%20a%20simple%20DOM%20based%20clone%20template%20method%20she%20uses%20in%20one%20of%20her%20apps.%20%22Easy%20HTML%20Templating%20with%20JQuery%22%0D%0A%0D%0AMy%20template%20looks%20like%20this%3A%0D%0A%5Bcode%5D%0D%0A%20%20" title="Digg"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F12%2F10%2Fbenchmarking-a-simple-dom-based-cloning-template%2F&amp;title=Benchmarking%20a%20simple%20DOM%20based%20cloning%20template" title="StumbleUpon"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F12%2F10%2Fbenchmarking-a-simple-dom-based-cloning-template%2F&amp;title=Benchmarking%20a%20simple%20DOM%20based%20cloning%20template&amp;source=Lazycoder+&amp;summary=Sara%20Chipps%20recently%20posted%20a%20simple%20DOM%20based%20clone%20template%20method%20she%20uses%20in%20one%20of%20her%20apps.%20%22Easy%20HTML%20Templating%20with%20JQuery%22%0D%0A%0D%0AMy%20template%20looks%20like%20this%3A%0D%0A%5Bcode%5D%0D%0A%20%20" title="LinkedIn"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F12%2F10%2Fbenchmarking-a-simple-dom-based-cloning-template%2F&amp;t=Benchmarking%20a%20simple%20DOM%20based%20cloning%20template" title="Facebook"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=Benchmarking%20a%20simple%20DOM%20based%20cloning%20template&amp;link=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F12%2F10%2Fbenchmarking-a-simple-dom-based-cloning-template%2F" title="FriendFeed"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F12%2F10%2Fbenchmarking-a-simple-dom-based-cloning-template%2F&amp;t=Benchmarking%20a%20simple%20DOM%20based%20cloning%20template" title="HackerNews"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=Benchmarking%20a%20simple%20DOM%20based%20cloning%20template&amp;url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F12%2F10%2Fbenchmarking-a-simple-dom-based-cloning-template%2F" title="Netvibes"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://posterous.com/share?linkto=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F12%2F10%2Fbenchmarking-a-simple-dom-based-cloning-template%2F&amp;title=Benchmarking%20a%20simple%20DOM%20based%20cloning%20template&amp;selection=Sara%20Chipps%20recently%20posted%20a%20simple%20DOM%20based%20clone%20template%20method%20she%20uses%20in%20one%20of%20her%20apps.%20%22Easy%20HTML%20Templating%20with%20JQuery%22%0D%0A%0D%0AMy%20template%20looks%20like%20this%3A%0D%0A%5Bcode%5D%0D%0A%20%20" title="Posterous"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/posterous.png" title="Posterous" alt="Posterous" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F12%2F10%2Fbenchmarking-a-simple-dom-based-cloning-template%2F&amp;t=Benchmarking%20a%20simple%20DOM%20based%20cloning%20template&amp;s=Sara%20Chipps%20recently%20posted%20a%20simple%20DOM%20based%20clone%20template%20method%20she%20uses%20in%20one%20of%20her%20apps.%20%22Easy%20HTML%20Templating%20with%20JQuery%22%0D%0A%0D%0AMy%20template%20looks%20like%20this%3A%0D%0A%5Bcode%5D%0D%0A%20%20" title="Tumblr"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Benchmarking%20a%20simple%20DOM%20based%20cloning%20template%20-%20http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F12%2F10%2Fbenchmarking-a-simple-dom-based-cloning-template%2F" title="Twitter"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.lazycoder.com/weblog/2009/12/10/benchmarking-a-simple-dom-based-cloning-template/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>A new JavaScript CDN from Microsoft</title>
		<link>http://www.lazycoder.com/weblog/2009/09/29/a-new-javascript-cdn-from-microsoft/</link>
		<comments>http://www.lazycoder.com/weblog/2009/09/29/a-new-javascript-cdn-from-microsoft/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 23:36:55 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.lazycoder.com/weblog/?p=1173</guid>
		<description><![CDATA[Microsoft announced a new Content Delivery Network for their ASP.NET AJAX JavaScript libraries and jQuery. This means that instead of hosting those libraries on your server, you can just link to the versions on Microsofts server. I made a simple page that takes a querystring parameter (q=) and uses the ASP.NET AJAX dynamic templates to [...]]]></description>
			<content:encoded><![CDATA[<p>Microsoft announced a new Content Delivery Network for their ASP.NET <acronym title='Asynchronous Javascript and XML'><span class='caps'>AJAX</span></acronym> JavaScript libraries and jQuery. This means that instead of hosting those libraries on your server, you can just link to the versions on Microsofts server. I made a <a href="http://lazycoder.com/letmebingthatforyou/?q=jQuery">simple page</a> that takes a querystring parameter (q=) and uses the ASP.NET <acronym title='Asynchronous Javascript and XML'><span class='caps'>AJAX</span></acronym> dynamic templates to bind search results from a call to the Bing <acronym title='Application Interface'><span class='caps'>API</span></acronym>.</p>
<p>The money lines in the source are the following:</p>
<div class="igBar"><span id="lcode-19"><a href="#" onclick="javascript:showCodeTxt('code-19'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-19">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script type=<span style="color:#CC0000;">"text/javascript"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">src=<span style="color:#CC0000;">"http://ajax.microsoft.com/ajax/beta/0909/MicrosoftAjax.debug.js"</span>&gt;&lt;/script&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script type=<span style="color:#CC0000;">"text/javascript"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">src=<span style="color:#CC0000;">"http://ajax.microsoft.com/ajax/beta/0909/MicrosoftAjaxTemplates.js"</span>&gt;&lt;/script&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
These two lines tell the browser to load the MS <acronym title='Asynchronous Javascript and XML'><span class='caps'>AJAX</span></acronym> scripts from the CDN. There are some <a href="http://idunno.org/archive/2009/09/16/quick-thoughts-on-the-microsoft-ajax-cdn.aspx">security concerns</a> around the fact that the files are served from the microsoft.com domain. Both Google and Yahoo serve there files from a separate, non-cookied domain (googleapis.com and yahooapis.com respectively). Hopefully, these fears will be unfounded.</p>
<p>On a side note, it is surprisingly easy to use the Bing <acronym title='Application Interface'><span class='caps'>API</span></acronym> if you are familiar with script tag injection. The easiest way is to put an empty script tag in your page.</p>
<div class="igBar"><span id="lcode-20"><a href="#" onclick="javascript:showCodeTxt('code-20'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-20">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script id=<span style="color:#CC0000;">"jsonResults"</span> type=<span style="color:#CC0000;">"text/javascript"</span>&gt;&lt;/script&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>And then just create your Bing <acronym title='Uniform Resource Locator'><span class='caps'>URL</span></acronym> and set the script elements src attribute to the <acronym title='Uniform Resource Locator'><span class='caps'>URL</span></acronym> you created.</p>
<div class="igBar"><span id="lcode-21"><a href="#" onclick="javascript:showCodeTxt('code-21'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-21">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">function MakeSearchRequest<span style="color:#006600; font-weight:bold;">&#40;</span>searchPhrase<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var req = <span style="color:#CC0000;">"http://api.bing.net/json.aspx?"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ <span style="color:#CC0000;">"AppId="</span> + YOUR <acronym title='Application Interface'><span class='caps'>API</span></acronym> KEY GOES HERE</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ <span style="color:#CC0000;">"&amp;Query="</span> + searchPhrase</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ <span style="color:#CC0000;">"&amp;Sources=Web"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ <span style="color:#CC0000;">"&amp;JsonType=callback"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+ <span style="color:#CC0000;">"&amp;JsonCallback=BuildResults"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $get<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"jsonResults"</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">src</span> = req;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>



Share and Enjoy:


	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F09%2F29%2Fa-new-javascript-cdn-from-microsoft%2F&amp;title=A%20new%20JavaScript%20CDN%20from%20Microsoft&amp;notes=Microsoft%20announced%20a%20new%20Content%20Delivery%20Network%20for%20their%20ASP.NET%20AJAX%20JavaScript%20libraries%20and%20jQuery.%20This%20means%20that%20instead%20of%20hosting%20those%20libraries%20on%20your%20server%2C%20you%20can%20just%20link%20to%20the%20versions%20on%20Microsofts%20server.%20I%20made%20a%20simple%20page" title="del.icio.us"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F09%2F29%2Fa-new-javascript-cdn-from-microsoft%2F&amp;title=A%20new%20JavaScript%20CDN%20from%20Microsoft" title="DotNetKicks"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F09%2F29%2Fa-new-javascript-cdn-from-microsoft%2F&amp;title=A%20new%20JavaScript%20CDN%20from%20Microsoft" title="DZone"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F09%2F29%2Fa-new-javascript-cdn-from-microsoft%2F&amp;title=A%20new%20JavaScript%20CDN%20from%20Microsoft" title="Reddit"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F09%2F29%2Fa-new-javascript-cdn-from-microsoft%2F&amp;title=A%20new%20JavaScript%20CDN%20from%20Microsoft&amp;bodytext=Microsoft%20announced%20a%20new%20Content%20Delivery%20Network%20for%20their%20ASP.NET%20AJAX%20JavaScript%20libraries%20and%20jQuery.%20This%20means%20that%20instead%20of%20hosting%20those%20libraries%20on%20your%20server%2C%20you%20can%20just%20link%20to%20the%20versions%20on%20Microsofts%20server.%20I%20made%20a%20simple%20page" title="Digg"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F09%2F29%2Fa-new-javascript-cdn-from-microsoft%2F&amp;title=A%20new%20JavaScript%20CDN%20from%20Microsoft" title="StumbleUpon"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F09%2F29%2Fa-new-javascript-cdn-from-microsoft%2F&amp;title=A%20new%20JavaScript%20CDN%20from%20Microsoft&amp;source=Lazycoder+&amp;summary=Microsoft%20announced%20a%20new%20Content%20Delivery%20Network%20for%20their%20ASP.NET%20AJAX%20JavaScript%20libraries%20and%20jQuery.%20This%20means%20that%20instead%20of%20hosting%20those%20libraries%20on%20your%20server%2C%20you%20can%20just%20link%20to%20the%20versions%20on%20Microsofts%20server.%20I%20made%20a%20simple%20page" title="LinkedIn"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F09%2F29%2Fa-new-javascript-cdn-from-microsoft%2F&amp;t=A%20new%20JavaScript%20CDN%20from%20Microsoft" title="Facebook"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=A%20new%20JavaScript%20CDN%20from%20Microsoft&amp;link=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F09%2F29%2Fa-new-javascript-cdn-from-microsoft%2F" title="FriendFeed"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F09%2F29%2Fa-new-javascript-cdn-from-microsoft%2F&amp;t=A%20new%20JavaScript%20CDN%20from%20Microsoft" title="HackerNews"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=A%20new%20JavaScript%20CDN%20from%20Microsoft&amp;url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F09%2F29%2Fa-new-javascript-cdn-from-microsoft%2F" title="Netvibes"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://posterous.com/share?linkto=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F09%2F29%2Fa-new-javascript-cdn-from-microsoft%2F&amp;title=A%20new%20JavaScript%20CDN%20from%20Microsoft&amp;selection=Microsoft%20announced%20a%20new%20Content%20Delivery%20Network%20for%20their%20ASP.NET%20AJAX%20JavaScript%20libraries%20and%20jQuery.%20This%20means%20that%20instead%20of%20hosting%20those%20libraries%20on%20your%20server%2C%20you%20can%20just%20link%20to%20the%20versions%20on%20Microsofts%20server.%20I%20made%20a%20simple%20page" title="Posterous"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/posterous.png" title="Posterous" alt="Posterous" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F09%2F29%2Fa-new-javascript-cdn-from-microsoft%2F&amp;t=A%20new%20JavaScript%20CDN%20from%20Microsoft&amp;s=Microsoft%20announced%20a%20new%20Content%20Delivery%20Network%20for%20their%20ASP.NET%20AJAX%20JavaScript%20libraries%20and%20jQuery.%20This%20means%20that%20instead%20of%20hosting%20those%20libraries%20on%20your%20server%2C%20you%20can%20just%20link%20to%20the%20versions%20on%20Microsofts%20server.%20I%20made%20a%20simple%20page" title="Tumblr"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=A%20new%20JavaScript%20CDN%20from%20Microsoft%20-%20http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F09%2F29%2Fa-new-javascript-cdn-from-microsoft%2F" title="Twitter"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.lazycoder.com/weblog/2009/09/29/a-new-javascript-cdn-from-microsoft/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>JavaScript: Not for the faint at heart?</title>
		<link>http://www.lazycoder.com/weblog/2009/08/13/javascript-not-for-the-faint-at-heart/</link>
		<comments>http://www.lazycoder.com/weblog/2009/08/13/javascript-not-for-the-faint-at-heart/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 16:20:20 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Languages]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.lazycoder.com/weblog/?p=1157</guid>
		<description><![CDATA[JavaScript: A tool too sharp? Script# (Script Sharp) – writing javascript in C# Both Jimmy and roy have great posts discussing JavaScript. Roy is looking at it as a C# developer lured by the many, many articles about how jQuery is the only thing that makes JavaScript worth using and using Script# to abstract away [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.lostechies.com/blogs/jimmy_bogard/archive/2009/08/11/javascript-a-tool-too-sharp.aspx">JavaScript: A tool too sharp?</a></p>
<p><a href="http://weblogs.asp.net/rosherove/archive/2009/08/11/script-script-sharp-solving-the-javascript-overload-problem.aspx">Script# (Script Sharp) – writing javascript in C#</a></p>
<p>Both Jimmy and roy have great posts discussing JavaScript. Roy is looking at it as a C# developer lured by the many, many articles about how jQuery is the only thing that makes JavaScript worth using and using Script# to abstract away some of the messiness and pain usually associated with writing JavaScript. Jimmy discusses the merits of JavaScript itself and how it has changed how he approaches writing C# code.</p>
<p>One thing I like to point to is a great quote I heard on Twitter </p>
<blockquote><p> Java is to JavaScript as ham is to hamster</p></blockquote>
<p><img src="http://www.lazycoder.com/weblog/wp-content/uploads/2009/08/hamster2.jpg" alt="hamster2.jpg" border="0" width="400" height="277" align="right" /></p>
<p>JavaScript actually has more in common with Scheme or Lisp than it does Java or C#. I first realized this when I saw that <a href="http://javascript.crockford.com/little.html">Douglas Crockford had re-written all of the examples</a> in <a href="http://www.amazon.com/gp/product/0262560992?ie=UTF8&#038;tag=lazycoder-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=0262560992">The Little Schemer</a><img src="http://www.assoc-amazon.com/e/ir?t=lazycoder-20&#038;l=as2&#038;o=1&#038;a=0262560992" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /><br />
 in JavaScript. It's easy to miss that fact when you see all of the pseudo <acronym title='Object Oriented Programming'><span class='caps'>OOP</span></acronym> noise like "var foo = new Foo();". But when you see how trvial it is to implement something like a <a href="http://www.lazycoder.com/weblog/2009/08/12/a-simple-map-function-for-plain-javascript-arrays/">map method in JavaScript</a>, you realize how powerful the language can be. Most of the hatred for JavaScript comes from two things I've found:</p>
<ol>
<li>Broken <acronym title='Document Object Model'><span class='caps'>DOM</span></acronym> implementations - every browsers implementation of the <acronym title='Document Object Model'><span class='caps'>DOM</span></acronym> is broken in one respect or another.</li>
<li>A misunderstanding of either <a href="http://www.lazycoder.com/weblog/2008/09/23/modern-javascript-development-scope/">scope</a> or <a href="http://javascript.crockford.com/prototypal.html">inheritance</a>.</li>
</ol>
<p>Roy has a great point about the lack of good tooling surrounding JavaScript. There are excellent libraries like jQuery and PrototypeJS, but the usual tool support, intellisense, re-factoring, profiling, is a little more difficult to come by. I'll address this in another post as I feel a lot of people are new to JavaScript and are struggling along with some substandard tools.</p>



Share and Enjoy:


	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F08%2F13%2Fjavascript-not-for-the-faint-at-heart%2F&amp;title=JavaScript%3A%20Not%20for%20the%20faint%20at%20heart%3F&amp;notes=JavaScript%3A%20A%20tool%20too%20sharp%3F%0D%0A%0D%0AScript%23%20%28Script%20Sharp%29%20%E2%80%93%20writing%20javascript%20in%20C%23%0D%0A%0D%0ABoth%20Jimmy%20and%20roy%20have%20great%20posts%20discussing%20JavaScript.%20Roy%20is%20looking%20at%20it%20as%20a%20C%23%20developer%20lured%20by%20the%20many%2C%20many%20articles%20about%20how%20jQuery%20is%20the%20only%20th" title="del.icio.us"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F08%2F13%2Fjavascript-not-for-the-faint-at-heart%2F&amp;title=JavaScript%3A%20Not%20for%20the%20faint%20at%20heart%3F" title="DotNetKicks"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F08%2F13%2Fjavascript-not-for-the-faint-at-heart%2F&amp;title=JavaScript%3A%20Not%20for%20the%20faint%20at%20heart%3F" title="DZone"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F08%2F13%2Fjavascript-not-for-the-faint-at-heart%2F&amp;title=JavaScript%3A%20Not%20for%20the%20faint%20at%20heart%3F" title="Reddit"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F08%2F13%2Fjavascript-not-for-the-faint-at-heart%2F&amp;title=JavaScript%3A%20Not%20for%20the%20faint%20at%20heart%3F&amp;bodytext=JavaScript%3A%20A%20tool%20too%20sharp%3F%0D%0A%0D%0AScript%23%20%28Script%20Sharp%29%20%E2%80%93%20writing%20javascript%20in%20C%23%0D%0A%0D%0ABoth%20Jimmy%20and%20roy%20have%20great%20posts%20discussing%20JavaScript.%20Roy%20is%20looking%20at%20it%20as%20a%20C%23%20developer%20lured%20by%20the%20many%2C%20many%20articles%20about%20how%20jQuery%20is%20the%20only%20th" title="Digg"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F08%2F13%2Fjavascript-not-for-the-faint-at-heart%2F&amp;title=JavaScript%3A%20Not%20for%20the%20faint%20at%20heart%3F" title="StumbleUpon"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F08%2F13%2Fjavascript-not-for-the-faint-at-heart%2F&amp;title=JavaScript%3A%20Not%20for%20the%20faint%20at%20heart%3F&amp;source=Lazycoder+&amp;summary=JavaScript%3A%20A%20tool%20too%20sharp%3F%0D%0A%0D%0AScript%23%20%28Script%20Sharp%29%20%E2%80%93%20writing%20javascript%20in%20C%23%0D%0A%0D%0ABoth%20Jimmy%20and%20roy%20have%20great%20posts%20discussing%20JavaScript.%20Roy%20is%20looking%20at%20it%20as%20a%20C%23%20developer%20lured%20by%20the%20many%2C%20many%20articles%20about%20how%20jQuery%20is%20the%20only%20th" title="LinkedIn"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F08%2F13%2Fjavascript-not-for-the-faint-at-heart%2F&amp;t=JavaScript%3A%20Not%20for%20the%20faint%20at%20heart%3F" title="Facebook"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=JavaScript%3A%20Not%20for%20the%20faint%20at%20heart%3F&amp;link=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F08%2F13%2Fjavascript-not-for-the-faint-at-heart%2F" title="FriendFeed"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F08%2F13%2Fjavascript-not-for-the-faint-at-heart%2F&amp;t=JavaScript%3A%20Not%20for%20the%20faint%20at%20heart%3F" title="HackerNews"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=JavaScript%3A%20Not%20for%20the%20faint%20at%20heart%3F&amp;url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F08%2F13%2Fjavascript-not-for-the-faint-at-heart%2F" title="Netvibes"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://posterous.com/share?linkto=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F08%2F13%2Fjavascript-not-for-the-faint-at-heart%2F&amp;title=JavaScript%3A%20Not%20for%20the%20faint%20at%20heart%3F&amp;selection=JavaScript%3A%20A%20tool%20too%20sharp%3F%0D%0A%0D%0AScript%23%20%28Script%20Sharp%29%20%E2%80%93%20writing%20javascript%20in%20C%23%0D%0A%0D%0ABoth%20Jimmy%20and%20roy%20have%20great%20posts%20discussing%20JavaScript.%20Roy%20is%20looking%20at%20it%20as%20a%20C%23%20developer%20lured%20by%20the%20many%2C%20many%20articles%20about%20how%20jQuery%20is%20the%20only%20th" title="Posterous"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/posterous.png" title="Posterous" alt="Posterous" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F08%2F13%2Fjavascript-not-for-the-faint-at-heart%2F&amp;t=JavaScript%3A%20Not%20for%20the%20faint%20at%20heart%3F&amp;s=JavaScript%3A%20A%20tool%20too%20sharp%3F%0D%0A%0D%0AScript%23%20%28Script%20Sharp%29%20%E2%80%93%20writing%20javascript%20in%20C%23%0D%0A%0D%0ABoth%20Jimmy%20and%20roy%20have%20great%20posts%20discussing%20JavaScript.%20Roy%20is%20looking%20at%20it%20as%20a%20C%23%20developer%20lured%20by%20the%20many%2C%20many%20articles%20about%20how%20jQuery%20is%20the%20only%20th" title="Tumblr"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=JavaScript%3A%20Not%20for%20the%20faint%20at%20heart%3F%20-%20http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F08%2F13%2Fjavascript-not-for-the-faint-at-heart%2F" title="Twitter"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.lazycoder.com/weblog/2009/08/13/javascript-not-for-the-faint-at-heart/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Why these jQuery worst practices aren&#8217;t.</title>
		<link>http://www.lazycoder.com/weblog/2009/05/12/why-these-jquery-worst-practices-arent/</link>
		<comments>http://www.lazycoder.com/weblog/2009/05/12/why-these-jquery-worst-practices-arent/#comments</comments>
		<pubDate>Wed, 13 May 2009 05:34:46 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.lazycoder.com/weblog/?p=1121</guid>
		<description><![CDATA[jQuery ... Worst Practices In this post, Steve Wellens tries to make the case for two common patterns your run across when using jQuery as "worst practices". Practices that are either superfluous or harmful to your code. 1) Wiring up events using unobtrusive JavaScript. Instead of wiring up your elements events using jQuery, instead you [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://weblogs.asp.net/stevewellens/archive/2009/05/09/jquery-three-worst-practices.aspx">jQuery ... Worst Practices</a></p>
<p>In this post, Steve Wellens tries to make the case for two common patterns your run across when using jQuery as "worst practices". Practices that are either superfluous or harmful to your code.</p>
<p>1) Wiring up events using unobtrusive JavaScript.</p>
<p>Instead of wiring up your elements events using jQuery, instead you should set the OnClientClick property of the ASP.NET Web Control in question and call whatever JavaScript you want to handle the event.</p>
<p>Instead of this: </p>
<div class="igBar"><span id="lcode-27"><a href="#" onclick="javascript:showCodeTxt('code-27'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-27">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script type=<span style="color:#CC0000;">"text/javascript"</span>&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; $<span style="color:#006600; font-weight:bold;">&#40;</span>document<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">ready</span><span style="color:#006600; font-weight:bold;">&#40;</span>function<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"#Button1"</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">click</span><span style="color:#006600; font-weight:bold;">&#40;</span>function<span style="color:#006600; font-weight:bold;">&#40;</span>event<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; alert<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"You Clicked Me!"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &lt;/script&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Do This:</p>
<div class="igBar"><span id="lcode-28"><a href="#" onclick="javascript:showCodeTxt('code-28'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-28">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;asp:Button ID=<span style="color:#CC0000;">"Button1"</span> </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; runat=<span style="color:#CC0000;">"server"</span> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Text=<span style="color:#CC0000;">"MyButton"</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; OnClientClick=<span style="color:#CC0000;">"alert('You Clicked Me!');"</span> /&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>His reasoning is as follows:</p>
<blockquote><p>
You might want to change event handlers dynamically depending on some condition in the page.  If you need to assign a common event handler to several objects on a page, it makes sense to do it in one place. As a matter of fact, that's the beauty of jQuery.  But for a single event on a single control….NO.
</p></blockquote>
<p>On can debate whether or not a worst practice can really be applied to a single, specific , one-time event or not. But there are other reasons why you might want to hook up events to a single element using jQuery. one being that you can't hook  up multiple event handlers using OnClientClick or <acronym title='HyperText Markup Language'><span class='caps'>HTML</span></acronym>'s OnClick event, only a single event handler can be assigned. If you are using the observer pattern in your JavaScript, you may have multiple observers that want to subscribe to your buttons click event. But a really strong argument could be made for using the OnClientClick property simply due to ASP.NET's suck-ass way of handling client IDs.</p>
<p>2) Chaining can lead to unreadable code.</p>
<p>In a badly written example, he states that chaining calls to jQuery makes the code unreadable. I'd suggest re-formatting the code in this manner to make it legible and allow for a tighter minimization.</p>
<div class="igBar"><span id="lcode-29"><a href="#" onclick="javascript:showCodeTxt('code-29'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-29">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"div.highlight"</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; .<span style="">css</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"color"</span>, <span style="color:#CC0000;">"yellow"</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; .<span style="">css</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"background-color"</span>, <span style="color:#CC0000;">"black"</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; .<span style="">css</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"width"</span>, <span style="color:#CC0000;">"50px"</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Of course, you wouldn't write jQuery code like that and call the css method multiple times. Ideally, you would just set a class or at the very least <a href="http://docs.jquery.com/<acronym title='Cascading Style Sheets'><span class='caps'>CSS</span></acronym>/css#properties">pass in a set of properties in an object</a>.</p>
<div class="igBar"><span id="lcode-30"><a href="#" onclick="javascript:showCodeTxt('code-30'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-30">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"div.highlight"</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="">css</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; color:<span style="color:#CC0000;">"yellow"</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; background-color:<span style="color:#CC0000;">"black"</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; width:<span style="color:#CC0000;">"50px"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>3) Comment your code.</p>
<div class="igBar"><span id="lcode-31"><a href="#" onclick="javascript:showCodeTxt('code-31'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-31">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// get all the Divs with the highlight class and</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// format them and set their width</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">var Divs = $<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"div.highlight"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Divs.<span style="">css</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"color"</span>, <span style="color:#CC0000;">"yellow"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Divs.<span style="">css</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"background-color"</span>, <span style="color:#CC0000;">"black"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Divs.<span style="">css</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"width"</span>, <span style="color:#CC0000;">"30px"</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>I like this <a href="http://www.codinghorror.com/blog/archives/001150.html">explanation</a> by Jeff Atwood best. If you need comments to explain WHAT your code is doing, you need to use better names and/or write better code. Comments are best when used sparingly and explain the WHY of the code. Why did you choose to use a particular algorithm</p>



Share and Enjoy:


	<a rel="nofollow"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F05%2F12%2Fwhy-these-jquery-worst-practices-arent%2F&amp;title=Why%20these%20jQuery%20worst%20practices%20aren%27t.&amp;notes=jQuery%20...%20Worst%20Practices%0D%0A%0D%0AIn%20this%20post%2C%20Steve%20Wellens%20tries%20to%20make%20the%20case%20for%20two%20common%20patterns%20your%20run%20across%20when%20using%20jQuery%20as%20%22worst%20practices%22.%20Practices%20that%20are%20either%20superfluous%20or%20harmful%20to%20your%20code.%0D%0A%0D%0A1%29%20Wiring%20up%20events%20usi" title="del.icio.us"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F05%2F12%2Fwhy-these-jquery-worst-practices-arent%2F&amp;title=Why%20these%20jQuery%20worst%20practices%20aren%27t." title="DotNetKicks"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F05%2F12%2Fwhy-these-jquery-worst-practices-arent%2F&amp;title=Why%20these%20jQuery%20worst%20practices%20aren%27t." title="DZone"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/dzone.png" title="DZone" alt="DZone" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://reddit.com/submit?url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F05%2F12%2Fwhy-these-jquery-worst-practices-arent%2F&amp;title=Why%20these%20jQuery%20worst%20practices%20aren%27t." title="Reddit"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F05%2F12%2Fwhy-these-jquery-worst-practices-arent%2F&amp;title=Why%20these%20jQuery%20worst%20practices%20aren%27t.&amp;bodytext=jQuery%20...%20Worst%20Practices%0D%0A%0D%0AIn%20this%20post%2C%20Steve%20Wellens%20tries%20to%20make%20the%20case%20for%20two%20common%20patterns%20your%20run%20across%20when%20using%20jQuery%20as%20%22worst%20practices%22.%20Practices%20that%20are%20either%20superfluous%20or%20harmful%20to%20your%20code.%0D%0A%0D%0A1%29%20Wiring%20up%20events%20usi" title="Digg"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F05%2F12%2Fwhy-these-jquery-worst-practices-arent%2F&amp;title=Why%20these%20jQuery%20worst%20practices%20aren%27t." title="StumbleUpon"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F05%2F12%2Fwhy-these-jquery-worst-practices-arent%2F&amp;title=Why%20these%20jQuery%20worst%20practices%20aren%27t.&amp;source=Lazycoder+&amp;summary=jQuery%20...%20Worst%20Practices%0D%0A%0D%0AIn%20this%20post%2C%20Steve%20Wellens%20tries%20to%20make%20the%20case%20for%20two%20common%20patterns%20your%20run%20across%20when%20using%20jQuery%20as%20%22worst%20practices%22.%20Practices%20that%20are%20either%20superfluous%20or%20harmful%20to%20your%20code.%0D%0A%0D%0A1%29%20Wiring%20up%20events%20usi" title="LinkedIn"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F05%2F12%2Fwhy-these-jquery-worst-practices-arent%2F&amp;t=Why%20these%20jQuery%20worst%20practices%20aren%27t." title="Facebook"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.friendfeed.com/share?title=Why%20these%20jQuery%20worst%20practices%20aren%27t.&amp;link=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F05%2F12%2Fwhy-these-jquery-worst-practices-arent%2F" title="FriendFeed"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/friendfeed.png" title="FriendFeed" alt="FriendFeed" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://news.ycombinator.com/submitlink?u=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F05%2F12%2Fwhy-these-jquery-worst-practices-arent%2F&amp;t=Why%20these%20jQuery%20worst%20practices%20aren%27t." title="HackerNews"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/hackernews.png" title="HackerNews" alt="HackerNews" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.netvibes.com/share?title=Why%20these%20jQuery%20worst%20practices%20aren%27t.&amp;url=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F05%2F12%2Fwhy-these-jquery-worst-practices-arent%2F" title="Netvibes"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://posterous.com/share?linkto=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F05%2F12%2Fwhy-these-jquery-worst-practices-arent%2F&amp;title=Why%20these%20jQuery%20worst%20practices%20aren%27t.&amp;selection=jQuery%20...%20Worst%20Practices%0D%0A%0D%0AIn%20this%20post%2C%20Steve%20Wellens%20tries%20to%20make%20the%20case%20for%20two%20common%20patterns%20your%20run%20across%20when%20using%20jQuery%20as%20%22worst%20practices%22.%20Practices%20that%20are%20either%20superfluous%20or%20harmful%20to%20your%20code.%0D%0A%0D%0A1%29%20Wiring%20up%20events%20usi" title="Posterous"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/posterous.png" title="Posterous" alt="Posterous" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://www.tumblr.com/share?v=3&amp;u=http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F05%2F12%2Fwhy-these-jquery-worst-practices-arent%2F&amp;t=Why%20these%20jQuery%20worst%20practices%20aren%27t.&amp;s=jQuery%20...%20Worst%20Practices%0D%0A%0D%0AIn%20this%20post%2C%20Steve%20Wellens%20tries%20to%20make%20the%20case%20for%20two%20common%20patterns%20your%20run%20across%20when%20using%20jQuery%20as%20%22worst%20practices%22.%20Practices%20that%20are%20either%20superfluous%20or%20harmful%20to%20your%20code.%0D%0A%0D%0A1%29%20Wiring%20up%20events%20usi" title="Tumblr"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/tumblr.png" title="Tumblr" alt="Tumblr" class="sociable-hovers" /></a>
	<a rel="nofollow"  href="http://twitter.com/home?status=Why%20these%20jQuery%20worst%20practices%20aren%27t.%20-%20http%3A%2F%2Fwww.lazycoder.com%2Fweblog%2F2009%2F05%2F12%2Fwhy-these-jquery-worst-practices-arent%2F" title="Twitter"><img src="http://www.lazycoder.com/weblog/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://www.lazycoder.com/weblog/2009/05/12/why-these-jquery-worst-practices-arent/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
