<?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/"
		xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
	xmlns:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>Brad Collins &#187; Tech</title>
	<atom:link href="http://bradcollins.com/category/tech/feed/" rel="self" type="application/rss+xml" />
	<link>http://bradcollins.com</link>
	<description>Religion, Politics, Tech, Language, Life</description>
	<lastBuildDate>Sat, 07 Jan 2012 23:28:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<copyright>Copyright &#xA9; Brad Collins 2011 </copyright>
	<managingEditor>brad@collins.name (Brad Collins)</managingEditor>
	<webMaster>brad@collins.name (Brad Collins)</webMaster>
	<image>
		<url>http://bradcollins.com/wp-content/plugins/podpress/images/powered_by_podpress.jpg</url>
		<title>Brad Collins</title>
		<link>http://bradcollins.com</link>
		<width>144</width>
		<height>144</height>
	</image>
	<itunes:subtitle></itunes:subtitle>
	<itunes:summary>Religion, Politics, Tech, Language, Life</itunes:summary>
	<itunes:keywords></itunes:keywords>
	<itunes:category text="Society &#38; Culture" />
	<itunes:author>Brad Collins</itunes:author>
	<itunes:owner>
		<itunes:name>Brad Collins</itunes:name>
		<itunes:email>brad@collins.name</itunes:email>
	</itunes:owner>
	<itunes:block>no</itunes:block>
	<itunes:explicit>no</itunes:explicit>
	<itunes:image href="http://bradcollins.com/wp-content/plugins/podpress/images/powered_by_podpress_large.jpg" />
		<item>
		<title>Enumerate, Iterate, Pretty Kate, &#8230;</title>
		<link>http://bradcollins.com/2011/10/26/enumerate-iterate-pretty-kate/</link>
		<comments>http://bradcollins.com/2011/10/26/enumerate-iterate-pretty-kate/#comments</comments>
		<pubDate>Wed, 26 Oct 2011 13:59:49 +0000</pubDate>
		<dc:creator>Brad</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[enumeration]]></category>
		<category><![CDATA[iterator]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://bradcollins.com/?p=202</guid>
		<description><![CDATA[Ever wanted to iterate over some objects using Java's for each syntax, but the only interface exposed is an Enumeration? I have. And there's already a way available out of the box. <a href="http://bradcollins.com/2011/10/26/enumerate-iterate-pretty-kate/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Ever wanted to iterate over some objects using Java&#8217;s <code>for each</code> syntax, but the only interface exposed is an Enumeration? I have.</p>
<p>There&#8217;s an exercise in the <a href="http://www.amazon.com/First-Design-Patterns-Elisabeth-Freeman/dp/0596007124"><cite>Head First Design Patterns</cite></a> book that adapts an <a title="Java's Enumeration interface" href="http://download.oracle.com/javase/7/docs/api/java/util/Enumeration.html"><code>Enumeration</code></a> to the <a title="Java's Iterable interface" href="http://download.oracle.com/javase/7/docs/api/java/lang/Iterable.html"><code>Iterable</code></a> interface. Pretty nifty, so I coded it up and used it in some code at work. Works great!</p>
<p>But then I found this: the <a title="The list() method of Java's Collections class" href="http://download.oracle.com/javase/7/docs/api/java/util/Collections.html#list%28java.util.Enumeration%29"><code>list()</code></a> method of the <a title="Java's Collections class" href="http://download.oracle.com/javase/7/docs/api/java/util/Collections.html"><code>Collections</code></a> class. It stuffs all the items in an <code>Enumeration</code> into a <a title="Java's List interface" href="http://download.oracle.com/javase/7/docs/api/java/util/List.html"><code>List</code></a>. And it&#8217;s been there since Java 1.4! Where in the world have I been?</p>
<p>Anyway, the upshot is that instead of having to use this old drivel</p>
<pre><code>Enumeration&lt;Nargle&gt; nargles = Nargle.getNargles();
while (nargles.hasMoreElements()) {
  Nargle nargle = nargles.nextElement();
  // do something with nargle
}</code></pre>
<p>You can do this</p>
<pre><code>for (Nargle nargle : Collections.list(Nargle.getNargles())) {
  // do something with nargle
}</code></pre>
<p>Yes, that is a sight better.</p>
]]></content:encoded>
			<wfw:commentRss>http://bradcollins.com/2011/10/26/enumerate-iterate-pretty-kate/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Webkit Disrespects My Personal Whitespace</title>
		<link>http://bradcollins.com/2010/12/04/webkit-disrespects-my-personal-whitespace/</link>
		<comments>http://bradcollins.com/2010/12/04/webkit-disrespects-my-personal-whitespace/#comments</comments>
		<pubDate>Sat, 04 Dec 2010 17:30:34 +0000</pubDate>
		<dc:creator>Brad</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[Chrome]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[Safari]]></category>
		<category><![CDATA[W3C]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Webkit]]></category>

		<guid isPermaLink="false">http://bradcollins.com/?p=172</guid>
		<description><![CDATA[I&#8217;ve been trying to put some of CSS3&#8242;s nth-* selectors to use in a site I&#8217;m working on right now, and I&#8217;ve run into a problem. I&#8217;m testing my markup and styles in Safari 5 (before moving on to other &#8230; <a href="http://bradcollins.com/2010/12/04/webkit-disrespects-my-personal-whitespace/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been trying to put some of CSS3&#8242;s <code>nth-*</code> selectors to use in a site I&#8217;m working on right now, and I&#8217;ve run into a problem. I&#8217;m testing my markup and styles in Safari 5 (before moving on to other browsers), and I am trying to style child elements 3, 7, 11, etc. So I write this rule:</p>
<pre><code>p:nth-of-type(4n - 1) { … }</code></pre>
<p>That should work, right? After all, 4(1) − 1 = 3; 4(2) − 1 = 7; 4(3) − 1 = 11.</p>
<p>Well I open up Safari, and my changes haven&#8217;t taken. OK. How about a different but equivalent equation?</p>
<pre><code>p:nth-of-type(4n + 3) { … }</code></pre>
<p>Again, pretty simple: 4(0) + 3 = 3; 4(1) + 3 = 7; 4(2) + 3 = 11. The last one hasn&#8217;t taken, for whatever reason, but this one&#8217;s right on.</p>
<p>Still nothing.</p>
<p>I begin to doubt my math skills. I&#8217;ve been doing software of one type or another for 15 years, but my bachelor&#8217;s degree is in electrical engineering. I had to take four calculus classes, linear algebra, and differential equations. OK, I haven&#8217;t used most of that in years, but <code>a<var>n</var> + b</code> is <em>simple</em> algebra—stuff I&#8217;ve been doing for over 20 years. I <em>know</em> simple algebra.</p>
<p>I decide to fire up Firefox (version 3.6.12). Lo and behold, there is the formatting I&#8217;ve been trying desperately to get to show up. Firefox gets it (so does Opera, for the record), but Safari doesn&#8217;t (neither does Chrome). Evidently we have a Webkit bug.</p>
<p>For grins, even though it won&#8217;t get me where I want to go, I try this:</p>
<pre><code>p:nth-of-type(4n) { … }</code></pre>
<p>The formatting appears correctly in both Firefox and Safari! Therefore Webkit does understand <code>nth-of-type</code>, but something about <code>a<var>n</var> + b</code> gives it heartburn that <code>a<var>n</var></code> doesn&#8217;t.</p>
<p>I try one more thing: remove the whitespace in the equation.</p>
<pre><code>p:nth-of-type(4n+3) { … }</code></pre>
<p>It works! Safari and Firefox both rendered the formatting properly. Webkit just doesn&#8217;t care for the whitespace.</p>
<p>But is whitespace forbidden in the equation? Here&#8217;s what the <a title="CSS3 Spec (Recommended) For Structural Pseudo-Classes" href="http://www.w3.org/TR/css3-selectors/#structural-pseudos">spec has to say</a>:</p>
<blockquote><p>Whitespace is permitted after the &#8220;(&#8220;, before the &#8220;)&#8221;, and on either side of the &#8220;+&#8221; or &#8220;-&#8221; that separates the an and b parts when both are present.</p>
<p>Valid Examples with white space:</p>
<pre><code>:nth-child( 3n + 1 )
:nth-child( +3n - 2 )
:nth-child( -n+ 6)
:nth-child( +6 )</code></pre>
<p>—<cite><a href="http://www.w3.org/TR/css3-selectors/#structural-pseudos">http://www.w3.org/TR/css3-selectors/#structural-pseudos</a></cite></p></blockquote>
<p>So then, we do have a bug. Webkit doesn&#8217;t respect the whitespace in <code>nth-child</code> and the other <code>nth-*</code> selectors. The workaround is easy enough, but it&#8217;s going to be hard for me to break the habit of adding space around the arithmetic operator. It&#8217;s a best practice, so far as I&#8217;m concerned, for code readability. Nevertheless, the expressions are simple enough that it&#8217;s not a terrible price to pay to get Safari/Chrome to play.</p>
<p>If you want to see it in action, check out <a title="nth-child Rendering Test File" href="http://bradcollins.com/wp-content/uploads/2010/12/nth-child-test.html">this test file</a>. Below is a screen capture of Safari&#8217;s rendering (left) and Firefox&#8217;s rendering (right). As you can see, Safari only renders <code>nth-child(2n+1)</code> correctly while Firefox renders them both correctly.</p>
<div id="attachment_185" class="wp-caption aligncenter" style="width: 650px"><a href="http://bradcollins.com/wp-content/uploads/2010/12/nth-child-test-safari-vs-firefox.gif"><img class="size-large wp-image-185" title="nth-child Rendering Comparison (Safari vs. Firefox)" src="http://bradcollins.com/wp-content/uploads/2010/12/nth-child-test-safari-vs-firefox-1024x585.gif" alt="Safari's rendering is on the left. It does not render nth-child(2n + 1) correctly, but only nth-child(2n+1), i.e., without spaces. On the right, Firefox renders both correctly." width="640" height="365" /></a><p class="wp-caption-text">nth-child Rendering Comparison (Safari vs. Firefox)</p></div>
]]></content:encoded>
			<wfw:commentRss>http://bradcollins.com/2010/12/04/webkit-disrespects-my-personal-whitespace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>African Or European Swallows?</title>
		<link>http://bradcollins.com/2010/07/22/african-or-european-swallows/</link>
		<comments>http://bradcollins.com/2010/07/22/african-or-european-swallows/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 18:15:46 +0000</pubDate>
		<dc:creator>Brad</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[coconuts]]></category>
		<category><![CDATA[humor]]></category>
		<category><![CDATA[Monty Python]]></category>
		<category><![CDATA[swallows]]></category>

		<guid isPermaLink="false">http://bradcollins.com/?p=162</guid>
		<description><![CDATA[I&#8217;m thinking they must be African swallows.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m thinking they must be African swallows.</p>
<div id="attachment_163" class="wp-caption aligncenter" style="width: 310px"><a href="http://bradcollins.com/wp-content/uploads/2010/07/failwhale.png"><img class="size-medium wp-image-163" title="The Notorious Twitter Fail Whale" src="http://bradcollins.com/wp-content/uploads/2010/07/failwhale-300x221.png" alt="Eight birds (which I hypothesize must be African swallows) attempting to lift a whale with a net" width="300" height="221" /></a><p class="wp-caption-text">The Notorious Twitter Fail Whale</p></div>
]]></content:encoded>
			<wfw:commentRss>http://bradcollins.com/2010/07/22/african-or-european-swallows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fortran Programming II</title>
		<link>http://bradcollins.com/2009/08/06/fortran-programming-ii/</link>
		<comments>http://bradcollins.com/2009/08/06/fortran-programming-ii/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 20:25:55 +0000</pubDate>
		<dc:creator>Brad</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[humor]]></category>
		<category><![CDATA[sayings]]></category>

		<guid isPermaLink="false">http://bradcollins.com/?p=76</guid>
		<description><![CDATA[Programming in Fortran is like being human: You can do it right, but most of the time you don&#8217;t.]]></description>
			<content:encoded><![CDATA[<p>Programming in Fortran is like being human: You can do it right, but most of the time you don&#8217;t.</p>
]]></content:encoded>
			<wfw:commentRss>http://bradcollins.com/2009/08/06/fortran-programming-ii/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Sugar Scrub</title>
		<link>http://bradcollins.com/2009/05/26/sugar-scrub/</link>
		<comments>http://bradcollins.com/2009/05/26/sugar-scrub/#comments</comments>
		<pubDate>Tue, 26 May 2009 12:21:34 +0000</pubDate>
		<dc:creator>Brad</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[humor]]></category>
		<category><![CDATA[life]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[wife]]></category>

		<guid isPermaLink="false">http://bradcollins.com/?p=123</guid>
		<description><![CDATA[I am reading Andy Clarke&#8217;s Transcending CSS, and in it he encourages looking for Web design inspiration in places other than the Web: cereal boxes, newspapers, magazines, buildings, to name a few. (This is something I&#8217;ve done for some time &#8230; <a href="http://bradcollins.com/2009/05/26/sugar-scrub/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I am reading <a href="http://www.stuffandnonsense.co.uk/">Andy</a> <a href="http://forabeautifulweb.com/">Clarke&#8217;s</a> <a href="http://www.transcendingcss.com/">Transcending CSS</a>, and in it he encourages looking for Web design inspiration in places other than the Web: cereal boxes, newspapers, magazines, buildings, to name a few. (This is something I&#8217;ve done for some time now, but I&#8217;ve been making a more conscious effort of late, given his advice.)</p>
<p>This morning I picked up a tube of my wife&#8217;s facial scrub. I looked for anything interesting in the design on the front. Then I looked at the back, which contains, among other things, an ingredient list. I wasn&#8217;t scanning the ingredient list as much as my eyes just happened to fall on one word:</p>
<p>Saliva.</p>
<p>Saliva! They put <em>saliva</em> in facial scrub? I looked again.</p>
<p>Sal<strong>vi</strong>a.</p>
<p><span>Salvia</span> officinalis (sage) leaf extract. Ah, helps to keep reading past the line break.</p>
]]></content:encoded>
			<wfw:commentRss>http://bradcollins.com/2009/05/26/sugar-scrub/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reason #10,754 To Execrate Internet Explorer 6</title>
		<link>http://bradcollins.com/2009/04/20/reason-10754-to-execrate-internet-explorer-6/</link>
		<comments>http://bradcollins.com/2009/04/20/reason-10754-to-execrate-internet-explorer-6/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 21:58:16 +0000</pubDate>
		<dc:creator>Brad</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[IE6]]></category>
		<category><![CDATA[IE7]]></category>
		<category><![CDATA[Peeves]]></category>

		<guid isPermaLink="false">http://bradcollins.com/?p=110</guid>
		<description><![CDATA[Ever seen this pop up in Internet Explorer 6 (or 7)? This page contains both secure and nonsecure items. Do you want to display the nonsecure items? You spend hours combing through server-side source, hours more combing through client-side source, &#8230; <a href="http://bradcollins.com/2009/04/20/reason-10754-to-execrate-internet-explorer-6/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Ever seen this pop up in Internet Explorer 6 (or 7)?</p>
<blockquote><p>This page contains both secure and nonsecure items. Do you want to display the nonsecure items?</p></blockquote>
<p>You spend hours combing through server-side source, hours more combing through client-side source, and yet more hours sniffing and poring over headers, and nothing. Nothing <acronym title="Hypertext Transfer Protocol">HTTP</acronym> when it should be <acronym title="Hypertext Transfer Protocol, Secure">HTTPS</acronym>.</p>
<p>Well this could be your problem, yet another non sequitur brought to you by Microsoft:</p>
<blockquote><p>This problem occurs if  the Web page script calls the <strong>removeChild()</strong> method to delete a  DIV element that references a background image. <cite>—<a href="http://support.microsoft.com/kb/925014">http://support.microsoft.com/kb/925014</a></cite></p></blockquote>
<p>This only appears to happen when the style is inline. In other words, say you have something like this:</p>
<pre><code>&lt;div id="err" style="background-image:url(err.gif)"&gt;
   Nee!
&lt;/div&gt;</code></pre>
<p>If you attempt to vaporize that <code>div</code> with <code>removeChild()</code>, you&#8217;re suddenly no longer secure.</p>
<p>Okaaay. Make sense to you? Makes sense to me!</p>
<p>Firefox, take me away!</p>
]]></content:encoded>
			<wfw:commentRss>http://bradcollins.com/2009/04/20/reason-10754-to-execrate-internet-explorer-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fortran Programming</title>
		<link>http://bradcollins.com/2009/02/16/fortran-programming/</link>
		<comments>http://bradcollins.com/2009/02/16/fortran-programming/#comments</comments>
		<pubDate>Mon, 16 Feb 2009 23:31:57 +0000</pubDate>
		<dc:creator>Brad</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[humor]]></category>
		<category><![CDATA[sayings]]></category>

		<guid isPermaLink="false">http://bradcollins.com/?p=74</guid>
		<description><![CDATA[Programming in Fortran is like a monarchy: With the right guy, it&#8217;s not so bad, but there&#8217;s just too much potential for abuse.]]></description>
			<content:encoded><![CDATA[<p>Programming in Fortran is like a monarchy: With the right guy, it&#8217;s not so bad, but there&#8217;s just too much potential for abuse.</p>
]]></content:encoded>
			<wfw:commentRss>http://bradcollins.com/2009/02/16/fortran-programming/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>URI Decomposer</title>
		<link>http://bradcollins.com/2009/02/03/uri-decomposer/</link>
		<comments>http://bradcollins.com/2009/02/03/uri-decomposer/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 13:57:42 +0000</pubDate>
		<dc:creator>Brad</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://bradcollins.com/?p=61</guid>
		<description><![CDATA[At work, we build our client websites upon a framework uses a lot of GET parameters. It makes for some URIs that average, oh, about three feet in length. Examining some of those monsters can make your eyes cross if you ever need to &#8230; <a href="http://bradcollins.com/2009/02/03/uri-decomposer/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>At work, we build our client websites upon a framework uses a <em>lot</em> of GET parameters. It makes for some <acronym title="Uniform Resource Identifier">URI</acronym>s that average, oh, about three feet in length. Examining some of those monsters can make your eyes cross if you ever need to verify some parameter values in the query string, so I decided it was time for a little tool that would break up the URI into its constituent parts for me, instead of wading wearily though the whole URI myself. Google has a <a href="http://code.google.com/p/js-uri/">JavaScript URI object</a> that does most of the heavy lifting already. I just had to add code to break up the query string into the individual key-value pairs.</p>
<p>Hence the <a href="/tools-dir/uri-decomposer.html">URI Decomposer</a> was born. You&#8217;ll find it among the items on the <a href="/tools/">Tools</a> page (few as they are as of this writing).</p>
]]></content:encoded>
			<wfw:commentRss>http://bradcollins.com/2009/02/03/uri-decomposer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Audacity Crudity</title>
		<link>http://bradcollins.com/2008/12/26/audacity-crudity/</link>
		<comments>http://bradcollins.com/2008/12/26/audacity-crudity/#comments</comments>
		<pubDate>Fri, 26 Dec 2008 23:41:47 +0000</pubDate>
		<dc:creator>Brad</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[Audacity]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[bug]]></category>

		<guid isPermaLink="false">http://bradcollins.com/?p=57</guid>
		<description><![CDATA[I&#8217;m starting to do some rudimentary audio editing on the Mac. Not impressed with Audacity version 1.2.5 for the Mac. The most glaring oddity is when exporting a file. As I type the file name, Audacity starts playing the audio. &#8230; <a href="http://bradcollins.com/2008/12/26/audacity-crudity/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m starting to do some rudimentary audio editing on the Mac. Not impressed with <a href="http://audacity.sourceforge.net/">Audacity</a> version 1.2.5 for the Mac. The most glaring oddity is when exporting a file. As I type the file name, Audacity starts playing the audio. Evidently Audacity does not disable its keyboard shortcuts (not related to the Save dialog, that is). Awfully flaky.</p>
<p>That&#8217;s not to mention the rough-around-the-edges UI that makes a Mac user cringe. Guess I&#8217;m just spoiled.</p>
]]></content:encoded>
			<wfw:commentRss>http://bradcollins.com/2008/12/26/audacity-crudity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t Let A Spec Pick Your Button Type</title>
		<link>http://bradcollins.com/2008/12/03/dont-let-a-spec-pick-your-button-type/</link>
		<comments>http://bradcollins.com/2008/12/03/dont-let-a-spec-pick-your-button-type/#comments</comments>
		<pubDate>Wed, 03 Dec 2008 17:54:59 +0000</pubDate>
		<dc:creator>Brad</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Peeves]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://bradcollins.com/?p=48</guid>
		<description><![CDATA[Ever need to create a &#60;button&#62; of type button when you&#8217;re doing a little DOM scripting? Easy enough, right? It should go something like this: var okButton = document.createElement('button'); okButton.type = 'button'; Nevertheless when you run this code in IE6, &#8230; <a href="http://bradcollins.com/2008/12/03/dont-let-a-spec-pick-your-button-type/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Ever need to create a <code>&lt;button&gt;</code> of type <code>button</code> when you&#8217;re doing a little <acronym title="Document Object Model">DOM</acronym> scripting? Easy enough, right? It should go something like this:</p>
<pre><code>var okButton = document.createElement('button');
okButton.type = 'button';
</code></pre>
<p>Nevertheless when you run this code in <acronym title="Internet Explorer, version 6">IE6</acronym>, you get the super-informative &#8220;Communication error&#8221; message. It turns out that IE6 (for once) is following the standard. I don&#8217;t know what the <acronym title="World Wide Web Consortium">W3C</acronym> were thinking, but so sayeth the <a title="The current version as of this writing" href="http://www.w3.org/TR/DOM-Level-2-HTML/ecma-script-binding.html">ECMAScript Language Binding (9 January 2003)</a> spec about the <code>type</code> property of the <code>HTMLButtonElement</code>:</p>
<blockquote><dl>
<dt><strong>type</strong></dt>
<dd>This read-only property is a <strong>String</strong>.</dd>
</dl>
</blockquote>
<p>So, the common way to set the property of an HTML element is, according to the standard, <em>right out</em>? I mean, it&#8217;s not inconceivable that I would want to create a <code>&lt;button&gt;</code> on the fly with a type that is not the default.</p>
<p>Alas there is a workaround. Ironically, it employs the standard method of setting DOM <code>Node</code>&#8216;s attribute value:</p>
<pre><code>var okButton = document.createElement('button');
<strong>okButton.setAttribute('type', 'button');</strong></code></pre>
<p>Works like a charm! Even in IE6.</p>
<p>(I should note that Firefox 3 allows for writing to the button&#8217;s type property using the <code>button.type</code> notation. I didn&#8217;t test with other browsers to see whether they balk at the <code>button.type</code> notation, but Firefox 2/3, Opera 9.6, and Safari 3, along with IE6/7, are more than amenable to the <code>setAttribute</code> method.)</p>
]]></content:encoded>
			<wfw:commentRss>http://bradcollins.com/2008/12/03/dont-let-a-spec-pick-your-button-type/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

