<?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:series="http://organizeseries.com/"
	>

<channel>
	<title>SitePen Blog &#187; mobile</title>
	<atom:link href="http://www.sitepen.com/blog/category/mobile/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sitepen.com/blog</link>
	<description>SitePen Services and notes about Dojo, Persevere, CometD, JavaScript, and the Web</description>
	<lastBuildDate>Wed, 15 May 2013 22:02:34 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5</generator>
		<item>
		<title>Feature Detection and Device Optimized Builds</title>
		<link>http://www.sitepen.com/blog/2012/06/12/feature-detection-and-device-optimized-builds/</link>
		<comments>http://www.sitepen.com/blog/2012/06/12/feature-detection-and-device-optimized-builds/#comments</comments>
		<pubDate>Tue, 12 Jun 2012 17:59:39 +0000</pubDate>
		<dc:creator>Kris Zyp</dc:creator>
				<category><![CDATA[Dojo]]></category>
		<category><![CDATA[mobile]]></category>

		<guid isPermaLink="false">http://www.sitepen.com/blog/?p=2203</guid>
		<description><![CDATA[<p>The mobile device revolution has placed new demands on web applications. Mobile devices generally have lower bandwidth and lower CPU capacity, forcing us to avoid large complex code. Fortunately, the mobile space has a greater percentage of users running modern browsers than on desktops, so it is feasible to write similar applications with much less [...]</p><p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></description>
				<content:encoded><![CDATA[<p>The mobile device revolution has placed new demands on web applications. Mobile devices generally have lower bandwidth and lower CPU capacity, forcing us to avoid large complex code. Fortunately, the mobile space has a greater percentage of users running modern browsers than on desktops, so it is feasible to write similar applications with much less code when targeting mobile browsers. However, dealing with the multitude of different platforms is non-trivial, and creating appropriately small packages of code for mobile devices, while still providing sufficient capability for older desktop browsers can be challenging. While there are different ways to deal with platform discrepancies, the hard lessons of the last decade have shown that feature detection is <strong>the</strong> mechanism for branching.</p>
<p>Fortunately, Dojo 1.7 has evolved with a powerful new feature detection infrastructure. Dojo now uses the popular <a href="https://github.com/phiggins42/has.js"><code>has()</code></a> pattern for feature detection in combination with a <code>has()</code>-aware build system. While it is easy enough to write feature detection tests with ad-hoc JavaScript expressions, the <code>has()</code> pattern defines a specific syntax such that the build system can detect these feature-based branches, and one can create application builds that are highly optimized for specific devices, with known feature shims factored out.</p>
<p><span id="more-2203"></span></p>
<p>Since Dojo&#8217;s codebase in 1.7 has already been significantly refactored to use the <code>has()</code> pattern, we can instantly start making platform-optimized builds without even using <code>has()</code> in our own code. Certainly the most common and likely target for an optimized build is the modern WebKit platform used on the majority of mobile devices. Now there are some small variations between different WebKit versions used in the mobile world, but there a significant number of important known features that we can rely on to create builds for WebKit browsers and mobile devices. To specify the known features, we include an object with the features in the <code>staticHasFeatures</code> property of a build profile file. Here is a sample start to a build profile that covers the major features that Dojo uses:</p>
<pre>dependencies = {
	stripConsole: "normal",
	staticHasFeatures: {
		"dom-addeventlistener": true,
		"dom-qsa": true,
		"json-stringify": true,
		"json-parse": true,
		"bug-for-in-skips-shadowed": false,
		"dom-matches-selector": true,
		"native-xhr": true,
		"array-extensible": true,
		"quirks": false
	},
	...</pre>
<p>With this profile, the build system will find any feature branches in the code, and substitute the known features (or bugs) provided. You will want to ensure that this type of a build is combined with the closure compiler, which will then proceed to remove code blocks that won&#8217;t ever be used due to the known conditional branches (dead code removal). To use the closure compiler, you can specify closure as the layer optimizer:</p>
<pre>build action=release profile=my-profile layerOptimize=closure</pre>
<p>After running a build, we now have a built version of Dojo (or our application) without any of the extra code that compensates for a lack of a standard W3C <code>addEventListener()</code>, <code>querySelectorAll()</code>, and other standard features that are missing in earlier versions of Internet Explorer. When this optimized build is run on base dojo.js, it will save us about 9KB compared to the version of Dojo equipped for running on all supported browsers. This 9KB can be an important saving for size sensitive applications. We can use this build for a mobile version of our application, or choose this build when we detect a WebKit browser. The former option is simply a matter of pointing to this build for the mobile pages. If we want to create a page that actually selects the appropriate build at run-time based on the host browser, we can do that with some simple browser detection. While there are a number of different ways we could do this, this is perhaps the simplest:</p>
<pre lang="html4">&lt;script&gt;
	// choose the appropriate dojo script based on the user agent
	// will match FF, Safari, Chrome, mobile browsers, not IE
	var dojoScript = /Gecko/.test(navigator.userAgent) ? 
		'dojo-webkit.js' : 'dojo.js';
	// now create and append a script element to load it:
	var hd=document.getElementsByTagName("head")[0],
		el=document.createElement("script");
	el.async=true; // set it to async
	require = { // configure Dojo for async mode
		async: true
	};
	el.src='path/to/dojo/' + dojoScript;
	hd.insertBefore(el,hd.firstChild); // insert it so it will load
&lt;/script&gt;</pre>
<p>The script above will asynchronously load Dojo, which will allow your page to load quicker. However, if you need to load Dojo synchronously, you could use document.write instead:</p>
<pre>&lt;script&gt;
	// choose the appropriate dojo script based on the user agent
	// will match FF, Safari, Chrome, mobile browsers, not IE
	var dojoScript = /Gecko/.test(navigator.userAgent) ?
  		'dojo-webkit.js' : 'dojo.js';
	document.write('&lt;script src="path/to/dojo/' + dojoScript + '"&gt;&lt;/s' + 'cript&gt;');
&lt;/script&gt;</pre>
<p class="proTip">You may have noticed that we used browser sniffing in this example, despite the fact that we advocate feature detection. In general, using feature detection in your source code is definitely preferred because it makes your code robust and agnostic to browser platforms. However, using separate code like the example above to avoid the expense of running multiple feature detections (they can be expensive in time and space) at run-time, based on known user agents can be a valuable optimization. When doing this, make sure the optimization stays distinct from the code that will be using feature detection so there is a clean separation of purposes. Placing this in the HTML, separate from modules can be a good way to achieve this organization.</p>
<p>Because the build system is based on feature sets, we could go further and create even more platform specific builds. We could define additional features and make specific builds for different versions of IE (newer versions of IE include more features of course), and separate out Firefox and Opera from WebKit. The feature set based builds allow for limitless permutations of device specific optimizations.</p>
<p>Another build setting that we can also define to create lighter weight builds is the query selector engine. By default, Dojo is built with the &#8220;acme&#8221; engine that has long been a part of Dojo. However, 1.7 introduced an alternate selector engine called &#8220;lite&#8221;. The &#8220;lite&#8221; engine leans much more heavily on the native <code>querySelectorAll</code> capabilities of modern browsers, and does not have full CSS3 support for older browsers. However, it does support the core CSS2 features that are the workhorse queries predominantly used for most applications (see the <a href="http://dojotoolkit.org/reference-guide/dojo/query.html#dojo-query-1-7-only">dojo/query documentation for more information about the lite engine capabilities</a>). You can choose to use the lite engine if you are targeting modern browsers or if your application does not need to use any fancy CSS3 queries. Select the lite engine in your build profile like this:</p>
<pre>dependencies = {
	selectorEngine:"lite",
	...</pre>
<p>The lite engine will save another 6KB of size in dojo.js.</p>
<h2>Using has()</h2>
<p>In running a build with known features, so far we have simply been taking advantage of the existing feature detection branching in the Dojo code base. However, we may want to use <code>has()</code> in our own application. While Dojo normalizes most of the major discrepancies between browsers, there may still be situations where your application needs to detect a feature or bug in the browser and respond accordingly. We can use the <code>dojo/has</code> module to access the <code>has()</code> function. If we are using an existing feature that Dojo detects, this is very simple:</p>
<pre lang="javascript">require(["dojo/has"], function(has){
	if(has("touch")){
		// show our touch interface
	}else{
		// show our mouse-driven interface
	}
});</pre>
<p>A list of the features that Dojo detects and provides are available on the <a href="http://dojotoolkit.org/reference-guide/dojo/has.html">dojo/has reference page</a>. If the Dojo tested features are not sufficient, you can also easily create your own feature detect tests, by calling <code>has.add()</code>:</p>
<pre lang="javascript">require(["dojo/has"], function(has){
	// test if we have video
	has.add('html5-video', !!document.createElement('video').canPlayType);
	if(has('html5-video')){
		// show our video with a &lt;video&gt; element	
	}else{
		// use flash or something
	}
});</pre>
<p>Both of these examples use the <code>has()</code> pattern so the build system can properly identify these feature branches, and you can create builds with known features to eliminate unused branches for specific browsers.</p>
<p>The new feature detection infrastructure and integration with the build system helps modernize Dojo, using the latest and most advanced techniques for cross-browser web application development and highly optimized mobile web applications.</p>
<p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.sitepen.com/blog/2012/06/12/feature-detection-and-device-optimized-builds/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Decruft. Delight. dgrid Beta Is Here!</title>
		<link>http://www.sitepen.com/blog/2012/04/23/dgrid_beta/</link>
		<comments>http://www.sitepen.com/blog/2012/04/23/dgrid_beta/#comments</comments>
		<pubDate>Mon, 23 Apr 2012 15:50:09 +0000</pubDate>
		<dc:creator>Dylan Schiemann</dc:creator>
				<category><![CDATA[dgrid]]></category>
		<category><![CDATA[Dojo]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Performance]]></category>

		<guid isPermaLink="false">http://www.sitepen.com/blog/?p=4171</guid>
		<description><![CDATA[<p>Does the code for your grid customizations involve more lines than an Apple product launch? You are not alone, brave developer. We feel your pain &#8211; the type that results from banging your head on a keyboard until the room spins &#8211; and that is why we have an amazing gift for you! Read on&#8230; [...]</p><p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></description>
				<content:encoded><![CDATA[<p><img src="http://www.sitepen.com/blog/wp-content/uploads/2012/04/dgrid_here1.jpg" alt="dgrid beta is here" /><br />
Does the code for your grid customizations involve more lines than an Apple product launch?</p>
<p>You are not alone, brave developer.  We feel your pain &#8211; the type that results from banging your head on a keyboard until the room spins &#8211; and that is why we have an amazing gift for you!   Read on&#8230;</p>
<p>Dojo users and SitePen customers alike have needed a grid since the Dojo Toolkit project began. At first, we and several other companies <a href="http://www.sitepen.com/blog/2007/09/16/the-dojo-grid/">banded together</a> to purchase a non-open source grid. Enter <a href="http://dojotoolkit.org/reference-guide/dojox/grid/DataGrid.html">Dojo DataGrid</a>. We contributed our shiny new code to the Dojo Toolkit for the benefit of everyone and we&#8217;ve spent years maintaining and incrementally improving it in Dojo.  But the web evolved, faster and faster, demanding more functionality, more performance, and more data!  Others tried to keep up as well, enter <a href="http://dojotoolkit.org/reference-guide/dojox/grid/EnhancedGrid.html">EnhancedGrid</a> and <a href="http://dojotoolkit.org/reference-guide/dojox/grid/LazyTreeGrid.html">LazyTreeGrid</a>.  Kudos to everyone for building and contributing to Dojo!</p>
<p>Finally, last year, we took a long, hard look at how our customers were using DataGrid and EnhancedGrid.  We agonized over the time and effort spent developing and maintaining such crucial functionality.  We knew something needed to change. Enough was enough!  Our choice was to attempt a DataGrid refactor or start over.  The SitePen Team spoke: We started over.<br />
<span id="more-4171"></span><br />
To date, we&#8217;ve invested thousands of hours in developing the new dgrid, a grid that goes beyond any other, enabling developers to make awesome things faster than ever.</p>
<p>So, without further ado, we&#8217;re delighted to announce that <a href="http://dgrid.io">dgrid</a>, a new JavaScript component for creating advanced, high performance data grids, is now in Beta!</p>
<h2>Alpha, Beta, and beyond</h2>
<p><img style="float: right; margin: 0 0 1em 1em;" src="http://www.sitepen.com/blog/wp-content/uploads/2012/04/alphabeta.jpg" alt="" />The Alpha release of dgrid represented a baseline which gave a fair indication of its design direction, as well as the types of features it intended to support.  While some modules were in an unfinished or rough state, it was possible to demonstrate and harness their abilities, and we were thrilled to hear from several early adopters who shared some early success stories and feedback.</p>
<p>This Beta release represents the culmination of months of work by the SitePen team to fix bugs and work toward a stable API release. While many companies and individuals have already successfully used alpha versions of dgrid in their production applications, dgrid beta represents the first release of dgrid we know to be feature-complete and API-stable for regular use.</p>
<p>Beyond Beta, we&#8217;re on the path to greatness, most notably finishing work on keyboard accessibility and improving mobile compatibility.  Mobile compatibility, in particular, will be a continued focus for development as the mobile landscape continues to evolve.</p>
<h2>Usability, Portability, Compatibility</h2>
<p>We&#8217;ve designed dgrid with your needs in mind.  First of all, because dgrid is a completely portable AMD package, any application written with AMD can use dgrid—even if the rest of the application isn&#8217;t using Dojo!</p>
<p><strong>As for compatibility, we&#8217;re currently targeting the following desktop browsers:</strong><br />
<img style="float: right; margin: 1.5em 0em 1.5em 1.5em;" src="http://www.sitepen.com/blog/wp-content/uploads/2012/04/browsers1.jpg" alt="" /></p>
<ul>
<li>Firefox ESR and latest release (currently 10 and 11, respectively)</li>
<li>Chrome stable (currently 17)</li>
<li>Internet Explorer 6-9</li>
<li>Safari 5.1</li>
<li>Opera 11.61</li>
</ul>
<p><strong>And the following mobile platforms&#8230;</strong></p>
<ul>
<li>iOS 4.3 and 5</li>
<li>Android 2.3 and 4.0</li>
</ul>
<h2>dgrid&#8217;s Modular Features</h2>
<p>dgrid&#8217;s extremely modular design helps to ensure that core functionality can be easily modified and that extremely small, lightweight grids can be created with minimal effort.  Whereas grid modules like DojoX DataGrid are at least 55KB in compressed size, dgrid starts at just 12KB!  Additionally, dgrid includes a huge number of modular features out-of-the-box, <a href="http://dojofoundation.org/packages/dgrid/#features">rivaling or exceeding</a> nearly every other grid component currently available:</p>
<ul>
<li>Keyboard navigation &amp; ARIA role support for accessibility</li>
<li>i18n support</li>
<li>Asynchronous data retrieval &amp; row rendering</li>
<li>Row &amp; column drag&#8217;n'drop</li>
<li><a href="http://jqueryui.com/themeroller/">jQuery ThemeRoller</a> theme support</li>
<li>Native dojo/store API support</li>
<li>Automatic updates with Observable stores</li>
<li>Inline cell editors, including support for Dijit form widgets as editors</li>
<li>Unlimited-depth tree support</li>
<li>Support for multiple independent column sets</li>
<li>Support for records rendered to multiple rows</li>
<li>Support for custom formatting functions for cell contents</li>
<li>A complete row selection engine, including multi-row and indirect (checkbox-based) selection</li>
<li>Licensed using the same CLA &amp; open-source licensing as the Dojo Toolkit</li>
<li>ColumnHider: Shows and hides columns via a simple menu <strong>(Beta Feature!)</strong></li>
<li>ColumnReorder: Reorders columns in simple layouts using drag&#8217;n'drop <strong>(Beta Feature!)</strong></li>
<li>DijitRegistry: Enables integration with the Dijit registry and other Dijit layout widgets <strong> (Beta Feature!)</strong></li>
<li>Virtual &amp; traditional paging options</li>
<li>Pagination: A UI component that changes the behavior of the grid to with discrete pages rather than virtual scrolling <strong>(Beta Feature!)</strong></li>
</ul>
<h2>dgrid, Where have you been all my life?</h2>
<p><a href="http://dgrid.io/"><img style="float: right; margin: 0.5em 0em 1em 1.5em;" src="http://www.sitepen.com/blog/wp-content/uploads/2012/04/website.jpg" alt="dgrid website" /></a>We really wanted to make sure you didn&#8217;t miss out on this extraordinary opportunity to simplify and improve your ongoing development efforts and application performance.   We knew we need to illustrate how dgrid can be used to create amazing experiences with a minimum amount of effort and convince you that this was the way to go! So, here&#8217;s what we did:</p>
<p>First, we documented the heck out of our code and put in on <a href="https://github.com/SitePen/dgrid">Github</a>. THEN, we wrote some  <a href="https://github.com/SitePen/dgrid/tree/master/test">tests</a> and <a href="http://dojofoundation.org/packages/dgrid/#demos">demos</a> and THEN we created some <a href="http://dojofoundation.org/packages/dgrid/#tutorials"> handy tutorials</a> AND THEN, we gathered everything up, organized it to the nines and put it right here:<br />
<a href="http://dgrid.io/">http://dgrid.io/</a></p>
<h2>Development &amp; Support &#8211; We&#8217;ve got your back</h2>
<p>Wow! Thanks for reading this far! You must be seriously over your current grid fiasco!</p>
<p>We&#8217;re working hard with our customers to replace their massive grid implementations with dgrid and we can do the same for your application!  <a href="https://www.sitepen.com/site/contact.html">Call us today</a> to get on the schedule to receive a full grid migration effort or sign up for one of our valuable <a href="http://www.sitepen.com/support/index.html">SitePen Support</a> plans to keep your developers productive and informed!</p>
<p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.sitepen.com/blog/2012/04/23/dgrid_beta/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>The Year of Dojo is Here!</title>
		<link>http://www.sitepen.com/blog/2012/01/17/the-year-of-dojo-is-here/</link>
		<comments>http://www.sitepen.com/blog/2012/01/17/the-year-of-dojo-is-here/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 16:19:43 +0000</pubDate>
		<dc:creator>Angela Segovia</dc:creator>
				<category><![CDATA[dgrid]]></category>
		<category><![CDATA[Dojo]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Support]]></category>

		<guid isPermaLink="false">http://www.sitepen.com/blog/?p=3833</guid>
		<description><![CDATA[<p>Welcome to 2012 – The Year of Dojo!  We are expecting an amazing year! Make SitePen your one stop shop for all of your web application needs; Dojo workshops, JavaScript support and web app development.  Together, with SitePen, you will meet your 2012 goals!  When you’re happy, so are we. Learn Dojo - We are dedicated [...]</p><p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></description>
				<content:encoded><![CDATA[<p>Welcome to 2012 – The Year of Dojo!  We are expecting an amazing year! Make SitePen your one stop shop for all of your web application needs; <a title="Dojo workshops" href="http://www.sitepen.com/services/workshops/index.php" target="_blank">Dojo workshops</a>, <a title="JavaScript Support" href="https://www.sitepen.com/services/support.php" target="_blank">JavaScript support</a> and <a title="Web App Development" href="http://www.sitepen.com/services/development.php" target="_blank">web app development</a>.  Together, with SitePen, you will meet your 2012 goals!  When you’re happy, so are we.</p>
<p><strong>Learn Dojo </strong>- We are <em>dedicated</em> to providing you with the highest quality Dojo Toolkit workshops in the industry.  Whether you want to learn the basics of Dojo or sharpen your Dojo skills, we have a workshop just for you.  All of our Dojo Workshops are taught by our Dojo experts.  We <em>promise</em> you won’t be subjected to listening to some trainer who can’t live without his slides.  Wondering if our Dojo Workshops will cover <a title="Dojo 1.7" href="http://dojotoolkit.org/" target="_blank">Dojo 1.7</a>?  The answer is yes!</p>
<p>Ready to learn Dojo?  <a title="SitePen Dojo Workshops" href="http://www.sitepen.com/services/workshops/index.php" target="_blank">Check out our full list of 2012 workshop dates and locations</a>.  Sign up for any of our 2012 Dojo Workshops by January 31, 2012 with promo code IHEARTDOJO and get 10% off!</p>
<p><strong>Here to help </strong>- Did you know we also have support plans to fit every size and every need?  No matter which support plan you choose, our expert engineers will help you by <em>answering questions, resolving bugs, and solving problems</em>. We offer no-hassle ways to get in touch with your SitePen Support team, which means no waiting on hold, or having to explain your issue over and over again until you get to the right person.  With us, you always have access to the <em>right people</em>. If your project runs in to a critical issue, our <em>expert SitePen engineers</em> will jump in to help you quickly get back on track. Oh, and yes, all of our support plans include support for <a title="dGrid" href="http://dojotoolkit.org/blog/dojo-1-7-released" target="_blank">dGrid </a>and <a title="Dojo 1.7" href="http://dojotoolkit.org/" target="_blank">Dojo 1.7</a>! Having a SitePen Support plan is preparing for possibilities.  Even football teams have backup quarterbacks.</p>
<p>From 2 support hours to 200 support hours, SitePen has a support plan to fit your needs.  <a title="SitePen Support" href="https://www.sitepen.com/services/support.php" target="_blank">Take a look</a>!</p>
<p><strong>Perfect match of design and development </strong>- We are your one stop shop for your next project, including mobile web applications! Our expert team will take your web application from concept to launch.  We&#8217;ve mastered the front end and are here to help you build powerful, simple, and usable web apps, every single time.</p>
<p>Whether you need a traditional web application, mobile web application or installable mobile web app store application, <a title="SitePen Development" href="http://www.sitepen.com/services/development.php" target="_blank">SitePen can help</a>!</p>
<p>Still not sure how we can help you?  <a title="Contact SitePen" href="http://www.sitepen.com/contact/" target="_blank">Contact us today!</a> (You can even call us if you want.)  Celebrate 2012 &#8211; The Year of Dojo!</p>
<p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.sitepen.com/blog/2012/01/17/the-year-of-dojo-is-here/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Touching and Gesturing on iPhone, Android, and More</title>
		<link>http://www.sitepen.com/blog/2011/12/07/touching-and-gesturing-on-iphone-android-and-more/</link>
		<comments>http://www.sitepen.com/blog/2011/12/07/touching-and-gesturing-on-iphone-android-and-more/#comments</comments>
		<pubDate>Wed, 07 Dec 2011 17:46:52 +0000</pubDate>
		<dc:creator>Colin Snover</dc:creator>
				<category><![CDATA[Dojo]]></category>
		<category><![CDATA[mobile]]></category>

		<guid isPermaLink="false">http://www.sitepen.com/blog/?p=3425</guid>
		<description><![CDATA[<p>One of the most important parts of creating an effective and intuitive user interface on touch-enabled smartphones has nothing to do with visual appearance—instead, it has to do with creating an interface that properly responds to user input based on touch. For Web applications, this means replacing mouse events with touch events. In Dojo 1.7, [...]</p><p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></description>
				<content:encoded><![CDATA[<p>One of the most important parts of creating an effective and intuitive user interface on touch-enabled smartphones has nothing to do with visual appearance—instead, it has to do with creating an interface that properly responds to user input based on touch. For Web applications, this means replacing mouse events with touch events. In Dojo 1.7, new touch APIs help make this process easy.</p>
<p style="font-style: italic;">This is an updated version of the post <a href="http://www.sitepen.com/blog/2008/07/10/touching-and-gesturing-on-the-iphone/">Touching and Gesturing on the iPhone</a>, published in 2008.</p>
<p><span id="more-3425"></span></p>
<h2>In the beginning…</h2>
<p>Before we discuss the new features in Dojo 1.7 that make touch interfaces easier to create, it helps to understand some of the underlying technology and concepts. With iPhone, Apple introduced two new event concepts: <em>touches</em> and <em>gestures</em>. Touches are important for keeping track of how many fingers are on the screen, where they are, and what they’re doing. Gestures are important for determining what the user is actually doing when they are interacting with the device at a higher level: pinching, rotating, swiping, double-tapping, and so on.</p>
<p>While <em>touch</em> events are available on most platforms (the <a href="http://developer.apple.com/library/IOS/#documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html<br />
">touch event model originally established on iOS</a> has been standardized in the <a href="http://www.w3.org/TR/touch-events/">W3C Touch Events specification</a> and is supported by iOS, Android, and BlackBerry), native <em>gesture</em> events are not available everywhere, and the gesture event API in iOS is limited in the sorts of gestures it supports. The <code>dojox/gesture</code> package steps in to fill these gaps in functionality; we’ll discuss it shortly.</p>
<h2>Touches</h2>
<p>When you put a finger down on the screen, it kicks off the lifecycle of touch events. Each time a new finger touches the screen, a new <code>touchstart</code> event happens. As each finger lifts up, a <code>touchend</code> event happens. If, after touching the screen, you move any of your fingers around, <code>touchmove</code> events happen. If too many fingers are on the screen, or another action (such as a push notification from the phone’s OS) interferes with the touch, a <code>touchcancel</code> event happens.</p>
<p>The following touch events exist:</p>
<ul>
<li><code>touchstart</code>: Occurs when a finger is placed on the screen</li>
<li><code>touchend</code>: Occurs when a finger is removed from the screen</li>
<li><code>touchmove</code>: Occurs when a finger already placed on the screen is moved across the screen</li>
<li><code>touchcancel</code>: Occurs when a touch is cancelled before the finger is actually removed from the screen</li>
</ul>
<p>While it might seem that there should be a 1:1 mapping between a touch event and a mouse event—after all, your finger works much like a cursor—it turns out that <a href="http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/TouchEventClassReference/TouchEvent/TouchEvent.html<br />
"><code>TouchEvent</code></a> objects do not include properties that you might expect to see. For example, <code>pageX</code> and <code>pageY</code> properties are not populated. This is because, with a mouse, you really only have one point of contact: the cursor. With a multi-touch device, though, you could (for example) keep two fingers held down on the left of the screen while you tap the right side of the screen, and all three points are registered.</p>
<p>In order to provide information about all touch points at once, every <code>TouchEvent</code> object has a property containing information about every finger that’s currently touching the screen. It also has two other properties: one which contains a list of information for fingers that originated from the current target node, and one which contains only the information for fingers that are associated with the current event. These properties are:</p>
<ul>
<li><code>touches</code>: A list of information for every finger currently touching the screen</li>
<li><code>targetTouches</code>: Like <code>touches</code>, but is filtered to only the information for finger touches that started out within the same node</li>
<li><code>changedTouches</code>: A list of information for every finger that has changed state due to the event (see below)</li>
</ul>
<p>To better understand what might be in these lists, let&#8217;s go over some examples quickly.</p>
<ul>
<li>When you put one finger down, all three lists will provide the same information.</li>
<li>When you put a second finger down, <code>touches</code> will contain two items, one for each finger. <code>targetTouches</code> will have two items only if the second finger was placed in the same node as the first finger (otherwise it will only contain the second finger). <code>changedTouches</code> will only have information related to the second finger, because it’s what triggered the event.</li>
<li>If you put two fingers down at exactly the same time, you will get two items in <code>changedTouches</code>, one for each finger that triggered the event.</li>
<li>If you move your fingers, the only list that will change is <code>changedTouches</code>. It will contain information about the finger or fingers that moved.</li>
<li>When you lift a finger, it will be removed from <code>touches</code> and <code>targetTouches</code>, and will appear in <code>changedTouches</code>, since it’s what caused the event.</li>
<li>Removing your last finger will leave <code>touches</code> and <code>targetTouches</code> empty, and <code>changedTouches</code> will contain information about the last finger.</li>
</ul>
<p>Using these lists, it is possible to keep very close tabs on what the user is doing. Imagine creating a(nother) Super Mario clone in JavaScript—you’d be able to tell what direction pad the user currently has his or her thumb on, while also being able to watch for when the user wants to jump or shoot a fireball when they touch another virtual button elsewhere.</p>
<p>So far, we’ve been discussing lists of information about fingers on the screen, but we haven’t talked about what this information looks like. The objects contained in the touches lists have properties similar to what you&#8217;d see on a <code>MouseEvent</code> object. The following is the full list of properties for these objects:</p>
<ul>
<li><code>clientX</code>: X coordinate of touch relative to the viewport (excludes scroll offset)</li>
<li><code>clientY</code>: Y coordinate of touch relative to the viewport (excludes scroll offset)</li>
<li><code>screenX</code>: Relative to the screen</li>
<li><code>screenY</code>: Relative to the screen</li>
<li><code>pageX</code>: Relative to the full page (includes scrolling)</li>
<li><code>pageY</code>: Relative to the full page (includes scrolling)</li>
<li><code>identifier</code>: An identifying number, unique to each touch point (finger) currently active on the screen</li>
<li><code>target</code>: The DOM node that the finger is touching</li>
</ul>
<p>One of the annoyances of writing Web applications for smartphones has been that even if you set a viewport for your application, dragging your finger around will move the page. Fortunately, the <code>touchmove</code> event object has a <code><a href="http://developer.mozilla.org/en/docs/DOM:event.preventDefault">preventDefault</a></code> method that can be used to keep the page still.</p>
<h3>Drag and drop with the Touch API</h3>
<p>Creating drag and drop functionality on touchscreen devices is made easier due to the fact that <code>touchmove</code> events only fire when a finger is already touching the screen’s surface. This means we don’t need to track button states like we would with a <code>mousemove</code> event. A basic drag and drop implementation, then, can look as simple as this:</p>
<pre lang="javascript">node.addEventListener("touchmove", function(event){
    // Only deal with one finger    
    if(event.touches.length == 1){ 
        // Get the information for finger #1
        var touch = event.touches[0], 
            // Find the style object for the node the drag started from
            style = touch.target.style; 
        // Position the element under the touch point
        style.position = "absolute"; 
        style.left = touch.pageX + "px";
        style.top = touch.pageY + "px";
    }
}, false);</pre>
<h2>Better touching in Dojo 1.7</h2>
<p>One of the problems with using low-level touch events is that, if you are creating an application that you want to function on both touch-enabled <em>or</em> mouse-enabled devices, you end up needing to set up two sets of event listeners. The new <a href="http://dojotoolkit.org/reference-guide/dojo/touch.html"><strong>dojo/touch</strong></a> module in Dojo 1.7 normalizes these two types of events, using touch events where available and falling back to mouse events on other platforms in order to provide device-neutral events. Using it is just as easy as listening for a regular event, except instead of passing a string for the event name, you instead pass a function in place of the event name:</p>
<pre lang="javascript">require([ "dojo", "dojo/touch" ], function(dojo, touch){
    dojo.connect(dojo.byId("myElement"), touch.press, function(event){
        // handle a mousedown/touchstart event
    });
    dojo.connect(dojo.byId("myElement"), touch.release, function(event){
        // handle a mouseup/touchend event
    });
});</pre>
<h2>Gestures</h2>
<p>On iOS devices, a gesture event occurs any time two or more fingers are touching the screen. If any finger lands in a node you are listening for gesture events on (<code>gesturestart</code>, <code>gesturechange</code>, <code>gestureend</code>), you’ll receive the corresponding gesture events.</p>
<p>Gesture events provide a <a href="http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/GestureEventClassReference/GestureEvent/GestureEvent.html<br />
"><code>GestureEvent</code></a> object with these properties:</p>
<ul>
<li><code>rotation</code>: The amount the user has rotated their fingers, in degrees.</li>
<li><code>scale</code>: A multiplier indicating the amount the user has pinched or pushed their fingers, where numbers larger than 1 indicate a push, and numbers smaller than 1 indicate a pinch.</li>
</ul>
<p>When listening for both gesture events and touch events, the event pattern looks like this:</p>
<ol>
<li><code>touchstart</code> for finger 1.</li>
<li><code>gesturestart</code> when the second finger touches the surface.</li>
<li><code>touchstart</code> for finger 2.</li>
<li><code>gesturechange</code> sent every time both fingers move while still touching the surface.</li>
<li><code>gestureend</code> when the second finger leaves the surface.</li>
<li><code>touchend</code> for finger 2.</li>
<li><code>touchend</code> for finger 1.</li>
</ol>
<h3>Resizing and rotating with the Gestures API</h3>
<p>Using the CSS <code>transform</code>, <code>width</code>, and <code>height</code> properties, we can easily rotate and scale any element in response to these gestures.</p>
<pre lang="javascript">var width = 100,
    height = 200,
    rotation = 0;

node.addEventListener("gesturechange", function(event){
    var style = event.target.style;
    // scale and rotation are relative values,
    // so we wait to change our variables until the gesture ends
    style.width = (width * event.scale) + "px";
    style.height = (height * event.scale) + "px";
    style.webkitTransform = "rotate(" + ((rotation 
      + event.rotation) % 360) + "deg)";
}, false);

node.addEventListener("gestureend", function(event){
    // Update the values for the next time a gesture happens
    width *= event.scale;
    height *= event.scale;
    rotation = (rotation + event.rotation) % 360;
}, false);</pre>
<h2>Better gestures with Dojo 1.7</h2>
<p>Dojo 1.7 includes a new package, <a href="http://dojotoolkit.org/reference-guide/dojox/gesture.html"><strong>dojox/gesture</strong></a>, that provides functionality for handling more complex gestures on touch-sensitive devices. In addition to defining a basic framework for creating your own custom gestures through extension of the <code>dojox/gesture/Base</code> module, it comes with built-in support for several common gestures, including tap, tap and hold, double tap, and swipe.</p>
<p>Using dojox gestures couldn’t be much simpler. Just like dojo/touch, in order to listen for a gesture, you simply connect to a gesture event using <code>dojo.connect</code>, passing the gesture function in place of the event name:</p>
<pre lang="javascript">require([ "dojo", "dojox/gesture/swipe", "dojox/gesture/tap" ], 
        function(dojo, swipe, tap){
    dojo.connect(dojo.byId("myElement"), swipe, function(event){
        // handle swipe event
    });

    dojo.connect(dojo.byId("myElement"), tap.doubletap, function(event){
        // handle double tap event
    });
});</pre>
<p>In time, dojox/gesture will be extended to include more complex event types and behaviors, such as pinching and zooming. For now, it provides several new events that were difficult to handle before, as well as an excellent framework that can be used to create complex gesture events across all platforms.</p>
<p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.sitepen.com/blog/2011/12/07/touching-and-gesturing-on-iphone-android-and-more/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>dojox.app: A single-Page Application Framework</title>
		<link>http://www.sitepen.com/blog/2011/09/30/dojox-app-a-single-page-application-framework/</link>
		<comments>http://www.sitepen.com/blog/2011/09/30/dojox-app-a-single-page-application-framework/#comments</comments>
		<pubDate>Fri, 30 Sep 2011 09:00:46 +0000</pubDate>
		<dc:creator>Colin Snover</dc:creator>
				<category><![CDATA[Dojo]]></category>
		<category><![CDATA[mobile]]></category>

		<guid isPermaLink="false">http://www.sitepen.com/blog/?p=3152</guid>
		<description><![CDATA[<p>dojox.app is a small application framework providing a set of classes to manage the lifecycle and behavior of a single page application hosted on mobile or desktop platforms. The main class, Application, is responsible for managing the lifecycle of the application and is designed to be easily modified with additional custom behaviors. An Application instance [...]</p><p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></description>
				<content:encoded><![CDATA[<p><code>dojox.app</code> is a small application framework providing a set of classes to manage the lifecycle and behavior of a single page application hosted on mobile or desktop platforms. The main class, <code>Application</code>, is responsible for managing the lifecycle of the application and is designed to be easily modified with additional custom behaviors. An <code>Application</code> instance contains <code>Scene</code> objects and <code>View</code> objects which provide the visible user interface. The available views, scenes, module dependencies, and other information about the application are all passed into the <code>Application</code> class using a JSON configuration file (by convention).</p>
<p><span id="more-3152"></span></p>
<h2>config.json</h2>
<p>The main configuration file defines all of the dependencies, application behaviors, top level views and scenes, and any other information required for the application to function.</p>
<h3>Example config</h3>
<pre lang="javascript">{
	/* global application dependencies */
	"dependencies": [
		"dojox/mobile/Heading",
		"dojo/mobile/RoundRect",
		"my/custom/module"
	],

	/* Application Modules.  These are implicitly added
	  to the above set of dependencies */
	"modules": [
		"dojox/app/module/history",
		"my/custom/appModule"
	],

	/* The html template for the application itself */
	"template": "example.html",

	/* the view to start on by default */
	"defaultView": "home",

	/* transition to use if none has been provided */
	"defaultTransition": "slide",

	/* Views and Scenes */
	"views": {

		/* home is a top level dojox.app.view */
		"home": {

			/* class to instantiate this view as */
			"type": "dojox.app.view",

			/* dependencies specific to this view */
			"dependencies": [
				"dojox/mobile/ListItem",
				"dojox/mobile/EdgeToEdgeCategory"
			],

			/* template to use for this view */
			"template": "views/home.html"
		},
	
		/* tabscene is a dojox.app.scene,
		  and it contains three child views */
		"tabscene": { 
			/* class to instantiate, a scene in this case */
			"type": "dojox.app.scene",

			/* the scene's template */
			"template": "tabScene.html",

			/* the default view within this scene */	
			"defaultView": "tab1",

			/* when transitioning between tabs,
			  use a flip animation by default */
			"defaultTransition": "flip",

			/* the views available to this scene */
			"views": { 
				"tab1":{
					"template": "views/tabs/tab1.html" 
				},
				"tab2":{
					"template": "views/tabs/tab2.html" 
				},
				"tab3":{
					"template": "views/tabs/tab3.html" 
				}
			},

			/* dependencies specific to this scene */
			"dependencies": [
				"dojox/mobile/RoundRectList",
				"dojox/mobile/ListItem",
				"dojox/mobile/EdgeToEdgeCategory"
			]
		}
	}
}</pre>
<h3>Configuration property descriptions</h3>
<ul>
<li><code>dependencies</code> – When defined at the root of the configuration, this property defines the modules that are required for the whole application. When defined under a scene or a view, this property defines which modules must be loaded before that view/scene can be instantiated.</li>
<li><code>modules</code> – This property defines application modules that will be mixed into the <code>Application</code> class to control the lifecycle and behavior of the application. In other words, the <code>Application</code> class that is instantiated for a given site is dynamically created at runtime using the base <code>Application</code> class plus this list of modules.</li>
<li><code>template</code> – When defined at the root of the configuration, this property defines the template that is used for the application’s layout. Within the context of a view or a scene, this property defines the template used to define the view or scene.</li>
<li><code>defaultView</code> – This property defines the initial view that is loaded by the application.</li>
<li><code>defaultTransition</code> –  When defined at the root of the configuration, this property defines the default visual transition method used for top level views/scenes. When defined under a scene, it is the default transition method for the associated scene only.</li>
<li><code>views</code> – The views property is a nested set of objects defining the views and scenes available to an application or scene. These will be discussed in greater detail later.</li>
</ul>
<p>Some additional properties, such as <code>models</code>, <code>stores</code>, <code>id</code>, <code>name</code>, and <code>description</code> are reserved for future use; their exact definitions and usages are still under development.</p>
<h2>The Application class</h2>
<p>The <code>Application</code> class itself is actually an abstract class and is never used directly. It is a very simple extension of the Scene class (described below). <code>dojox.app</code> provides a generator function, which, when passed a configuration object, will build and automatically start the actual <code>Application</code> instance for the site. Its usage looks like this:</p>
<pre lang="javascript">require(["dojo/json", "dojox/app", "dojo/text!./config.json"],
function(json, makeApplication, config){
	makeApplication(json.parse(config));
});</pre>
<h2>The Scene class</h2>
<p>The <code>Scene</code> class provides a templated container for views. Its purpose is to allow the layout of a scene to be provided using an HTML template and to define a set of child views that the scene can transition between. For example, to display a set of tabs, you would use a <code>Scene</code> configured with a child <code>View</code> for each tab. The scene&#8217;s template would define where to display the tab controls and the view.</p>
<p>Internally, <code>Scene</code> steals some concepts from <code>dijit.layout</code> and <code>dijit._Templated</code>. The default template for the base Scene class is pretty simple and not really much of a template—it simply outputs whatever content is in the current view. Elements within a scene’s template can use the <code>region</code> attribute to define where that element and its children should be displayed, similar to a <code>dijit.layout.BorderContainer</code>. For example, to implement a tab scene, the template might look like this (using components from <code>dojox.mobile</code>):</p>
<pre>&lt;div style="background:#c5ccd3;" class="view mblView"> 
	&lt;div region="top" dojoType="dojox.mobile.Heading">
		Tab Scene
	&lt;/div>
	&lt;ul region="top" dojoType="dojox.mobile.TabBar"
		barType="segmentedControl">
		&lt;li dojoType="dojox.mobile.TabBarButton"
			icon1="images/tab-icon-16.png"
			icon2="images/tab-icon-16h.png"
			transitionOptions='{title:"TabScene-Tab1",
				target:"tabscene,tab1",
				url: "#tabscene,tab1"}' selected="true">Tab 1&lt;/li>
		&lt;li dojoType="dojox.mobile.TabBarButton"
			icon1="images/tab-icon-15.png"
			icon2="images/tab-icon-15h.png"
			transitionOptions='{title:"TabScene-Tab2",
				target:"tabscene,tab2",
				url: "#tabscene,tab2"}'>Tab 2&lt;/li>
		&lt;li dojoType="dojox.mobile.TabBarButton"
			icon1="images/tab-icon-10.png"
			icon2="images/tab-icon-10h.png"
			transitionOptions='{title:"TabScene-Tab3",
				target:"tabscene,tab3",
				url: "#tabscene,tab3"}'>Tab 3&lt;/li>
	&lt;/ul>
&lt;/div></pre>
<p>This above template defines two areas with <code>region="top"</code>: a header and list of tab buttons. They will both be placed at the top of this scene when rendered.</p>
<p>Normally, when using a BorderContainer, one would also have a <code>region="center"</code> section. In the case of a <code>Scene</code>, however, the &#8220;center&#8221; region will be applied automatically to the currently active view (the current tab, for example).</p>
<p>In addition to the code that supports the appropriate lifecycle of the scene and its rendering, <code>Scene</code> provides a transition method which controls the transition of content from one child view to another. Scenes can contain both views and other scenes.</p>
<h2>The View class</h2>
<p>Views, like scenes, are also containers of content. However, instead of containing additional views as children, they contain only the content defined by their template. Unlike a <code>Scene</code>, a <code>View</code> cannot contain any other scenes or views.</p>
<h2>Summary</h2>
<p>All three of these classes are intended to be as simple and feature-free as possible, providing only the basic structure and lifecycle described above (though additional core methods &amp; lifecycle hooks will be added in time). A developer using the <code>dojox.app</code> framework can define additional custom view or scene types by extending the base classes (or implementing equivalent functionality) and defining them in the application’s configuration file.</p>
<h2>TODO</h2>
<p><code>dojox.app</code> is an experimental framework with several key pieces still under development. This final release is expected to occur prior to Dojo 2.0. The following items are currently under development:</p>
<ul>
<li>Model/Store support – We have a couple of preliminary implementations of model/store support, including one for <code>dojox.mvc</code>. However, additional work is required to complete an agreed-upon API for these components. While MVC systems will be given first class support, they will not be required—an application developer will be able to “control” the HTML of a view just as well by extending the <code>View</code> class instead.</li>
<li>Desktop/Mobile Branching – <code>dojox.app</code> is designed to be platform-agnostic. Using CSS media selectors and property definitions within the configuration file, there will be support for choosing which set of views and parameters to use based on the user’s browser.</li>
<li>Intelligent build support – For performance, especially on the mobile side, an appropriate build of the application is required. Rather than add a separate build profile for the app, a wrapper utility will be created to intelligently generate builds directly from the configuration file.</li>
</ul>
<p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.sitepen.com/blog/2011/09/30/dojox-app-a-single-page-application-framework/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>dojo/on: New Event Handling System for Dojo</title>
		<link>http://www.sitepen.com/blog/2011/08/03/dojoon-new-event-handling-system-for-dojo/</link>
		<comments>http://www.sitepen.com/blog/2011/08/03/dojoon-new-event-handling-system-for-dojo/#comments</comments>
		<pubDate>Wed, 03 Aug 2011 07:01:49 +0000</pubDate>
		<dc:creator>Kris Zyp</dc:creator>
				<category><![CDATA[Dojo]]></category>
		<category><![CDATA[mobile]]></category>

		<guid isPermaLink="false">http://www.sitepen.com/blog/?p=2443</guid>
		<description><![CDATA[<p>Dojo 1.7 includes a rewrite of the event handling system and introduces a new module, dojo/on, to provide lighter-weight, faster, more succinct, and more direct event handling. The new event system is highly optimized for mobile applications, with a lightweight footprint and cross-platform touch event normalization. While Dojo continues to provide backwards compatibility with dojo.connect, [...]</p><p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></description>
				<content:encoded><![CDATA[<p>Dojo 1.7 includes a rewrite of the event handling system and introduces a new module, <code>dojo/on</code>, to provide lighter-weight, faster, more succinct, and more direct event handling. The new event system is highly optimized for mobile applications, with a lightweight footprint and cross-platform touch event normalization. While Dojo continues to provide backwards compatibility with <code>dojo.connect</code>, the <code>dojo/on</code> module eliminates much of code that is rarely used in <code>dojo.connect</code> and can be loaded in 5.2KB minified, half the size of <code>dojo.connect</code>, and fires non-native events twice as fast.  The <code>dojo/on</code> module also includes new functionality for extension events, dispatching events, and providing a base class/mixin for adding event emitting functionality to classes. In addition, there is now a new <code>on()</code> method for <code>NodeLists</code> (the results of <code>dojo.query()</code>) based on the new event listening with event delegation.</p>
<p><span id="more-2443"></span></p>
<h3>Using dojo/on</h3>
<p><code>dojo/on</code> has a similar API to <code>dojo.connect</code>. You still provide a target object or DOM node, the event name to listen for, and the listener. Dojo 1.7 now has full support for the AMD module format, so we will get a reference to the on function directly from the dependency list, and then use the on function:</p>
<pre lang="javascript">
define(["dojo/on"], function(on){
  var target = dojo.byId("target-id");
  on(target, "click", function(event){
    // executed when target is clicked
  });
});
</pre>
<p>The on function is also similar to <code>dojo.connect</code> in providing essential event normalization. The returned events should have standard W3C event properties including <code>target</code> and <code>currentTarget</code> and methods including <code>stopPropagation()</code> and <code>preventDefault()</code>, even on Internet Explorer (back to version 6). <code>dojo/on</code> does separate out some of the less used and non-standard <code>keypress</code> and <code>mouseenter/leave</code> normalization as extension events (it is still incorporated in <code>dojo.connect</code> for backwards compatibility).</p>
<h3>Event Delegation</h3>
<p>One of the exciting new features with the new event handling system is the addition of event delegation support in Dojo base/core. Event delegation is a powerful mechanism, where we register a single event listener on the DOM to handle events that can bubble up from multiple sources. The new event delegation system makes it easy to select acceptable DOM nodes to accept propagating events from, and properly react to. Event delegation has existed in Dojo previously in <code>dojox/NodeList/delegate.js</code>, but with support in the core event system, delegation is now very convenient to use. You provide an event name, colon prefixed with the a CSS selector to specify which nodes can bubble to the listener. The listener will be called if the an element inside the target element fires an event and that element matches the CSS selector in the scope of the target element. When the listener is called, the <code>this</code> object will be set to the child element that matched the selector. For example, if we had a form with several &lt;button> elements on it, we could listen for click events on any of the buttons with:</p>
<pre lang="javascript">
form = dojo.byId("my-form");
on(form, "button:click", function(event){
  // event -> The event object
  // this -> The button element
});
</pre>
<p>Or we could listen for change events on an text inputs within the &lt;div> with a class of &#8220;details&#8221;:</p>
<pre lang="javascript">
on(form, 'div.details input[type="text"]:change', changeHandler);
</pre>
<p>We can also comma-delimit multiple events to listen to. For example, to listen to submit events on the form and clicks on &lt;button> elements, we could do:</p>
<pre lang="javascript">
on(form, "submit, button:click", submitHandler);
</pre>
<h3>NodeList&#8217;s on()</h3>
<p>One of ways to use the new event listening module is by using the <code>on()</code> method for <code>NodeList</code>&#8216;s returned from <code>dojo.query</code>. The <code>on()</code> method is based on <code>dojo/on</code>, and gives us access to all the new features and performance, including event delegation. We use <code>NodeList's on()</code> just like Dojo <code>on()</code> except that we don&#8217;t need to provide a node as the first argument, all the nodes in the <code>NodeList</code> are targeted. For example, we could query for all &lt;button> elements and listen for clicks:</p>
<pre lang="javascript">
define(["dojo/query"], function(query){
  query("button").on("click", clickHandler);
  ...
</pre>
<p>We could also use event delegation, here getting any &lt;form> elements and listening for clicks on any &lt;button> children:</p>
<pre lang="javascript">
query("form").on("button:click", clickHandler);
</pre>
<h3>Extension Events</h3>
<p>Another new feature of <code>dojo/on</code> is support for extension events, allowing for listening to custom events that may be aggregates of multiple events or emulation of events not supported by the browser. Dojo 1.7 now includes a whole library of gesture events that are extension events, like swipe, tap, and more. These events are particularly useful for mobile applications where high-level events are composed from low-level events. For example, to listen for a swipe event, we could do:</p>
<pre lang="javascript">
define(["dojo/on", "dojox/gesture/swipe"], function(on, swipe){
  on(node, swipe.left, function onSwipeLeft(){
    // called on a swipe left
  });
});
</pre>
<p>The swipe gestures are an example of an extension event that is based on other events (<code>touchstart, touchmove, touchend</code>). </p>
<h3>Legacy Code as Extensions</h3>
<p>To reduce the size of <code>dojo/on</code> and improve modularity, there are several other event emulation mechanisms there were moved out of the <code>connect.js</code> module into extension events (these are still included by <code>connect.js</code> for backwards compatibility), including extension events based on IE&#8217;s non-bubbling <code>mouseenter</code> and <code>mouseleave</code> events, (unfortunately the standard <code>mouseover</code> and <code>mouseout</code> do bubble, which makes them painful to use). You can use the use <code>enter</code> and <code>leave</code> extension events from <code>dojo/mouse</code> to emulate IE&#8217;s events cross-browser:</p>
<pre lang="javascript">
define(["dojo/on", "dojo/mouse"], function(on, mouse){
  on(node, mouse.enter, function hover(){
    dojo.addClass(node, "hovering");
  });
  on(node, mouse.leave, function unhover(){
    dojo.removeClass(node, "hovering");
  });
});
</pre>
<p>There is also an extension event for emulating Firefox&#8217;s <code>keypress</code> behavior, but this emulated behavior is not terribly helpful, and using this emulator is not recommended and exists purely for backwards-compatibility (it is used to retain <code>dojo.connect</code>&#8216;s current behavior). Even with the <code>dojo.connect</code> API and the extension events for full backwards compatibility, the total module size is still smaller than the  <code>dojo.connect</code> module from Dojo 1.6.</p>
<h3>Touch Normalization</h3>
<p>The new event system now includes normalization for standard touch events. <code>dojo/on</code> (<code>dojo.connect</code>) now ensures that touch events include the standard <code>pageX, pageY, rotation, scale</code>, and other touch properties on all devices. It also normalizes the <code>orientationchange</code> on non-conformant Android devices. You can listen for touch events like any other standard event:</p>
<pre lang="javascript">
on(node, "touchstart", function(){
  // called on a touchstart event
});
</pre>
<h3>Emitting Events</h3>
<p>The <code>dojo/on</code> module also adds support for emitting custom events using native browser event delegation mechanisms. The new <code>on.emit</code> function can be used to create custom native events that can trigger DOM listeners, and includes support for bubbling and cancelling. This is used in Dojo Mobile to create transition events, for example.</p>
<h3>Faster, Lighter</h3>
<p>The new <code>dojo/on</code> module is a compact, fast module with minimal dependencies designed for lightweight mobile applications. Along with these new features, a significant amount of heavy legacy code has been left out of <code>dojo/on</code>, and moved out to separate modules. The <code>dojo/on</code> module also leverages Dojo&#8217;s new <code>has()</code> feature branching capabilities for creating small lightweight, browser-specific builds. </p>
<p>This blog post should give you an introduction to the new capabilities of <code>dojo/on</code>, you can refer to the <a href="http://dojotoolkit.org/reference-guide/dojo/on.html">dojo.on documentation</a> for more information.</p>
<p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.sitepen.com/blog/2011/08/03/dojoon-new-event-handling-system-for-dojo/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Dojo Mobile Tutorial: Finishing Up TweetView</title>
		<link>http://www.sitepen.com/blog/2011/04/20/dojo-mobile-tutorial-finishing-up-tweetview/</link>
		<comments>http://www.sitepen.com/blog/2011/04/20/dojo-mobile-tutorial-finishing-up-tweetview/#comments</comments>
		<pubDate>Wed, 20 Apr 2011 20:40:36 +0000</pubDate>
		<dc:creator>Torrey Rice</dc:creator>
				<category><![CDATA[Dojo]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.sitepen.com/blog/?p=2501</guid>
		<description><![CDATA[<p>Continuing our series of Dojo mobile tutorials, we wrap up our work on the TweetView app. TweetView: Android, Packaging, and Review In the previous two posts, Getting Started with TweetView: Tweets and Mentions and TweetView: Creating the Settings View, we created the HTML, CSS, and JavaScript code required to power the TweetView mobile application. This tutorial will focus on [...]</p><p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></description>
				<content:encoded><![CDATA[<p><img src="http://www.sitepen.com/blog/wp-content/uploads/2011/04/thumb7.jpg" alt="" title="thumb" width="100" height="100" class="alignnone size-full wp-image-2300" style="float:left; margin:1.6em 1em 1em 0" /><br />
Continuing our series of Dojo mobile tutorials, we wrap up our work on the TweetView app.</p>
<h2>TweetView: Android, Packaging, and Review</h2>
<p>In the previous two posts, Getting Started with TweetView: Tweets and Mentions and TweetView: Creating the Settings View, we created the HTML, CSS, and JavaScript code required to power the TweetView mobile application. This tutorial will focus on implementing an Android theme, leveraging the Dojo build system to keep the application compact for production, and a basic review of the entire dojox.mobile-powered application. Want to read more? <a href="http://dojotoolkit.org/documentation/tutorials/1.6/mobile/tweetview/packaging/">Check out the tutorial</a>.</p>
<h2>Want to see a specific Tutorial? Want to Learn More?</h2>
<p>Is there something you’d like to learn how to do with Dojo? Always wanted to know how something in Dojo works? Leave us a message in the blog comments and we’ll see about getting a tutorial created for you. Or <a href="http://www.sitepen.com/services/training.php#page_workshopEvent2">sign-up for an upcoming SitePen Dojo Workshop</a> to get a fully immersive hands-on experience with Dojo.</p>
<p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.sitepen.com/blog/2011/04/20/dojo-mobile-tutorial-finishing-up-tweetview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<series:name><![CDATA[Dojo Tutorials]]></series:name>
	</item>
		<item>
		<title>Dojo Mobile Tutorial: Getting Started with TweetView</title>
		<link>http://www.sitepen.com/blog/2011/04/06/dojo-mobile-tutorial-getting-started-with-tweetview/</link>
		<comments>http://www.sitepen.com/blog/2011/04/06/dojo-mobile-tutorial-getting-started-with-tweetview/#comments</comments>
		<pubDate>Wed, 06 Apr 2011 20:21:05 +0000</pubDate>
		<dc:creator>Torrey Rice</dc:creator>
				<category><![CDATA[Dojo]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.sitepen.com/blog/?p=2422</guid>
		<description><![CDATA[<p>This week in our series of Dojo mobile tutorials, we continue building our TweetView app. Getting Started with TweetView: Tweets and Mentions In the previous post, Introduction to TweetView, we introduced the mobile application we will be building with dojox.mobile: TweetView. We built the general layout template for our application and now it&#8217;s time to make TweetView [...]</p><p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></description>
				<content:encoded><![CDATA[<p><img src="http://www.sitepen.com/blog/wp-content/uploads/2011/04/thumb1.jpg" alt="" title="thumb" width="100" height="100" class="alignnone size-full wp-image-2300" style="float:left; margin:1.6em 1em 1em 0" /><br />
This week in our series of Dojo mobile tutorials, we continue building our TweetView app.</p>
<h2>Getting Started with TweetView: Tweets and Mentions</h2>
<p>In the previous post, Introduction to TweetView, we introduced the mobile application we will be building with <code>dojox.mobile</code>: TweetView. We built the general layout template for our application and now it&#8217;s time to make TweetView work. This tutorial will focus specifically on the &#8220;Tweets&#8221; and &#8220;Mentions&#8221; views of our application. Before we begin coding our application, let&#8217;s set up our application file structure and review a few mobile app development concepts. Sound interesting? <a href="http://dojotoolkit.org/documentation/tutorials/1.6/mobile/tweetview/starting_tweetview/">Check out the tutorial</a>.</p>
<h2>Want to see a specific Tutorial? Want to Learn More?</h2>
<p>Is there something you’d like to learn how to do with Dojo? Always wanted to know how something in Dojo works? Leave us a message in the blog comments and we’ll see about getting a tutorial created for you. Or <a href="http://www.sitepen.com/services/training.php#page_workshopEvent1">sign-up for an upcoming SitePen Dojo Workshop</a> to get a fully immersive hands-on experience with Dojo.</p>
<p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.sitepen.com/blog/2011/04/06/dojo-mobile-tutorial-getting-started-with-tweetview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<series:name><![CDATA[Dojo Tutorials]]></series:name>
	</item>
		<item>
		<title>Dojo Mobile Tutorial: Introducing TweetView</title>
		<link>http://www.sitepen.com/blog/2011/03/30/intro-dojo-mobile/</link>
		<comments>http://www.sitepen.com/blog/2011/03/30/intro-dojo-mobile/#comments</comments>
		<pubDate>Wed, 30 Mar 2011 17:51:16 +0000</pubDate>
		<dc:creator>Torrey Rice</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.sitepen.com/blog/?p=2358</guid>
		<description><![CDATA[<p>Take Dojo Everywhere Dojo 1.5 had initial support for creating mobile web apps and that work continued into Dojo 1.6. While you&#8217;ve been able to view the developer tests if you knew where to look, how to actually build an app with Dojo Mobile has been a trial and error process until now. Getting Started [...]</p><p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></description>
				<content:encoded><![CDATA[<p><img src="http://www.sitepen.com/blog/wp-content/uploads/2011/03/thumb3.jpg" alt="" title="thumb" width="100" height="100" class="alignnone size-full wp-image-2300" style="float:left; margin:0.3em 1em 1em 0" /></p>
<h2>Take Dojo Everywhere</h2>
<p>Dojo 1.5 had initial support for creating mobile web apps and that work continued into Dojo 1.6. While you&#8217;ve been able to view the developer tests if you <a href="http://download.dojotoolkit.org/release-1.6.0/dojo-release-1.6.0/dojox/mobile/tests/">knew where to look</a>, how to actually build an app with Dojo Mobile has been a trial and error process until now.</p>
<h2>Getting Started with dojox.mobile</h2>
<p>Before you can begin writing an app with Dojo Mobile you need to understand what Dojo Mobile is all about and how it works. Dojo Mobile is a framework of controllers, CSS3-based themes, and device-like widgets that will allow you to effortlessly create intelligent, flexible, and cross-device-compatible mobile web applications. <a href="http://dojotoolkit.org/documentation/tutorials/1.6/mobile/tweetview/getting_started"/>Our first Dojo Mobile tutorial</a> goes into detail on getting started with Dojo Mobile.</p>
<h2>Creating an App: Introduction to TweetView</h2>
<p>In the multi-part TweetView series, we&#8217;ll embark on creating our own fully functional dojox.mobile web application called TweetView. This tutorial will focus on familiarizing you with what TweetView is, what we want it to do, and we&#8217;ll get started on building the mobile application&#8217;s HTML and CSS layout. Sound interesting? <a href="http://dojotoolkit.org/documentation/tutorials/1.6/mobile/tweetview/intro_tweetview/">Check out the tutorial</a>.</p>
<h2>Want to see a specific Tutorial? Want to Learn More?</h2>
<p>Is there something you’d like to learn how to do with Dojo?  Always wanted to know how something in Dojo works?  Leave us a message in the blog comments and we’ll see about getting a tutorial created for you. Or <a href="http://www.sitepen.com/services/training.php#page_workshopEvent1">sign-up for an upcoming SitePen Dojo Workshop</a> to get a fully immersive hands-on experience with Dojo.</p>
<p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.sitepen.com/blog/2011/03/30/intro-dojo-mobile/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<series:name><![CDATA[Dojo Tutorials]]></series:name>
	</item>
		<item>
		<title>Platform Optimization Strategies for Ajax Toolkits</title>
		<link>http://www.sitepen.com/blog/2009/01/22/platform-optimization-strategies-for-ajax-toolkits/</link>
		<comments>http://www.sitepen.com/blog/2009/01/22/platform-optimization-strategies-for-ajax-toolkits/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 07:05:40 +0000</pubDate>
		<dc:creator>Dylan Schiemann</dc:creator>
				<category><![CDATA[air]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[browsers]]></category>
		<category><![CDATA[Dojo]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[thoughts]]></category>
		<category><![CDATA[browser detection]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[Performance]]></category>

		<guid isPermaLink="false">http://www.sitepen.com/blog/2009/01/22/platform-optimization-strategies-for-ajax-toolkits/</guid>
		<description><![CDATA[<p>With the proliferation of real web browsers on mobile devices (iPhone, Android, Palm Pre, Nokia), an increasing number of browsers (Chrome) or browser-like platforms (AIR, Titanium, Jaxer), portal standards for widgets and gadgets (Caja, AdSafe, work by the OpenAjax Alliance, and much more), are the days numbered for a JavaScript toolkit that uses the same [...]</p><p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></description>
				<content:encoded><![CDATA[<p>With the proliferation of real web browsers on mobile devices (iPhone, Android, Palm Pre, Nokia), an increasing number of browsers (Chrome) or browser-like platforms (AIR, Titanium, Jaxer), portal standards for widgets and gadgets (Caja, AdSafe, work by the OpenAjax Alliance, and much more), are the days numbered for a JavaScript toolkit that uses the same code base across all platforms without a compile step numbered?</p>
<p><span id="more-604"></span></p>
<p>Consider the following:</p>
<h4><a href="http://github.com/brianleroux/xui/tree/master">PhoneGap XUI</a></h4>
<blockquote><p>
&#8220;We hear your words. Why another JavaScript framework?! When development of PhoneGap was under way we noticed slow load times for modern JavaScript frameworks (such as Prototype, MooTools, YUI, Ext and (yes) even jQuery. A big reason why these libraries are so big is because is mostly they contain a great deal of cross browser compatability code. The mobile space has less browser implementations (so far) and different needs. Thus XUI.</p>
<p>XUI strives to be a framework for first class mobile device browsers such as WebKit, Fennec and Opera with future support under consideration for IE Mobile and BlackBerry.&#8221;
</p></blockquote>
<h4>Joe Hewitt&#8217;s <a href="http://code.google.com/p/iui/">iUI</a></h4>
<blockquote><p>
&#8220;First and foremost, iUI is not meant as a &#8220;JavaScript library&#8221;. Its goal is simply to turn ordinary standards-based HTML into a polished, usable interface that meets the high standards set by Apple&#8217;s own native iPhone apps.&#8221;
</p></blockquote>
<h4>John Resig&#8217;s war on <a href="http://docs.jquery.com/Release:jQuery_1.3">War on Browser Sniffing</a></h4>
<blockquote><p>
&#8220;As of 1.3, jQuery no longer uses any form of browser/userAgent sniffing internally &#8211; and is the first major JavaScript library to do so.</p>
<p>Browser sniffing is a technique in which you make assumptions about how a piece of code will work in the future. Generally this means making an assumption that a specific browser bug will always be there &#8211; which frequently leads to code breaking when browsers make changes and fix bugs.</p>
<p>Instead we use a technique called feature detection where we simulate a particular browser feature or bug to verify its existence. We&#8217;ve encapsulated all the checks that we use in jQuery into a single object: jQuery.support. More information about it, feature detection, and what this feature provides can be found in the jQuery.support documentation.&#8221;
</p></blockquote>
<h4><a href="http://dojofoundation.org/#tab-Sizzle">Sizzle</a>, a micro-toolkit for CSS Selectors that is now part of the Dojo Foundation</h4>
<blockquote><p>
&#8220;Sizzle is a pure-JavaScript CSS selector engine designed to be easily dropped in to a host library.</p>
<p>A completely standalone selector engine (no library dependencies), Sizzle provides competitive performance for the most frequently used CSS selectors. At only 3KB minified and gzipped, it is highly extensible with an easy-to-use API.</p>
<p>Sizzle is designed for optimal performance with event delegation, provides meaningful error messages for syntax problems, uses a single code path (no XPath), uses no browser-sniffing (feature-detection only), and is Caja-compatible.&#8221;
</p></blockquote>
<h4><a href="http://www.tibco.com/devnet/gi/default.jsp">TIBCO General Interface</a></h4>
<p>GI builds an optimized code tree for each major browser release (the opposite of the approach jQuery 1.3 and others have taken, as code only makes it into a build for that browser if that browser is known to support that functionality).</p>
<h4><a href="http://api.dojotoolkit.org/jsdoc/dojox/HEAD/dojox.gfx">dojox.gfx</a></h4>
<p>GFX supports SVG, VML, Canvas, Silverlight, and Flash with the same simple procedural drawing API, so you can target native and plugin rendering environments with one simple API.  In order to make this possible, dojox.gfx selectively loads only the code it needs based on the target rendering environment.  Loading the code for all platforms would be prohibitively expensive from a performance perspective.</p>
<h2>excludeStart(&#8220;webkitMobile&#8221;)</h2>
<p>In recent discussions on the Dojo mailing list, discussions turned to how to make Dojo faster for mobile users.  In most cases, this involves removing code and features that are not needed on that platform given the precious resources available on mobile devices and over mobile networks.</p>
<p>Alex Russell checked in some work he started last year that looks like this:</p>
<pre lang="javascript">
//>>excludeStart("webkitMobile", kwArgs.webkitMobile); 
!dojo.isIE &#038;&#038;  
//>>excludeEnd("webkitMobile"); 
</pre>
<p>The syntax is a bit verbose, but it excludes the code between the start and end in a Dojo build created for webkitMobile:</p>
<pre lang="bash">./build.sh profile=base action=clean,release webkitMobile=true</pre>
<p>While we would love to switch to pure feature detection over browser version detection like John has done with jQuery 1.3, version detection is generally more concise and precise, and does not necessarily make Dojo any less forwards compatible.</p>
<p>Version detection also makes it easy to exclude code created solely for browsers that require major workarounds, such as IE 6.  To get the most out of this though would require doing something similar for each major browser, which would make Dojo more challenging to understand and maintain, would probably require a build step even during development (not just in production to improve performance).</p>
<p>At this point, there are no clear answers, just a lot of questions on how to create a toolkit that offers edge of the web features for desktop users, and still preserves performance for mobile web users.  What approach do you think is best?</p>
<p>SitePen offers beginner, intermediate, and advanced Dojo Toolkit workshops to make your development team as skilled and efficient as possible when creating dynamic, responsive web applications.  <a href="http://sitepen.com/services/workshops/index.php">Sign up today!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.sitepen.com/blog/2009/01/22/platform-optimization-strategies-for-ajax-toolkits/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
