<?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>Dodgeball Cannon &#187; Javascript</title>
	<atom:link href="http://www.johntantalo.com/blog/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.johntantalo.com/blog</link>
	<description>It's not so much a time machine as it is my blog.</description>
	<lastBuildDate>Thu, 05 Aug 2010 17:40:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>IE6 submit-click on text input submit</title>
		<link>http://www.johntantalo.com/blog/ie6-submit-click-on-text-input-submit/</link>
		<comments>http://www.johntantalo.com/blog/ie6-submit-click-on-text-input-submit/#comments</comments>
		<pubDate>Fri, 26 Sep 2008 23:15:44 +0000</pubDate>
		<dc:creator>John Tantalo</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[IE6]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.johntantalo.com/blog/?p=32</guid>
		<description><![CDATA[Found this fun bug in IE6 today. If you have a text input and submit input unassociated with a form, then submitting the text input (by hitting return or enter when focused) will cause a click event on the submit input.
The solution is simple and intuitive: eliminate unassociated submit inputs and submit buttons.

&#60;!DOCTYPE html PUBLIC [...]]]></description>
			<content:encoded><![CDATA[<p>Found this fun bug in IE6 today. If you have a text input and submit input unassociated with a form, then submitting the text input (by hitting return or enter when focused) will cause a click event on the submit input.</p>
<p>The solution is simple and intuitive: eliminate unassociated submit inputs and submit buttons.</p>
<p><code>
<pre>&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot;
&quot;http://www.w3.org/TR/html4/DTD/strict.dtd&quot;&gt;
&lt;input type=&quot;text&quot;/&gt;
&lt;input type=&quot;submit&quot; onclick=&quot;this.value='clicked';&quot; /&gt;</pre>
<p></code></p>
<p><a href="http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20HTML%204.01%2F%2FEN%22%0D%0A%22http%3A%2F%2Fwww.w3.org%2FTR%2Fhtml4%2FDTD%2Fstrict.dtd%22%3E%0D%0A%3Cinput%20type%3D%22text%22%2F%3E%0D%0A%3Cinput%20type%3D%22submit%22%20onclick%3D%22this.value%3D'clicked'%3B%22%20%2F%3E">Demo (IE only)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johntantalo.com/blog/ie6-submit-click-on-text-input-submit/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Custom Wikipedia CSS &amp; Javascript for iPhone</title>
		<link>http://www.johntantalo.com/blog/custom-wikipedia-css-javascript-for-iphone/</link>
		<comments>http://www.johntantalo.com/blog/custom-wikipedia-css-javascript-for-iphone/#comments</comments>
		<pubDate>Sat, 02 Aug 2008 23:09:45 +0000</pubDate>
		<dc:creator>John Tantalo</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Wikipedia]]></category>

		<guid isPermaLink="false">http://www.johntantalo.com/blog/?p=23</guid>
		<description><![CDATA[This afternoon I made a custom stylesheet and script to format Wikipedia nicely for me when I am logged on from my iPhone. If you have a Wikipedia account, you can easily use them by adding them to your own monobook.css and monobook.js. Screenshots below.


]]></description>
			<content:encoded><![CDATA[<p>This afternoon I made a custom <a href="http://en.wikipedia.org/wiki/User:Beefyt/monobook.css">stylesheet</a> and <a href="http://en.wikipedia.org/wiki/User:Beefyt/monobook.js">script</a> to format Wikipedia nicely for me when I am logged on from my iPhone. If you have a Wikipedia account, you can easily use them by adding them to your own <a href="http://en.wikipedia.org/wiki/Special:MyPage/monobook.css">monobook.css</a> and <a href="http://en.wikipedia.org/wiki/Special:MyPage/monobook.js">monobook.js</a>. Screenshots below.</p>
<p><a href='http://www.johntantalo.com/blog/wp-content/uploads/2008/08/portrait.png'><img src="http://www.johntantalo.com/blog/wp-content/uploads/2008/08/portrait.png" alt="" title="portrait" width="320" height="480" class="aligncenter size-full wp-image-22" /></a></p>
<p><a href='http://www.johntantalo.com/blog/wp-content/uploads/2008/08/landscape.png'><img src="http://www.johntantalo.com/blog/wp-content/uploads/2008/08/landscape.png" alt="" title="landscape" width="480" height="320" class="aligncenter size-full wp-image-21" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.johntantalo.com/blog/custom-wikipedia-css-javascript-for-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dangers of anonymous function closures</title>
		<link>http://www.johntantalo.com/blog/dangers-of-anonymous-function-closures/</link>
		<comments>http://www.johntantalo.com/blog/dangers-of-anonymous-function-closures/#comments</comments>
		<pubDate>Mon, 07 Apr 2008 19:43:57 +0000</pubDate>
		<dc:creator>John Tantalo</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.johntantalo.com/blog/?p=17</guid>
		<description><![CDATA[pre {font-size: 1.5em}
John Resig&#8217;s jQuery uses a standard technique of anonymous function closures to namespace its internal functionality.
(function(){
  // jQuery stuff goes here...
})();

This is all well and good until you want to inline this code under some of your application code, as I did while working on Eventful&#8217;s MySpace application. Consider this example, written [...]]]></description>
			<content:encoded><![CDATA[<style type="text/css">pre {font-size: 1.5em}</style>
<p>John Resig&#8217;s <a target="_blank" href="http://jquery.com/">jQuery</a> uses a standard technique of anonymous function closures to namespace its internal functionality.</p>
<blockquote><pre><code>(function(){
  // jQuery stuff goes here...
})();</code></pre>
</blockquote>
<p>This is all well and good until you want to inline this code under some of your application code, as I did while working on <a target="_blank" href="http://www.myspace.com/topperformers">Eventful&#8217;s MySpace application</a>. Consider this example, written in standard Javascript style.</p>
<blockquote><pre><code>var foo = function(bar) {
  console.log("foo");
  return bar;
}

(function(){
  console.log("bar")
})();</code></pre>
</blockquote>
<p>What do you expect this code to print? If you say &#8220;bar&#8221;, you&#8217;re wrong. It prints &#8220;foo bar&#8221; because in this context the anonymous function closure becomes a call to the function that prints &#8220;foo&#8221; and returns the function that prints &#8220;bar&#8221;, which is then called.</p>
<p>Most of us probably wouldn&#8217;t notice what just happened because we are so used to Javascript interpreters automatically inserting semicolons after function definitions.</p>
<p>The danger is assuming, as John Resig and hundreds others have, that your anonymous function closure is the first token in a new line. In my case, it wasn&#8217;t. The solution? Either start meticulously sprinkling semicolons in your application code, or just add a single semicolon before your parenthetical block, guaranteeing it&#8217;s the first token in the line.</p>
<blockquote><pre><code>;(function(){
  // jQuery stuff goes here...
})();
</code></pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.johntantalo.com/blog/dangers-of-anonymous-function-closures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
