<?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>Brant Burnett&#039;s Development Blog &#187; Uncategorized</title>
	<atom:link href="http://btburnett.com/category/uncategorized/feed" rel="self" type="application/rss+xml" />
	<link>http://btburnett.com</link>
	<description></description>
	<lastBuildDate>Tue, 27 Apr 2010 12:48:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Detecting Original HTML5 Input Types On Unsupported Browsers</title>
		<link>http://btburnett.com/2010/04/detecting-html5-input-types-on-unsupported-browsers.html</link>
		<comments>http://btburnett.com/2010/04/detecting-html5-input-types-on-unsupported-browsers.html#comments</comments>
		<pubDate>Mon, 26 Apr 2010 03:24:43 +0000</pubDate>
		<dc:creator>Brant Burnett</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://btburnett.com/?p=132</guid>
		<description><![CDATA[I&#8217;ve been doing some work recently on extending jQuery UI to style form elements using the Themeroller.  One thing that I wanted to implement was detection of the new HTML5 input types and choosing the correct widget to use based upon that.  This would provide progressive enhancement of the input element to support the HTML5 [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been doing some work recently on extending <a href="http://jqueryui.com/">jQuery UI</a> to style form elements using the <a href="http://jqueryui.com/themeroller/">Themeroller</a>.  One thing that I wanted to implement was detection of the new HTML5 input types and choosing the correct widget to use based upon that.  This would provide progressive enhancement of the input element to support the HTML5 input type, even if that type of input isn&#8217;t supported on that browser.</p>
<p>By definition, if a browser can&#8217;t support the type of an input, it automatically falls back to a text input.  This is great for backwards compatibility, but it gave me a bit of a problem.  If I set type=&#8221;number&#8221; in my HTML, testing the type of the element in Javascript returns &#8220;text&#8221; when the number element isn&#8217;t supported.  Useful for determining if support is available, not so useful for determining what the original value is in the HTML.</p>
<p>In most browsers, you can find the original value using the attributes collection.  However, this doesn&#8217;t work in IE7 and earlier.  And, as everyone knows, we still have to support IE 6 &amp; 7 for most web sites.  I found an alternative for IE, which is to test the outerHTML of the element using a regular expression.  IE will return this with the original attributes intact.</p>
<p>I&#8217;ve written a jQuery filter extension that allows you to test any element for the original input type:</p>
<pre class="brush: jscript;">
// add HTML5 input type expression (still detects HTML5 input types on browsers that don't support them)
$.extend($.expr[':'], {
	inputtype: function(elem, i, type) {
		function getRawAttr() {
			// IE will return the original value in the outerHTML
			var match = /&lt;input.*?\s+type=(\w+)(\s+|&gt;).*?/i.exec(elem.outerHTML);

			if (match &amp;&amp; match.length &gt;= 2 &amp;&amp; match[1] !== &quot;text&quot;) {
				return match[1];
			}

			// for other browsers, test attributes collection (doesn't work in IE&lt;7)
			var attrs = elem.attributes,
				i;

			for (i=0; i&lt;attrs.length; i++) {
				if (attrs[i].nodeName === &quot;type&quot;) {
					return attrs[i].nodeValue;
				}
			}

		}

		if (elem.tagName != &quot;INPUT&quot;) return false;
		if (elem.type === &quot;text&quot;) {
			// could be unsupported type fallback, so do further testing
			return getRawAttr() === type[3];
		} else {
			return elem.type === type[3];
		}
	}
});
</pre>
<p>To use this extension, just use the :inputtype(type) filter in your jQuery expression.  For example:</p>
<pre class="brush: jscript;">

$('input:inputtype(number)).width(100);

if ($(elem).is(':inputtype(number)')) {
...
}
</pre>
<p><strong>Update:</strong> Changed to only run the check if the tag is an input tag, in case you run the filter against non-input elements.</p>
]]></content:encoded>
			<wfw:commentRss>http://btburnett.com/2010/04/detecting-html5-input-types-on-unsupported-browsers.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery UI Spinner Widget 1.10</title>
		<link>http://btburnett.com/2009/05/jquery-ui-spinner-widget-110.html</link>
		<comments>http://btburnett.com/2009/05/jquery-ui-spinner-widget-110.html#comments</comments>
		<pubDate>Thu, 14 May 2009 02:47:56 +0000</pubDate>
		<dc:creator>Brant Burnett</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://btburnett.com/?p=98</guid>
		<description><![CDATA[I&#8217;ve uploaded a revised jQuery UI Spinner widget, version 1.10, based upon a lot of excellent feedback from the jQuery UI team. New features include mousewheel scrolling, decimal support, customizable prefixes/suffixes for currency/percents, improved input masking and maxlength handling, HTML5 markup support, lots of bug fixes, and more. jquery.ui.spinner Git Repository jQuery UI Spinner Widget [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve uploaded a revised jQuery UI Spinner widget, version 1.10, based upon a lot of excellent feedback from the jQuery UI team.  New features include mousewheel scrolling, decimal support, customizable prefixes/suffixes for currency/percents, improved input masking and maxlength handling, HTML5 markup support, lots of bug fixes, and more.</p>
<p><a href="http://github.com/btburnett3/jquery.ui.spinner">jquery.ui.spinner Git Repository</a><br />
<a href="/spinner/example/example.html">jQuery UI Spinner Widget Example</a></p>
<p>As it turns out, the jQuery UI team already had a spinner widget sitting in their files that hadn&#8217;t been worked on in a while, so I&#8217;m working with Ca-Phun Ung to see if we can finish getting it up-to-date, polished, and with some of the new features from my widget incorporated into it.  Stay tuned for more info.</p>
]]></content:encoded>
			<wfw:commentRss>http://btburnett.com/2009/05/jquery-ui-spinner-widget-110.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Blog Location</title>
		<link>http://btburnett.com/2009/05/new-blog-location.html</link>
		<comments>http://btburnett.com/2009/05/new-blog-location.html#comments</comments>
		<pubDate>Sat, 02 May 2009 14:03:47 +0000</pubDate>
		<dc:creator>Brant Burnett</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://btburnett.com/?p=65</guid>
		<description><![CDATA[I&#8217;ve moved my blog away from Blogger and the blog.btburnett.com address.  Now you can find me at btburnett.com and using WordPress.  Hopefully I&#8217;ve got all the feeds and pages redirected properly, please let me know if you find any problems.  Thanks!]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve moved my blog away from Blogger and the blog.btburnett.com address.  Now you can find me at <a href="http://btburnett.com">btburnett.com</a> and using WordPress.  Hopefully I&#8217;ve got all the feeds and pages redirected properly, please let me know if you find any problems.  Thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://btburnett.com/2009/05/new-blog-location.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
