<?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>Travis Miller &#187; AJAX &amp; JavaScript</title>
	<atom:link href="http://www.electrumdigital.com/category/ajax-javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.electrumdigital.com</link>
	<description>Web Developer for Hire</description>
	<lastBuildDate>Mon, 28 Mar 2011 20:03:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>The module pattern in JavaScript</title>
		<link>http://www.electrumdigital.com/2011/01/the-module-pattern-in-javascript/</link>
		<comments>http://www.electrumdigital.com/2011/01/the-module-pattern-in-javascript/#comments</comments>
		<pubDate>Tue, 04 Jan 2011 20:58:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AJAX & JavaScript]]></category>
		<category><![CDATA[client-side technologies]]></category>
		<category><![CDATA[design patterns]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.electrumdigital.com/?p=420</guid>
		<description><![CDATA[Ben Cherry of Adequately Good explains JavaScript's module pattern. This pattern is everywhere in modern JavaScript codebases, and Ben does a great job of explaining it clearly and concisely.]]></description>
			<content:encoded><![CDATA[<p>Ben Cherry of Adequately Good <a href="http://www.adequatelygood.com/2010/3/JavaScript-Module-Pattern-In-Depth">explains JavaScript's module pattern</a>. This pattern is everywhere in modern JavaScript codebases, and Ben does a great job of explaining it clearly and concisely.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.electrumdigital.com/2011/01/the-module-pattern-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Peter Michaux</title>
		<link>http://www.electrumdigital.com/2010/07/peter-michaux/</link>
		<comments>http://www.electrumdigital.com/2010/07/peter-michaux/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 23:31:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AJAX & JavaScript]]></category>
		<category><![CDATA[design patterns]]></category>

		<guid isPermaLink="false">http://www.electrumdigital.com/?p=366</guid>
		<description><![CDATA[Douglas Crockford's articles on JavaScript (and his posts at the Yahoo! User Interface Blog) have helped me greatly to understand the more exotic and subtle features of the language, along with the patterns that exploit those features. Now I've discovered a similar collection of articles by Peter Michaux. They often riff on Crockford's ideas, sometimes [...]]]></description>
			<content:encoded><![CDATA[<p>Douglas Crockford's <a href="http://javascript.crockford.com/">articles on JavaScript</a> (and his posts at <a href="http://www.yuiblog.com/blog/">the Yahoo! User Interface Blog</a>) have helped me greatly to understand the more exotic and subtle features of the language, along with the patterns that exploit those features.</p>
<p>Now I've discovered <a href="http://peter.michaux.ca/">a similar collection of articles by Peter Michaux</a>. They often riff on Crockford's ideas, sometimes offering a fresh perspective and sometimes explaining things in a more accessible way. Well worth a read for aspiring JavaScript ninjas.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.electrumdigital.com/2010/07/peter-michaux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simulating HTML5&#039;s placeholder attribute with jQuery</title>
		<link>http://www.electrumdigital.com/2009/10/simulating-html5s-placeholder-attribute-with-jquery/</link>
		<comments>http://www.electrumdigital.com/2009/10/simulating-html5s-placeholder-attribute-with-jquery/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 20:51:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AJAX & JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[placeholder]]></category>

		<guid isPermaLink="false">http://www.electrumdigital.com/?p=191</guid>
		<description><![CDATA[I recently discussed the placeholder attribute in HTML5. Today, I needed exactly such a behavior for a site I'm working on, so I knocked together a reusable, unobtrusive solution with jQuery. Simply include this code (and jQuery, of course) on your page, and assign the placeholder text as the title attribute of the control. Example: [...]]]></description>
			<content:encoded><![CDATA[<p>I recently <a href="http://www.electrumdigital.com/2009/10/forms-in-html5/">discussed</a> the <code class="html">placeholder</code> attribute in <acronym title="HyperText Markup Language">HTML</acronym>5. Today, I needed exactly such a behavior for a site I'm working on, so I knocked together a reusable, unobtrusive solution with jQuery.</p>
<p><span id="more-191"></span></p>
<p>Simply include this code (and jQuery, of course) on your page, and assign the placeholder text as the <code class="html">title</code> attribute of the control. Example:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;keywords&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Search&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></pre></div></div>

<p>The script also assigns the class <code class="css">placeholder</code> to the control when the placeholder text is present, so you can style it differently if you like (for example, you may wish to gray out the text).</p>
<p>The code:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">/**
 * Unobtrusively set up placeholder behaviors on all text inputs for which
 * the title attribute has been set. The title text will be used as the
 * placeholder text.
 * @author Travis Miller
 * @link http://www.electrumdigital.com/
 */</span>
$<span style="color: #009900;">&#40;</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;input[type=text][title],textarea[title]&quot;</span><span style="color: #009900;">&#41;</span>
        .<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span> showPlaceholder <span style="color: #009900;">&#41;</span> <span style="color: #006600; font-style: italic;">// initialize each control on page load</span>
        .<span style="color: #000066;">blur</span><span style="color: #009900;">&#40;</span> showPlaceholder <span style="color: #009900;">&#41;</span>
        .<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span> hidePlaceholder <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;form&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">submit</span><span style="color: #009900;">&#40;</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    	$<span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;input[type=text][title],textarea[title]&quot;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span> <span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span> hidePlaceholder <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #003366; font-weight: bold;">function</span> showPlaceholder<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    	<span style="color: #003366; font-weight: bold;">var</span> $control <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #003366; font-weight: bold;">var</span> placeholderText <span style="color: #339933;">=</span> $control.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;title&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> $control.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #3366CC;">&quot;&quot;</span> <span style="color: #339933;">||</span> $control.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> placeholderText <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        	$control.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;placeholder&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            $control.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span>placeholderText<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #003366; font-weight: bold;">function</span> hidePlaceholder<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    	<span style="color: #003366; font-weight: bold;">var</span> $control <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> $control.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> $control.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;title&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        	$control.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;placeholder&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        	$control.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.electrumdigital.com/2009/10/simulating-html5s-placeholder-attribute-with-jquery/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>target=&quot;_blank&quot; for XHTML Strict</title>
		<link>http://www.electrumdigital.com/2009/09/target_blank-for-xhtml-strict/</link>
		<comments>http://www.electrumdigital.com/2009/09/target_blank-for-xhtml-strict/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 16:35:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AJAX & JavaScript]]></category>
		<category><![CDATA[client-side technologies]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.electrumdigital.com/?p=100</guid>
		<description><![CDATA[For better or for worse, it's a widespread convention for offsite links to open in a new window. This is usually achieved by setting the attribute target="_blank" on the link in question. Of course, the target attribute is illegal in XHTML Strict&#8212;so this bit of functionality of will invalidate your pages. I whipped up a [...]]]></description>
			<content:encoded><![CDATA[<p>For better or for worse, it's a widespread convention for offsite links to open in a new window. This is usually achieved by setting the attribute <code class="html">target="_blank"</code> on the link in question.</p>
<p>Of course, the <code class="html">target</code> attribute is illegal in <acronym title="eXtensible HyperText Markup Language">XHTML</acronym> Strict&#8212;so this bit of functionality of will invalidate your pages.</p>
<p>I whipped up a simple fix to this problem. <a href="/source/js/target-blank/">Here</a>'s the demo and download page.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.electrumdigital.com/2009/09/target_blank-for-xhtml-strict/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Three essential Firefox extensions for web developers</title>
		<link>http://www.electrumdigital.com/2009/08/three-essential-firefox-extensions-for-web-developers/</link>
		<comments>http://www.electrumdigital.com/2009/08/three-essential-firefox-extensions-for-web-developers/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 23:02:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AJAX & JavaScript]]></category>
		<category><![CDATA[Browser Issues]]></category>
		<category><![CDATA[Firefox]]></category>

		<guid isPermaLink="false">http://www.electrumdigital.com/?p=93</guid>
		<description><![CDATA[Firefox is beloved by web developers for its compliance with W3C standards, its open-source nature, and its general awesomeness. But its vast library of genuinely useful extensions and Greasemonkey scripts is surely a big part of the attraction, too. Here are three that I couldn't live without. You probably already know about the Web Developer [...]]]></description>
			<content:encoded><![CDATA[<p>Firefox is beloved by web developers for its compliance with <acronym title="World Wide Web Consortium">W3C</acronym> standards, its open-source nature, and its general awesomeness. But its vast library of genuinely useful extensions and Greasemonkey scripts is surely a big part of the attraction, too. Here are three that I couldn't live without.</p>
<p><span id="more-93"></span></p>
<ul>
<li>You probably already know about the <a href="https://addons.mozilla.org/en-US/firefox/addon/60">Web Developer Toolbar</a>, but if you don't, trust me&#8212;go download it <em>now</em>.</p>
<p>Its most valuable feature is the ability to view the generated source of a page&#8212;that is, to see the HTML as it exists at the <em>current moment</em>, including any changes that have been made via JavaScript. It's absolutely indispensible for any kind of <acronym title="Asynchronous JavaScript and XML">AJAX</acronym>-ish work.</p>
<p>It can do a lot more than that, though&#8212;with a couple of clicks, you can validate documents, see what your page looks like at different resolutions, quickly view or delete cookies from only the current domain or path, view overlays which reveal various aspects of the document (such as the names of form fields or information about links), disable images or <acronym title="Cascading Style Sheets">CSS</acronym>, autopopulate forms to accelerate testing, and much more.</p>
</li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/2076">JSView</a>. How many times have you needed to view the stylesheets or JavaScript files that are used on a page&#8212;and had to hunt through the page source for the filenames, so you could cobble them together to get a complete <acronym title="Uniform Resource Locator">URL</acronym>?
<p>JSView adds a submenu to the context menu which lists all stylesheets and JavaScript files linked to a page, along with the file sizes. Selecting a file from the menu will display the source in a new window. What JavaScript library are they using on that page? How did they get that effect with <acronym title="Cascading Style Sheets">CSS</acronym>? JSView makes it easier than ever to find out.
</li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/3829">Live <acronym title="HyperText Transfer Protocol">HTTP</acronym> Headers</a>. Very handy when you want to see exactly what the browser and the server are saying to each other&#8212;complete with <acronym title="HyperText Transfer Protocol">HTTP</acronym> status codes, POST data, and request and response headers.
<p>It's helped me to diagnose obscure bugs, to understand the workings of third-party web applications (such as when working with Microsoft products, which tend to freak out if the headers aren't set exactly as expected), to discover the <acronym title="Uniform Resource Locator">URL</acronym>s of embedded media files so I can download them (even on sites which obfuscate the <acronym title="Uniform Resource Locator">URL</acronym>s through various means), and more.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.electrumdigital.com/2009/08/three-essential-firefox-extensions-for-web-developers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Styling horizontal rules in Internet Explorer 6 &amp; 7</title>
		<link>http://www.electrumdigital.com/2009/07/styling-horizontal-rules-in-internet-explorer-6-7/</link>
		<comments>http://www.electrumdigital.com/2009/07/styling-horizontal-rules-in-internet-explorer-6-7/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 00:48:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AJAX & JavaScript]]></category>
		<category><![CDATA[Browser Issues]]></category>
		<category><![CDATA[horizontal rules]]></category>
		<category><![CDATA[internet explorer]]></category>

		<guid isPermaLink="false">http://www.electrumdigital.com/?p=81</guid>
		<description><![CDATA[Scott Klarr has a nice post about the difficulties of styling horizontal rules with CSS&#8212;owing mainly, of course, to problems in Internet Explorer. In short, IE 6 and 7 insist on putting a border around horizontal rules, no matter how you set up your stylesheet. Scott offers a simple but elegant solution which relies on [...]]]></description>
			<content:encoded><![CDATA[<p>Scott Klarr has <a href="http://www.scottklarr.com/topic/483/how-to-style-hr-elements-with-decorative-horizontal-rules/">a nice post</a> about the difficulties of styling horizontal rules with <acronym title="Cascading Style Sheets">CSS</acronym>&#8212;owing mainly, of course, to problems in Internet Explorer.</p>
<p>In short, <acronym title="Internet Explorer">IE</acronym> 6 and 7 insist on putting a border around horizontal rules, no matter how you set up your stylesheet.</p>
<p>Scott offers a simple but elegant solution which relies on jQuery. That's fine if you're already using jQuery in your project, but if you're not, it's hard to justify the extra payload to fix a simple cosmetic issue.</p>
<p>I've written a standalone version of Scott's script. At less than 350 bytes, it's a very lightweight solution, and it's easy to implement. Here's <a href="/source/js/ie-hr-fix/">a demo page</a>. As Scott's post explains, it simply replaces all <code class="html">&lt;hr /&gt;</code> elements with <code class="html">&lt;div class="iehrfix"&gt;&lt;/div&gt;</code> in the affected versions of <acronym title="Internet Explorer">IE</acronym>.</p>
<p><span id="more-81"></span></p>
<p>Instructions:
<ol>
<li>Mark up your pages with semantically correct &lt;hr /&gt; tags.</li>
<li>Style the horizontal rules however you like in your default stylesheet. (You'll probably be using a background image.)</li>
<li>Prepare a second stylesheet, which we'll feed only to <acronym title="Internet Explorer">IE</acronym> by using <a href="http://www.quirksmode.org/css/condcom.html">conditional comments</a>. It should contain two rules: one which sets <code class="css">display: none;</code> on all <code class="html">&lt;hr /&gt;</code> elements, and one which describes alternate rules for <code class="css">div.iehrfix</code>. You can use <a href="/source/js/ie-hr-fix/iehrfix.css">the demo stylesheet</a> as a starting point.</li>
<li><a href="/source/js/ie-hr-fix/iehrfix.js">Download iehrfix.js</a>.</li>
<li>Place the following code in the <code class="html">&lt;head&gt;</code> of your document:

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!--[if(IE 6)|(IE 7)]&gt;</span>
<span style="color: #808080; font-style: italic;">    &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/path/to/iehrfix.css&quot; /&gt;</span>
<span style="color: #808080; font-style: italic;">    &lt;script type=&quot;text/javascript&quot; src=&quot;/path/to/iehrfix.js&quot;&gt;&lt;/script&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;![endif]--&gt;</span></pre></div></div>

</li>
</ol>
<p>That's it! Browsers other than <acronym title="Internet Explorer">IE</acronym> 6 and 7 will completely ignore the added code. <acronym title="Internet Explorer">IE</acronym> 6 and 7 will execute it on page load; if JavaScript is disabled, <code class="html">&lt;hr /&gt;</code> elements will simply be hidden altogether. (IE 8 handles horizontal rules correctly, and doesn't need the fix.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.electrumdigital.com/2009/07/styling-horizontal-rules-in-internet-explorer-6-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A comprehensive JavaScript pad function</title>
		<link>http://www.electrumdigital.com/2009/06/a-comprehensive-javascript-pad-function/</link>
		<comments>http://www.electrumdigital.com/2009/06/a-comprehensive-javascript-pad-function/#comments</comments>
		<pubDate>Sun, 28 Jun 2009 18:25:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AJAX & JavaScript]]></category>

		<guid isPermaLink="false">http://www.electrumdigital.com/?p=62</guid>
		<description><![CDATA[I wanted a JavaScript function for padding strings, but I couldn't find one that met my criteria. So, I wrote my own. Minified (850 bytes) Uncompressed It behaves identically to PHP's str_pad() function, and has been unit tested in Firefox 3, Safari 3, Chrome, IE6, and IE7. It's optimized for speed, not readability. (It processes [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted a JavaScript function for padding strings, but I couldn't find one that met my criteria. So, I wrote my own.</p>
<ul>
<li><a href="/source/js/snippets/String.prototype.pad.min.js">Minified</a> (850 bytes)</li>
<li><a href="/source/js/snippets/String.prototype.pad.js">Uncompressed</a></li>
</ul>
<p>It behaves identically to PHP's <a href="http://php.net/str_pad">str_pad()</a> function, and has been unit tested in Firefox 3, Safari 3, Chrome, <abbr title="Internet Explorer 6">IE6</abbr>, and <abbr title="Internet Explorer 7">IE7</abbr>.<br />
<span id="more-62"></span><br />
It's optimized for speed, not readability. (It processes 500 sets of randomly generated parameters in less than 50<abbr title="milliseconds">ms</abbr> in all of the above-listed browsers on my 3.0<abbr title="gigahertz">GHz</abbr> Pentium 4, and less than 100<abbr title="milliseconds">ms</abbr> in <abbr title="Internet Explorer 6">IE6</abbr> on my aging Toshiba notebook.)</p>
<p>Syntax:</p>
<p><code class="js">foo.pad( padLength [, padString = " " [, padType = "right" ] ] );</code></p>
<p>...where <code class="js">foo</code> is any String object.</p>
<p><code class="js">padType</code> must be one of "left", "right", or "both". Otherwise, the parameters are identical to those for <a href="http://php.net/str_pad">str_pad()</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.electrumdigital.com/2009/06/a-comprehensive-javascript-pad-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript Standard Library 1.8+</title>
		<link>http://www.electrumdigital.com/2009/06/javascript-standard-library-1-8/</link>
		<comments>http://www.electrumdigital.com/2009/06/javascript-standard-library-1-8/#comments</comments>
		<pubDate>Sat, 27 Jun 2009 23:50:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AJAX & JavaScript]]></category>
		<category><![CDATA[client-side technologies]]></category>
		<category><![CDATA[code library]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JavaScript 1.6]]></category>
		<category><![CDATA[legacy browser support]]></category>

		<guid isPermaLink="false">http://www.electrumdigital.com/?p=55</guid>
		<description><![CDATA[I just came across Andrea Giammarchi's JavaScript Standard Library, a &#8776;2.7KB library which transparently adds JavaScript 1.6 methods (mostly the new Array stuff) to browsers which don't support them natively. Surprisingly, this is the first library I've seen whose sole purpose is JavaScript version compatibility. Andrea says it provides "a quite totally standard environment", and [...]]]></description>
			<content:encoded><![CDATA[<p>I just came across Andrea Giammarchi's <a href="http://www.3site.eu/JSL/">JavaScript Standard Library</a>, a &#8776;2.7<abbr title="kilobytes">KB</abbr> library which transparently adds JavaScript 1.6 methods (mostly <a href="https://developer.mozilla.org/en/New_in_JavaScript_1.6#Array_extras">the new <code class="js">Array</code> stuff</a>) to browsers which don't support them natively.</p>
<p>Surprisingly, this is the first library I've seen whose sole purpose is JavaScript version compatibility. Andrea says it provides "<a href="http://webreflection.blogspot.com/2007/11/quite-totally-standard-enviroment.html">a quite totally standard environment</a>", and offers some <a href="http://www.3site.eu/JSL/JSL.html">unit tests</a>.<br />
<span id="more-55"></span><br />
I haven't used it yet, but it's a cool idea.</p>
<p>Note that JSL does <em>not</em> include the JavaScript 1.8 methods <code class="js">Array.reduce()</code> and <code class="js">Array.reduceRight()</code>. If you need those, try the compatibility code offered by Mozilla, <a href="https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Global_Objects/Array/Reduce#Compatibility">here</a> and <a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduceRight#Compatibility">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.electrumdigital.com/2009/06/javascript-standard-library-1-8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

