<?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>Aria Templates Blog</title>
	<atom:link href="http://ariatemplates.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://ariatemplates.com/blog</link>
	<description></description>
	<lastBuildDate>Wed, 22 May 2013 14:38:49 +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>Aria Templates 1.4.4</title>
		<link>http://ariatemplates.com/blog/2013/05/aria-templates-1-4-4/</link>
		<comments>http://ariatemplates.com/blog/2013/05/aria-templates-1-4-4/#comments</comments>
		<pubDate>Wed, 22 May 2013 14:38:49 +0000</pubDate>
		<dc:creator>Benoit Charbonnier</dc:creator>
				<category><![CDATA[Releases]]></category>

		<guid isPermaLink="false">http://ariatemplates.com/blog/?p=842</guid>
		<description><![CDATA[Unlike Spring that we are still waiting for in south of France, a new release of Aria Templates has landed into the repository. These are the changes introduced between 1.4.3 and 1.4.4 Double slider widget Add a DoubleSlider widget to the touch widget library. This widget has two independently movale thumbs. Close #489 See #489 &#8230;]]></description>
				<content:encoded><![CDATA[<p>Unlike <em>Spring</em> that we are still waiting for in south of France, a new release of Aria Templates has landed into the repository.</p>
<p>These are the changes introduced between 1.4.3 and 1.4.4</p>
<ul>
<li><strong>Double slider widget</strong><br />
<blockquote><p>Add a DoubleSlider widget to the touch widget library. This widget has two independently movale thumbs. Close #489</p>
<p>See <a href="https://github.com/ariatemplates/ariatemplates/issues/489">#489</a></p></blockquote>
</li>
<li><strong>Easy loading of templates in iframe</strong><br />
<blockquote><p>Provide a simple and reliable interface to load and test a template inside an iframe. This also attempts at deprecating the usage of iframeLoaderOs, see #435 Close #471</p>
<p>See <a href="https://github.com/ariatemplates/ariatemplates/issues/471">#471</a></p></blockquote>
</li>
<li><strong>Enhancements in DomElementWrapper</strong><br />
<blockquote>
<ol>
<li>Added support for WAI ARIA (`aria-*`) attributes in `getAttribute`</li>
<li>Added support for custom `data-*` attributes in `getAttribute` (previously they could have been retrieved only with `getData`)</li>
<li>Added support for expandos with multiple dashes (`data-foo-bar`) in `getData`/`getAttribute`</li>
<li>Added `setAttribute` Close #486</li>
</ol>
<p>See <a href="https://github.com/ariatemplates/ariatemplates/issues/486">#486</a></p></blockquote>
</li>
</ul>
<p>As usual, we also pushed some bugs fixing, just head over to <a href=" https://github.com/ariatemplates/ariatemplates/issues?milestone=19&amp;state=closed" target="_blank">the milestone report on Github</a></p>
]]></content:encoded>
			<wfw:commentRss>http://ariatemplates.com/blog/2013/05/aria-templates-1-4-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Userscripts: Augmenting and automating web browsing and debugging</title>
		<link>http://ariatemplates.com/blog/2013/05/userscripts-augmenting-and-automating-web-browsing-and-debugging/</link>
		<comments>http://ariatemplates.com/blog/2013/05/userscripts-augmenting-and-automating-web-browsing-and-debugging/#comments</comments>
		<pubDate>Mon, 06 May 2013 11:19:14 +0000</pubDate>
		<dc:creator>Jakub Gieryluk</dc:creator>
				<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[userscripts]]></category>

		<guid isPermaLink="false">http://ariatemplates.com/blog/?p=826</guid>
		<description><![CDATA[If you&#8217;re a JavaScript developer and don&#8217;t know what &#8220;userscript&#8221; means, you should keep reading. Userscripts are a powerful way to enhance and personalize your browsing experience and also help in some specific debugging purposes (without the power of the Fiddler, but much easier to use). The implemention of the idea started off in 2004 &#8230;]]></description>
				<content:encoded><![CDATA[<p><strong>If you&#8217;re a JavaScript developer and don&#8217;t know what &#8220;userscript&#8221; means, you should keep reading.</strong></p>
<p>Userscripts are a powerful way to enhance and personalize your browsing experience and also help in some specific debugging purposes (without the <a href="http://ariatemplates.com/blog/2013/02/debugging-javascript-css-html-from-a-remote-server-in-remote-browser-with-fiddler/">power of the Fiddler</a>, but much easier to use).</p>
<p>The implemention of the idea started off in 2004 as an extension to Firefox browser and caught on really well. As of 2013, <a href="https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/">Greasemonkey</a> is the <em>4th most installed ever</em> Firefox extension (giving way only to such stars as AdBlock Plus and Firebug)  &#8211; with over 2 millions of downloads, and over thousands of <a href="http://userscripts.org/">userscripts </a>available for one-click installation. Along the way, other browsers (Opera, Chrome) have implemented limited built-in support for userscripts and <a href="https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo?hl=en">Tampermonkey </a>project was created to offer a fully equivalent extension for Chrome.</p>
<p>If all that sounds interesting, you may have a look at the <a href="https://speakerdeck.com/jakubg/userscripts-augmenting-and-automating-web-browsing-and-debugging">presentation</a> on userscripts that I performed recently during our in-house Web Talks session, and see the sample <a href="https://github.com/jakub-g/gh-code-review-assistant/">GitHub assistant userscript</a> that adds some code-review capabilities to GitHub on-the-fly while you browse the page.</p>
<p><center><iframe src="https://speakerdeck.com/player/98b77fe093da01309d350aeaddcfc31a?"  width="800" height="600"></iframe></center></p>
]]></content:encoded>
			<wfw:commentRss>http://ariatemplates.com/blog/2013/05/userscripts-augmenting-and-automating-web-browsing-and-debugging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Aria Templates 1.4.2</title>
		<link>http://ariatemplates.com/blog/2013/04/aria-templates-1-4-2/</link>
		<comments>http://ariatemplates.com/blog/2013/04/aria-templates-1-4-2/#comments</comments>
		<pubDate>Tue, 16 Apr 2013 10:34:20 +0000</pubDate>
		<dc:creator>Fabio Crisci</dc:creator>
				<category><![CDATA[Releases]]></category>

		<guid isPermaLink="false">http://ariatemplates.com/blog/?p=814</guid>
		<description><![CDATA[This release marks a backward compatibility change and it&#8217;s the first one in the 1.4 family. Changes are mainly about code cleaning and removing old features. But first let&#8217;s see what&#8217;s new History enhancement Singleton class aria.utils.History provides a cross-browser implementation of HTML5 native history API. With respect to the previous version, this one is &#8230;]]></description>
				<content:encoded><![CDATA[<p>This release marks a backward compatibility change and it&#8217;s the first one in the <code>1.4</code> family.</p>
<p>Changes are mainly about code cleaning and removing old features.</p>
<p>But first let&#8217;s see what&#8217;s new</p>
<ul>
<li><strong>History enhancement</strong><br />
<blockquote><p>
				Singleton class aria.utils.History provides a cross-browser implementation of HTML5 native history API. With respect to the previous version, this one is more compliant with the standard behaviour:</p>
<ul>
<li>the <code>onpopstate</code> class event is not raised after a <code>pushState</code> or <code>replaceState</code>.</li>
<li>the <code>state</code> property is available on the singleton and it corresponds to <code>window.history.state</code>.</li>
</ul>
<p>support for page reload and external navigation is supported also in browsers for which hash-based navigation fallback occurs (with the exception of IE7, for which the previous history is not kept after reloading, but only the current state is available). However, the new version is backward compatible with the previous one. In order to disable backward compatibility, set <code>aria.utils.History.isBackwardCompatible</code> to false right after loading the class.<br />
				<br/><br />
				See <a href="https://github.com/ariatemplates/ariatemplates/issues/441">#441</a>
			</p></blockquote>
</li>
<li><strong>Ability to use Aria Templates without skin</strong><br />
<blockquote><p>
				If you do not use widgets from @aria Library, you no longer have to include the Aria skin in your application &#8211; you may load only the framework. However, this will mean that you&#8217;ll probably have to manually add some CSS if you want to preserve the site&#8217;s look and feel, as font settings etc. naturally won&#8217;t be loaded if you don&#8217;t have a skin.<br />
				<br/><br />
				See <a href="https://github.com/ariatemplates/ariatemplates/issues/427">#427</a>
			</p></blockquote>
</li>
<li><strong>Bindable popup state</strong><br />
<blockquote><p>
				This feature allows to programmatically open the drop down of the following widgets in the standard aria library: Select (not in simpleHTML mode), SelectBox, MultiSelect, AutoComplete (with expand button) and DatePicker. The state of the drop down can be bound to the data model.  close #411 close #413<br />
				<br/><br />
				See <a href="https://github.com/ariatemplates/ariatemplates/issues/413">#413</a>
			</p></blockquote>
</li>
<li><strong>Focus not visible on buttons</strong><br />
<blockquote><p>
				Two new states (normalFocused and msoverFocused) are now available on @aria:Button widgets so that the focused state is visible to the user. Any skin can now define specific background images for those new states. The skins provided with Aria Templates (atdefskin, atskin, atwiki and epiphany) are now updated to display a 1px dotted black border when the button is focused.<br />
				<br/><br />
				See <a href="https://github.com/ariatemplates/ariatemplates/issues/437">#437</a>
			</p></blockquote>
</li>
</ul>
<h3>Removed features</h3>
<p>The following deprecated features are now removed</p>
<ul>
<li>
	<i>(deprecated in 1.0.x) </i><br />
	The <code>setEnvironment</code>	method in <code>aria.core.environment.EnvironmentBase</code> and <code>aria.core.environment.Customizations </code>.</p>
<dl>
<dd>
		Please use <code>aria.core.AppEnvironment.setEnvironment</code>instead. </dd>
</dl>
</li>
<li>
	<i>(deprecated in 1.0.x) </i><br />
	<code>getWidgetLib</code> and <code>getWidgetLibClassName</code> methods in <code>aria.widgets.environment.WidgetSettings</code>.</p>
<dl>
<dd>
		Consider using <code>aria.widgetLibs.environment.WidgetLibsSettings.getWidgetLibs</code> and <code>Aria.getClassRef</code> instead. </dd>
</dl>
</li>
<li>
	<i>(deprecated in 1.0.x) </i><br />
	<code>aria.widgets.environment.WidgetSettingsCfgBeans.defaultWidgetLib</code></p>
<dl>
<dd>
		Use <code>aria.widgetLibs.environment.WidgetLibsSettingsCfgBeans.AppCfg.defaultWidgetLibs</code> instead. </dd>
</dl>
<li>
	<i>(deprecated in 1.0.x) </i><br />
	<code>aria.widgets.AriaLib.registerWidget</code> and <code>.getBeanConfig</code> methods were removed </li>
<li>
	<i>(deprecated in 1.0.x) </i><br />
	the <code>aria.utils.Event.getElement</code> method was removed <i>(it was marked as protected, so you likely haven&#8217;t used it) </i>
	</li>
<li>
	<i>(deprecated in 1.0.x) </i><br />
	<code>_formatCache</code> in <code>aria.utils.Number</code> <i>(it was marked as private, so you should have not relied on it)</i>
	</li>
<li>
	<i>(deprecated in 1.0.x) </i><br />
	<code>onvalidate</code>	callback in the config of <code>@aria:TextInput</code> and <code>@aria:Select</code> widgets </li>
<li>
	<i>(deprecated in 1.0.x) </i><br />
	objects in interface definition are no longer represented as <code>{}</code></p>
<dl>
<dd>
		Use either as <code>{$type: "Object"}</code><br />
		or a shortcut notation <code>"Object"</code>
		</dd>
</dl>
</li>
<li>
	<i>(deprecated in 1.1-5) </i><br />
	<code>color</code> property in the config of <code>@aria:Link</code> widget </li>
<li>
	<i>(deprecated in 1.1-18) </i><br />
	<code>DomElementWrapper.getData()</code> no longer internally checks for expandos prefixed with &#8216;_&#8217;.</p>
<dl>
<dd>
		Please use &#8216;data-&#8217; prefix for expandos in your HTML instead. <i>(Note: most of related code was already removed in 1.3.1) </i>
		</dd>
</dl>
</li>
<li>
	<i>(deprecated in 1.1-25) </i><br />
	<code>aria.resources.DateRes.firstDayOfWeek</code></p>
<dl>
<dd>
		Please use it through <code>aria.core.AppEnvironment</code>. </dd>
</dl>
</li>
<li>
	<i>(deprecated in 1.1-31) </i><br />
	<code>aria.widgets.frames.OldFrame</code>, the old type of frames corresponding to sprType 0,1 and 2.</p>
<li>
	<i>(deprecated in 1.2-5) </i><br />
	whole <code>aria.utils.FormatFactory</code> class </li>
<li>
	<i>(deprecated in 1.2-4) </i><br />
	This release introduces also some changes in the skinning system and CSS.</p>
<p>	The following skin property is no longer supported:</p>
<ul>
<li>
		<code>general.colors.bkg</code>
		</li>
</ul>
<p>
		You should also make sure that the skin you&#8217;re using, has defined the following properties, which were using the fallback value of the now removed <code>general.colors.bkg </code>	if not defined
	</p>
<ul>
<li>
		Calendar.&lt;sclass&gt;.generalBackgroundColor </li>
<li>
		Calendar.&lt;sclass&gt;.dayBorderColor </li>
<li>
		Calendar.&lt;sclass&gt;.unselectableBorderColor </li>
</ul>
<p>
		 (they&#8217;re all defined in atdefskin and epiphany skins for &#8220;std&#8221; sclass, set to white).
	</p>
<p>
		 The following global CSS is no longer added by Aria Templates (consider adding it manually if you need it):
	</p>
<p>	<code></p>

<div class="wp_syntax"><table><tr><td class="code"><div class="javascript" style="font-family:monospace;">body <span style="color: #F8F8F8;">&#123;</span> padding<span style="color: #F8F8F8">:</span> <span style="color: #FF3A83;">0</span><span style="color: #F8F8F8">;</span> margin<span style="color: #F8F8F8">:</span> <span style="color: #FF3A83;">0</span><span style="color: #F8F8F8">;</span> cursor<span style="color: #F8F8F8">:</span><span style="color: #37A3ED">default</span><span style="color: #F8F8F8">;</span> <span style="color: #F8F8F8;">&#125;</span></div></td></tr></table></div>

<p></code></p>
<p>Additionally, due to internal changes, you may need to include <code>aria.core.CmlClassLoader</code> in a bundle in your application build configuration (only needed if you use skin).</li>
</p>
</ul>
<h3>Deprecated features</h3>
<p>The following features are now deprecated but still supported.</p>
<ul>
<li>aria.widgets.IconLib class</li>
<li>{bindRefreshTo} statement<br />
	{bindRefreshTo} statement will be removed in Aria Templates 1.5.1. Please use bindRefreshTo property of a {section} statement instead. See the samples below:<br />
	Old (deprecated) syntax:<br />
	<code></p>

<div class="wp_syntax"><table><tr><td class="code"><div class="at" style="font-family:monospace;">&nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#123;</span><span style="color: #BBBEFF">section</span> <span style="color: #80FF00;">&quot;foo&quot;</span><span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#123;</span><span style="color: #BBBEFF">bindRefreshTo</span> data.<span style="color: #F8F8F8;">value</span><span style="color: #F8F8F8;">/</span><span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ... <span style="color: #F8F8F8;">content</span> ...<br />
&nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#123;</span><span style="color: #F8F8F8;">/</span><span style="color: #BBBEFF">section</span><span style="color: #F8F8F8;">&#125;</span></div></td></tr></table></div>

<p></code><br />
	Easy replacement suggestion:<br />
	<code></p>

<div class="wp_syntax"><table><tr><td class="code"><div class="at" style="font-family:monospace;">&nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#123;</span><span style="color: #BBBEFF">section</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #BBBEFF">id</span> <span style="color: #F8F8F8;">:</span> <span style="color: #80FF00;">&quot;foo&quot;</span><span style="color: #F8F8F8;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #BBBEFF">bindRefreshTo</span> <span style="color: #F8F8F8;">:</span> <span style="color: #F8F8F8;">&#91;</span><span style="color: #F8F8F8;">&#123;</span>inside <span style="color: #F8F8F8;">:</span> data<span style="color: #F8F8F8;">,</span> to <span style="color: #F8F8F8;">:</span> <span style="color: #80FF00;">&quot;value&quot;</span><span style="color: #F8F8F8;">&#125;</span><span style="color: #F8F8F8;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ... <span style="color: #F8F8F8;">content</span> ...<br />
&nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#123;</span><span style="color: #F8F8F8;">/</span><span style="color: #BBBEFF">section</span><span style="color: #F8F8F8;">&#125;</span></div></td></tr></table></div>

<p></code><br />
	Recommended:<br />
	<code></p>

<div class="wp_syntax"><table><tr><td class="code"><div class="at" style="font-family:monospace;">&nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#123;</span><span style="color: #BBBEFF">section</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #BBBEFF">id</span> <span style="color: #F8F8F8;">:</span> <span style="color: #80FF00;">&quot;foo&quot;</span><span style="color: #F8F8F8;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #BBBEFF">macro</span> <span style="color: #F8F8F8;">:</span> <span style="color: #80FF00;">&quot;mySectionMacro&quot;</span><span style="color: #F8F8F8;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #BBBEFF">bindRefreshTo</span> <span style="color: #F8F8F8;">:</span> <span style="color: #F8F8F8;">&#91;</span><span style="color: #F8F8F8;">&#123;</span>inside <span style="color: #F8F8F8;">:</span> data<span style="color: #F8F8F8;">,</span> to <span style="color: #F8F8F8;">:</span> <span style="color: #80FF00;">&quot;value&quot;</span><span style="color: #F8F8F8;">&#125;</span><span style="color: #F8F8F8;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span> <span style="color: #F8F8F8;">/</span><span style="color: #F8F8F8;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#123;</span><span style="color: #BBBEFF">macro</span> mySectionMacro<span style="color: #F8F8F8;">&#40;</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ... <span style="color: #F8F8F8;">content</span> ...<br />
&nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#123;</span><span style="color: #F8F8F8;">/</span><span style="color: #BBBEFF">macro</span><span style="color: #F8F8F8;">&#125;</span></div></td></tr></table></div>

<p></code>
	</li>
<li>History API cross-browser implementation enhancement<br />
	Singleton class <code>aria.utils.History</code> provides a cross-browser implementation of HTML5 native history API. With respect to the previous version, this one is more compliant with the standard behavior:<br />
	the <code>onpopstate</code> class event is not raised after a pushState or replaceState.<br />
	the state property is available on the singleton and it corresponds to window.history.state.<br />
	support for page reload and external navigation is supported also in browsers for which hash-based navigation fallback occurs (with the exception of IE7, for which the previous history is not kept after reloading, but only the current state is available). However, the new version is backward compatible with the previous one. In order to disable backward compatibility, set <code>aria.utils.History.isBackwardCompatible</code> to <code>false</code> right after loading the class.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://ariatemplates.com/blog/2013/04/aria-templates-1-4-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using timezonejs in an Aria Templates application</title>
		<link>http://ariatemplates.com/blog/2013/04/using-timezonejs-in-an-aria-templates-application/</link>
		<comments>http://ariatemplates.com/blog/2013/04/using-timezonejs-in-an-aria-templates-application/#comments</comments>
		<pubDate>Wed, 03 Apr 2013 13:18:56 +0000</pubDate>
		<dc:creator>Fabrice Basso</dc:creator>
				<category><![CDATA[Various stuff]]></category>

		<guid isPermaLink="false">http://ariatemplates.com/blog/?p=757</guid>
		<description><![CDATA[Introduction Playing with timezone in javascript can be problematic not because of the timezone offset calculation, which can easily be done with the getTimezoneOffset method of a date object, but because of the DST (daylight saving time) policy of the local countries/states. Let’s take New York and Paris as an example. The official timezones for &#8230;]]></description>
				<content:encoded><![CDATA[<h2>Introduction</h2>
<p>Playing with timezone in javascript can be problematic not because of the timezone offset calculation, which can easily be done with the getTimezoneOffset method of a date object, but because of the DST (daylight saving time) policy of the local countries/states.</p>
<p>Let’s take New York and Paris as an example. The official timezones for these two locations is UTC-5 and UTC+1, but because of the DST policy, the « real » New York time is UTC-5 before beginning of March and UTC-4 after. For Paris it’s UTC+1 till end of March then UTC+2 is used.</p>
<p>So if you have to convert a time from one timezone to another, you will need to know what are the local dates for both, depending their own rules, not with only their official UTC offsets.</p>
<h2>The IANA Time Zone Database</h2>
<p>An official and <a href="http://cs.ucla.edu/~eggert/tz/tz-link.htm">public database</a> has been created to reference all the rules used over the world, for any moment in the history (don’t forget that the rules can change depending on politician decisions).</p>
<p>You will find on Wikipedia <a href="https://en.wikipedia.org/wiki/Tz_database">the detailed information about the tz database</a>, which is the reference information for any language which wants to deal with the timezones.</p>
<h2>Timezonejs</h2>
<p>Unlike some server side languages as Java or PHP, which have internally an API to get the timezones information, javascript can&#8217;t retrieve it with its own API.</p>
<p>The most known javascript library to deal with the timezone is <a href="https://github.com/mde/timezone-js">timezonejs</a>. Its open source code contains the IANA information, and it&#8217;s usage is better driven in two steps: the first one is to preprocess the database to a json, based on the timezones you plan to use, the second one is to load the library and the json on the client in order to use them.</p>
<h3>Compile the IANA database to a json file</h3>
<p>This process is done with nodejs, and is quite straitforward. node-preparse.js will be found in the src directory, and can be used with node to compile the information in the tzdata directory. For example, if you want to compile all the timezones, you can run the following command line from the src directory:</p>

<div class="wp_syntax"><table><tr><td class="code"><div class="javascript" style="font-family:monospace;">node node<span style="color: #F8F8F8">-</span>preparse.<span style="color: #F8F8F8;">js</span> ..<span style="color: #F8F8F8">/</span>tzdata <span style="color: #F8F8F8">&gt;</span> tz.<span style="color: #F8F8F8;">json</span></div></td></tr></table></div>

<p>As a result, you will obtain the file tz.json that you will place on an acessible location of your server. Some optional syntax exists in order to generate a subset of the whole timezones.</p>
<h3>Loading and using timezonejs in Aria Templates</h3>
<p>Now you have timezonejs (in src/date.js, that you could rename timezonejs.js, for example) and your json information accessible on your server, it’s time to load it and use it in Aria Templates. Timezonejs doesn’t have a “transport” to get the json file (by default, timezonejs tries to use jquery if available).</p>
<p>This operation can be easily achieved in Aria templates, without using any third party:</p>

<div class="wp_syntax"><table><tr><td class="code"><div class="javascript" style="font-family:monospace;">aria.<span style="color: #F8F8F8;">utils</span>.<span style="color: #F8F8F8;">ScriptLoader</span>.<span style="color: #F8F8F8;">load</span><span style="color: #F8F8F8;">&#40;</span><span style="color: #80FF00;">&quot;aria/templates/timezone/timezonejs.js&quot;</span><span style="color: #F8F8F8">,</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; fn <span style="color: #F8F8F8">:</span> <span style="color: #37A3ED">function</span><span style="color: #F8F8F8;">&#40;</span><span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #37A3ED">var</span> tz <span style="color: #F8F8F8">=</span> timezoneJS.<span style="color: #F8F8F8;">timezone</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; tz.<span style="color: #F8F8F8;">loadingScheme</span> <span style="color: #F8F8F8">=</span> tz.<span style="color: #F8F8F8;">loadingSchemes</span>.<span style="color: #F8F8F8;">MANUAL_LOAD</span><span style="color: #F8F8F8">;</span><br />
<br />
&nbsp; &nbsp; aria.<span style="color: #F8F8F8;">core</span>.<span style="color: #F8F8F8;">IO</span>.<span style="color: #F8F8F8;">asyncRequest</span><span style="color: #F8F8F8;">&#40;</span><span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; url<span style="color: #F8F8F8">:</span> <span style="color: #80FF00;">'/aria-templates/test/aria/templates/timezone/tz.json'</span><span style="color: #F8F8F8">,</span><br />
&nbsp; &nbsp; &nbsp; expectedResponseType<span style="color: #F8F8F8">:</span> <span style="color: #80FF00;">'json'</span><span style="color: #F8F8F8">,</span><br />
&nbsp; &nbsp; &nbsp; callback<span style="color: #F8F8F8">:</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; fn<span style="color: #F8F8F8">:</span> <span style="color: #37A3ED">function</span> <span style="color: #F8F8F8;">&#40;</span>result<span style="color: #F8F8F8">,</span> args<span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">var</span> json <span style="color: #F8F8F8">=</span> aria.<span style="color: #F8F8F8;">utils</span>.<span style="color: #F8F8F8;">Json</span><span style="color: #F8F8F8">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666">// Init timezonejs</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data <span style="color: #F8F8F8">=</span> result.<span style="color: #F8F8F8;">responseJSON</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; json.<span style="color: #F8F8F8;">inject</span><span style="color: #F8F8F8;">&#40;</span>data.<span style="color: #F8F8F8;">zones</span><span style="color: #F8F8F8">,</span> tz.<span style="color: #F8F8F8;">zones</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; json.<span style="color: #F8F8F8;">inject</span><span style="color: #F8F8F8;">&#40;</span>data.<span style="color: #F8F8F8;">rules</span><span style="color: #F8F8F8">,</span> tz.<span style="color: #F8F8F8;">rules</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666">// Use it !</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">var</span> dt <span style="color: #F8F8F8">=</span> <span style="color: #37A3ED">new</span> timezoneJS.<span style="color: #F8F8F8;">Date</span><span style="color: #F8F8F8;">&#40;</span><span style="color: #FF3A83;">2013</span><span style="color: #F8F8F8">,</span> <span style="color: #FF3A83;">1</span><span style="color: #F8F8F8">,</span> <span style="color: #FF3A83;">15</span><span style="color: #F8F8F8">,</span> <span style="color: #FF3A83;">12</span><span style="color: #F8F8F8">,</span> <span style="color: #FF3A83;">0</span><span style="color: #F8F8F8">,</span> <span style="color: #80FF00;">'America/New_York'</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; json.<span style="color: #F8F8F8;">setValue</span><span style="color: #F8F8F8;">&#40;</span><span style="color: #37A3ED">this</span>.<span style="color: #F8F8F8;">data</span>.<span style="color: #F8F8F8;">date1</span><span style="color: #F8F8F8">,</span> <span style="color: #80FF00;">&quot;newYork&quot;</span><span style="color: #F8F8F8">,</span> dt.<span style="color: #F8F8F8;">toString</span><span style="color: #F8F8F8;">&#40;</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dt.<span style="color: #F8F8F8;">setTimezone</span><span style="color: #F8F8F8;">&#40;</span><span style="color: #80FF00;">&quot;Europe/Paris&quot;</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; json.<span style="color: #F8F8F8;">setValue</span><span style="color: #F8F8F8;">&#40;</span><span style="color: #37A3ED">this</span>.<span style="color: #F8F8F8;">data</span>.<span style="color: #F8F8F8;">date1</span><span style="color: #F8F8F8">,</span> <span style="color: #80FF00;">&quot;paris&quot;</span><span style="color: #F8F8F8">,</span> dt.<span style="color: #F8F8F8;">toString</span><span style="color: #F8F8F8;">&#40;</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><span style="color: #F8F8F8">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; scope<span style="color: #F8F8F8">:</span> <span style="color: #37A3ED">this</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; <span style="color: #F8F8F8;">&#125;</span><span style="color: #F8F8F8">,</span><br />
&nbsp; scope <span style="color: #F8F8F8">:</span> <span style="color: #37A3ED">this</span><br />
<span style="color: #F8F8F8;">&#125;</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span></div></td></tr></table></div>

<p>The first step is to use aria.utils.ScriptLoader.load to load the library itself, and then aria.core.IO.asyncRequest is used with expectedResponseType: &#8216;json&#8217; to get and evaluate the json. As a result, the json data are injected in timezonejs and the library is ready.</p>
<p>Now a new date can be created through <em>timezoneJS.Date</em> (note the extra timezone parameter in the previous code), and can be changed with the setTimezone method to finally get any local time according to the country rules.</p>
]]></content:encoded>
			<wfw:commentRss>http://ariatemplates.com/blog/2013/04/using-timezonejs-in-an-aria-templates-application/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Aria Templates 1.3.7</title>
		<link>http://ariatemplates.com/blog/2013/03/aria-templates-1-3-7/</link>
		<comments>http://ariatemplates.com/blog/2013/03/aria-templates-1-3-7/#comments</comments>
		<pubDate>Tue, 19 Mar 2013 10:42:28 +0000</pubDate>
		<dc:creator>Fabio Crisci</dc:creator>
				<category><![CDATA[Releases]]></category>

		<guid isPermaLink="false">http://ariatemplates.com/blog/?p=748</guid>
		<description><![CDATA[In 1.3.6 we focused on stability, without adding many features. These are the changes introduced between 1.3.5 and 1.3.7 CSS Animations Add CSS animations, like slide, fade, pop and flip, using the utility aria.utils.css.Animations See #414 Error tool tip enhancement Currently the logic for the error tool tip is contained within aria.widgets.form.Input, the aim of &#8230;]]></description>
				<content:encoded><![CDATA[<p>In 1.3.6 we focused on stability, without adding many features. These are the changes introduced between 1.3.5 and 1.3.7</p>
<ul>
<li><strong>CSS Animations</strong><br />
<blockquote><p>
				Add CSS animations, like slide, fade, pop and flip, using the utility aria.utils.css.Animations<br />
				<br/><br />
				See <a href="https://github.com/ariatemplates/ariatemplates/issues/414">#414</a>
			</p></blockquote>
</li>
<li><strong>Error tool tip enhancement</strong><br />
<blockquote><p>
				Currently the logic for the error tool tip is contained within  aria.widgets.form.Input, the aim of this enhancement is to share code  efficiently between multiple types of widgets. Specifically for the requirement of this feature, this means making the code for the error tool tip not only available for &quot;Input&quot; type widgets, but also for &quot;Action&quot; type widgets.  In addition, it must also be possible from within a template to have a new  widget property called errorTipPosition that will be used as the preferred  position for the error tool tip, if there is not enough available space the framework will automatically calculate the best position for the error tool tip. The property will be added for both &quot;Input&quot; type widgets and also &quot;Action&quot; type widgets.<br />
				<br/><br />
				See <a href="https://github.com/ariatemplates/ariatemplates/issues/405">#405</a>
			</p></blockquote>
</li>
<li><strong>improve ModuleCtrlTestCase</strong><br />
<blockquote><p>
				Improve ModuleCtrlTestCase by providing automatic creation and disposal of tested module. By specifying <code>$controller</code> in the test&#8217;s <code>$prototype</code> an instance of that class is generated before running the test. The tester can then access the two variables <code>$moduleCtrl</code> and <code>$moduleCtrlPrivate</code>. The public interface is also registered for asserting its logs, so there&#8217;s no need to call anymore <code>registerObject</code>.<br />
				<br/><br />
				See <a href="https://github.com/ariatemplates/ariatemplates/issues/407">#407</a>
			</p></blockquote>
</li>
<li><strong>Using atpackager</strong><br />
<blockquote><p>
				The packager used during the open-source build of Aria Templates is now separated in its own project called atpackager. Templates are now pre-compiled to JavaScript classes during the build. Grunt version is updated from 0.3 to 0.4.<br />
				<br/><br />
				See <a href="https://github.com/ariatemplates/ariatemplates/issues/400">#400</a>
			</p></blockquote>
</li>
<li><strong>improve logging in tests</strong><br />
<blockquote>
<ol>
<li>
				 Added Assert.assertEqualsWithTolerance(num1, num2, tolerance)</li>
<li> Formatted output in Assert.assertJsonEquals  Instead of dumping minimal JSON strings in failed JSON comparison, pretty-print them.</li>
<li> Log to browser console in JSUnit in verbose mode</li>
</ol>
<p>  Currently, the SilentArrayAppender is the appender used in our JSUnit. This means that things like $logError or $logWarn will not be displayed in Firebug console.  However, the appender is changed from DefaultAppender in the middle of the  execution, which results in some logs actually being available in the browser console, but the rest (after changing appender) not.  For debugging purposes, it&#8217;s useful to see the errors and warnings directly in the browser when running the test.  This commit adds the possibility to see all the logs if the URL of the test page contains &#8216;verbose=true&#8217; part.<br />
				<br/><br />
				See <a href="https://github.com/ariatemplates/ariatemplates/issues/404">#404</a>
			</p></blockquote>
</li>
<li><strong>Gestures</strong><br />
<blockquote><p>
				Support more gestures: double tap, single tap, long press, drag, pinch.<br />
				<br/><br />
				See <a href="https://github.com/ariatemplates/ariatemplates/issues/385">#385</a>
			</p></blockquote>
</li>
<li><strong>Utility class to load standard css files</strong><br />
<blockquote><p>
				It is possible to programmatically add/remove css files by using the aria.utils.CSSLoader singleton. Tags of type &quot;link&quot; are created and appended to the head of the document.<br />
				<br/><br />
				See <a href="https://github.com/ariatemplates/ariatemplates/issues/393">#393</a>
			</p></blockquote>
</li>
<p>GH-218 &#8211;
<li><strong>Better stack traces in Firebug and Safari dev tools</strong> </p>
<blockquote><p>
Now almost all the functions (both from core AT code and user template scripts / module controllers) will have names displayed in the stack traces in Firebug and Safari dev tools, using Function.displayName feature. Previously many of the functions were displayed as anonymous.<br/><br />
				See <a href="https://github.com/ariatemplates/ariatemplates/issues/218">#218</a>
	 </p></blockquote>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://ariatemplates.com/blog/2013/03/aria-templates-1-3-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debugging JavaScript/CSS/HTML from a remote server in remote browser with Fiddler</title>
		<link>http://ariatemplates.com/blog/2013/02/debugging-javascript-css-html-from-a-remote-server-in-remote-browser-with-fiddler/</link>
		<comments>http://ariatemplates.com/blog/2013/02/debugging-javascript-css-html-from-a-remote-server-in-remote-browser-with-fiddler/#comments</comments>
		<pubDate>Wed, 27 Feb 2013 13:44:10 +0000</pubDate>
		<dc:creator>Jakub Gieryluk</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[fiddler]]></category>
		<category><![CDATA[internet-explorer]]></category>

		<guid isPermaLink="false">http://ariatemplates.com/blog/?p=642</guid>
		<description><![CDATA[Configure Fiddler as a remote proxy to facilitate debugging on virtual machines. As Aria Templates team, we provide a JavaScript framework used by numerous web applications in Amadeus. We may not be deeply familiar with some of that applications, and do not have them installed on our development machines, yet since they use our framework, &#8230;]]></description>
				<content:encoded><![CDATA[<p><em>Configure Fiddler as a remote proxy to facilitate debugging on virtual machines.</em></p>
<p><strong>As Aria Templates team, we provide a <a href="https://github.com/ariatemplates/ariatemplates#aria-templates---javascript-framework">JavaScript framework</a> used by numerous web applications in <a href="http://www.amadeus.com">Amadeus</a>. We may not be deeply familiar with some of that applications, and do not have them installed on our development machines, yet since they use our framework, we&#8217;re frequently asked for support to help on debugging some of the applications&#8217; problems.</strong></p>
<p><strong>Debugging rich internet applications that are not served from your local webserver, and especially on a browser that you don&#8217;t have physically on your computer (e.g. IE9 or IE10, while you&#8217;re on Windows XP) might be a challenge. However there are tools like Fiddler which help greatly, and if configured properly, give us the possibility to<em> work directly on our computers </em>to debug, fix and test the problems <em>without redeploying anything</em> on the staging servers.</strong></p>
<p>&nbsp;</p>
<h2>What is Fiddler</h2>
<p>Fiddler is a (Windows-only) <a href="http://www.fiddler2.com/fiddler2/">web debugging proxy </a>with extended capabilities to alter the traffic for debugging purposes. You can create ad-hoc local files that will be returned for certain HTTP requests (e.g. altering specific file), or write a few lines of JScript.NET code (Microsoft&#8217;s flavor of JavaScript with some classical-OOP additions) to redirect requests matching certain regex to another URL / machine / possibly your localhost server.</p>
<p><a href="http://ariatemplates.com/blog/2013/02/debugging-javascriptcsshtml-from-a-remote-server-in-remote-browser-with-fiddler/blogpost-fiddler3v2-900px/" rel="attachment wp-att-698"><img alt="blogpost-fiddler3v2-900px" src="http://ariatemplates.com/blog/wp-content/uploads/2013/02/blogpost-fiddler3v2-900px.png" width="900" height="712" /></a></p>
<p>&nbsp;</p>
<p>To start with, you can install Fiddler on your machine, and once enabled, whole traffic from proxy-aware programs will go through it. Regarding the browsers: Chrome, Safari and IE integration is seamless; for Firefox there comes an add-on with Fiddler; Opera must be started only after Fiddler is started and activated.</p>
<p>This is all good, but there comes a moment when you need to <strong>test a browser you don&#8217;t have on your machine</strong> &#8211; e.g. debugging on a <a href="http://www.modern.ie/en-us/virtualization-tools">virtual machine with a particular version of Internet Explorer</a>. You can obviously install Fiddler on all of your virtual machines, but once you develop your specific set of extensions, Fiddler scripts etc., maintaining them on all of those machines (and choosing same custom redirection settings from the Fiddler menu for all those instances &#8212; especially painful after a change in Fiddler script, which resets the hand-activated settings to defaults) becomes not that handy.</p>
<p>Luckily, since Fiddler is in fact a proxy server, <strong>you might configure your external virtual machines to target Fiddler on your machine as a proxy</strong>. That way, after properly configuring all the VMs, you can<strong> edit your JavaScript / HTML / CSS on your development machine</strong>, and change various Fiddler&#8217;s settings only once, and then only refresh a page on all remote browsers!</p>
<p>Let&#8217;s see an example how we can facilitate debugging in Internet Explorer running on a remote machine.</p>
<p>&nbsp;</p>
<h2>Configuring Fiddler as a remote proxy</h2>
<p>First, you&#8217;ll need to alter Fiddler&#8217;s settings and restart Fiddler.</p>
<p><a href="http://ariatemplates.com/blog/2013/02/debugging-javascriptcsshtml-from-a-remote-server-in-remote-browser-with-fiddler/fiddopts1/" rel="attachment wp-att-654"><img class="alignnone size-full wp-image-654" alt="fiddopts1" src="http://ariatemplates.com/blog/wp-content/uploads/2013/02/fiddopts1.png" width="550" height="361" /></a></p>
<p>Check from your local machine and a remote machine that you can access Fiddler&#8217;s web server:</p>
<p><a href="http://ariatemplates.com/blog/2013/02/debugging-javascriptcsshtml-from-a-remote-server-in-remote-browser-with-fiddler/fiddopts2/" rel="attachment wp-att-655"><img class="alignnone size-full wp-image-655" alt="fiddopts2" src="http://ariatemplates.com/blog/wp-content/uploads/2013/02/fiddopts2.png" width="641" height="309" /></a></p>
<p>On a remote machine, open <strong>&#8220;Tools&#8221;</strong> &gt; <strong>&#8220;Internet Options&#8221;</strong> in Internet Explorer to set up a proxy:</p>
<p><a href="http://ariatemplates.com/blog/2013/02/debugging-javascriptcsshtml-from-a-remote-server-in-remote-browser-with-fiddler/fiddopts3/" rel="attachment wp-att-662"><img class="alignnone size-full wp-image-662" alt="fiddopts3" src="http://ariatemplates.com/blog/wp-content/uploads/2013/02/fiddopts3.png" width="800" height="541" /></a></p>
<p>That&#8217;s it! Now <strong>open any page on a remote machine, and you will see the traffic in Fiddler window on your local machine</strong>. The only drawback is that for remote traffic, process name will not be displayed.</p>
<p>One of the useful things you can do with Fiddler is <strong>injecting a <code>debugger;</code> statement in a part of JavaScript code</strong> you may want to inspect. This might be a lot easier than looking for a proper place to put a breakpoint while in a browser (and you will need to do it in each of the instances of the browser).</p>
<p>&nbsp;</p>
<h2>Creating a simple autoresponder in Fiddler</h2>
<p>Let&#8217;s get our hands dirty and try it out.</p>
<p>I&#8217;ll create an ad-hoc webserver on my machine at <code>jakub:8000</code> serving a <code>demo.htm</code> page which loads a script from <code>demo.js</code> (Hint: you can use <code>python -m http.server</code> command to start a web server on port 8000 serving a current working directory if you have Python 3 installed). This is to simplify things for the demo sake, but think of it as an external webserver &#8211; let&#8217;s pretend I don&#8217;t have access to that code on my machine.</p>
<p>I&#8217;ll make a deliberate mistake there which creates a syntax error in IE7: add a trailing comma in an object literal:</p>

<div class="wp_syntax"><table><tr><td class="code"><div class="javascript" style="font-family:monospace;"><span style="color: #37A3ED">var</span> fruit <span style="color: #F8F8F8">=</span> <span style="color: #F8F8F8;">&#123;</span><br />
oranges <span style="color: #F8F8F8">:</span> <span style="color: #FF3A83;">2</span><span style="color: #F8F8F8">,</span><br />
apples <span style="color: #F8F8F8">:</span> <span style="color: #FF3A83;">3</span><span style="color: #F8F8F8">,</span> <span style="color: #666666">// trailing comma produces a syntax error in IE7 and older</span><br />
<span style="color: #F8F8F8;">&#125;</span><span style="color: #F8F8F8">;</span><br />
document.<span style="color: #37A3ED">write</span><span style="color: #F8F8F8;">&#40;</span><span style="color: #80FF00;">&quot;We have &quot;</span> <span style="color: #F8F8F8">+</span> fruit.<span style="color: #F8F8F8;">apples</span> <span style="color: #F8F8F8">+</span> <span style="color: #80FF00;">&quot; apples.&quot;</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span></div></td></tr></table></div>

<p>Let&#8217;s launch it in IE7 on a virtual machine:</p>
<p><a href="http://ariatemplates.com/blog/2013/02/debugging-javascriptcsshtml-from-a-remote-server-in-remote-browser-with-fiddler/fiddler0/" rel="attachment wp-att-671"><img class="alignnone size-full wp-image-671" alt="fiddler0" src="http://ariatemplates.com/blog/wp-content/uploads/2013/02/fiddler0.png" width="563" height="404" /></a></p>
<p>Now let&#8217;s have a look at Fiddler sessions list. First I launched a page in a local instance of Chrome, then in IE7 on virtual machine (it&#8217;s remote hence process name field is empty):</p>
<p><a href="http://ariatemplates.com/blog/2013/02/debugging-javascriptcsshtml-from-a-remote-server-in-remote-browser-with-fiddler/fiddler2/" rel="attachment wp-att-672"><img class="alignnone size-full wp-image-672" alt="fiddler2" src="http://ariatemplates.com/blog/wp-content/uploads/2013/02/fiddler2.png" width="1002" height="497" /></a></p>
<p>I can create an autoresponder (above, right hand side section), to intercept the request coming for <code>demo.js</code> and serve my own file instead. To do that, I can drag an entry from session list to the Autoresponder tab (make sure to tick &#8220;Enable automatic responses&#8221; and &#8220;Unmatched requests passthrough&#8221; in the Autoresponder tab first), and then choose &#8220;Generate file&#8221; from context menu. Let&#8217;s create an autoresponder file and change our code, getting rid of a trailing comma in the array, and refresh the page in the browser:</p>
<p><a href="http://ariatemplates.com/blog/2013/02/debugging-javascriptcsshtml-from-a-remote-server-in-remote-browser-with-fiddler/fiddler4/" rel="attachment wp-att-673"><img class="alignnone size-full wp-image-673" alt="fiddler4" src="http://ariatemplates.com/blog/wp-content/uploads/2013/02/fiddler4.png" width="1002" height="497" /></a></p>
<p>As you can see, the traffic going through autoresponder has a different background color. Let&#8217;s get back to our IE7:</p>
<p><a href="http://ariatemplates.com/blog/2013/02/debugging-javascriptcsshtml-from-a-remote-server-in-remote-browser-with-fiddler/fiddler5/" rel="attachment wp-att-674"><img class="alignnone size-full wp-image-674" alt="fiddler5" src="http://ariatemplates.com/blog/wp-content/uploads/2013/02/fiddler5.png" width="563" height="404" /></a></p>
<p>We&#8217;ve just fixed a remote problem, playing on a local development machine without redeploying anything. Of course this was just a trivial example, but same flow applies to much complex problems.</p>
<p>The problem has been solved for IE7, but will the fix not break things in other browser and other versions of IE? Just keep the autoresponders, configure the proxy accordingly on virtual machines, and launch the page in other browsers. No regressions? Head to your IDE / command line and check-in the fix!</p>
<p>&nbsp;</p>
<h2>That&#8217;s cool, I want to know more!</h2>
<p>For more info on Fiddler, check out the <a href="http://www.fiddler2.com/Fiddler/help/">tool&#8217;s website</a> and <a href="http://www.telerik.com/automated-testing-tools/blog/eric-lawrence.aspx">Eric Lawrence&#8217;s blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://ariatemplates.com/blog/2013/02/debugging-javascript-css-html-from-a-remote-server-in-remote-browser-with-fiddler/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Aria Templates 1.3.5</title>
		<link>http://ariatemplates.com/blog/2013/02/aria-templates-1-3-5/</link>
		<comments>http://ariatemplates.com/blog/2013/02/aria-templates-1-3-5/#comments</comments>
		<pubDate>Fri, 08 Feb 2013 09:40:33 +0000</pubDate>
		<dc:creator>Fabio Crisci</dc:creator>
				<category><![CDATA[Releases]]></category>

		<guid isPermaLink="false">http://ariatemplates.com/blog/?p=636</guid>
		<description><![CDATA[Another sprint ended, among with some fixes we&#8217;re adding the following features in Aria Templates 1.3.5 Bindable width and height for containers A possibility to bind width and height for some of container-based widgets (Div, Dialog, Fieldset, TabPanel) has been added. The bound size is a subject to min/max size constraints for all of those &#8230;]]></description>
				<content:encoded><![CDATA[<p>Another sprint ended, among with some <a title="Aria Templates 1.3.5 fixed issues" href="https://github.com/ariatemplates/ariatemplates/issues?milestone=14&amp;state=closed" target="_blank">fixes</a> we&#8217;re adding the following features in Aria Templates 1.3.5</p>
<ul>
<li><strong>Bindable width and height for containers</strong><br />
<blockquote><p>A possibility to bind width and height for some of container-based widgets (Div, Dialog, Fieldset, TabPanel) has been added. The bound size is a subject to min/max size constraints for all of those widgets.<br />
This change lifts the requirement for widgets to have width/height = -1 for min/max width/height to work. So this is backward-incompatible change in some way, but the behavior of width &amp; maxwidth etc. when provided together was undefined earlier, so it should not have relied upon by anyone. Pull request <a href="https://github.com/ariatemplates/ariatemplates/pull/347" target="_blank">#347</a></p></blockquote>
</li>
<li><strong>Maximizable Dialog</strong><br />
<blockquote><p>Dialog can be now maximizable. If configured so, it will have a button to maximize/unmaximize next to the close button. It also reacts to the change of the data model property `maximized`. That property takes precedence over `center`, `xpos`, `ypos`, `width`, `height` changes (if you want to change those properties, you should first unmaximize the Dialog); moreover, `maxHeight` and `maxWidth` are ignored when the Dialog is in the maximized mode.<br />
When Dialog gets maximized, the scrollbars of the page are removed, the Dialog occupies the whole viewport and is not movable/resizable. After unmaximizing, it returns to the original position, size and restores movable/resizable capabilities. <a href="https://github.com/ariatemplates/ariatemplates/pull/358" target="_blank">Pull request #358</a></p></blockquote>
</li>
<li><strong>$description is no longer mandatory in bean definitions</strong><br />
<blockquote><p>This change allows to improve the package size by removing the descriptions in bean definitions as part of the build process. Nevertheless, the use of these descriptions is still encouraged for documentation purposes. <a href="https://github.com/ariatemplates/ariatemplates/issues/342" target="_blank">Pull request #342</a>. Being now optional it&#8217;s also possible to remove the descriptions from the production packaged version, <a href="https://github.com/ariatemplates/ariatemplates/pull/330" target="_blank">pull request #330</a></p></blockquote>
</li>
<li><strong>Add a custom image to Iconbutton widget</strong><br />
<blockquote><p>This feature allows users to define their own image path for IconButton/Icon widgets. <a href="https://github.com/ariatemplates/ariatemplates/pull/324" target="_blank">Pull request #324</a></p></blockquote>
</li>
<li><strong>Orientation change detection</strong><br />
<blockquote><p>Add a utility class to detect orientation change events and register callbacks to such events. <a href="https://github.com/ariatemplates/ariatemplates/issues/351" target="_blank">Pull request #351</a></p></blockquote>
</li>
<li><strong>Animation/Transition Event callbacks</strong><br />
<blockquote><p>Allow to register to animation and transition events from a template through <code>on</code> statement. <a href="https://github.com/ariatemplates/ariatemplates/pull/350" target="_blank">Pull request #350</a></p></blockquote>
</li>
<li><strong>Detecting Mobile Device Properties</strong><br />
<blockquote><p>Utility class to detect some properties of mobile devices like being a tablet or mobile, the support of 2D and 3D transforms or whether the application is running inside PhoneGap. <a href="https://github.com/ariatemplates/ariatemplates/pull/292" target="_blank">Pull request #292</a></p></blockquote>
</li>
<li><strong>Testing improvements</strong><br />
<blockquote><p>Thanks to <a href="https://github.com/ariatemplates/ariatemplates/pull/339" target="_blank">#339</a> and <a href="https://github.com/ariatemplates/ariatemplates/pull/337" target="_blank">#337</a> it&#8217;s now possible to run Robot tests inside PhantomJs and configure the number of PhantomJs instances used by <a href="https://github.com/ariatemplates/attester" target="_blank">attester</a>.</p></blockquote>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://ariatemplates.com/blog/2013/02/aria-templates-1-3-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using iframes in an Aria Templates application</title>
		<link>http://ariatemplates.com/blog/2013/01/iframes/</link>
		<comments>http://ariatemplates.com/blog/2013/01/iframes/#comments</comments>
		<pubDate>Fri, 18 Jan 2013 13:26:44 +0000</pubDate>
		<dc:creator>David-Emmanuel</dc:creator>
				<category><![CDATA[Aria Templates Patterns]]></category>
		<category><![CDATA[Templating]]></category>

		<guid isPermaLink="false">http://ariatemplates.com/blog/?p=556</guid>
		<description><![CDATA[Introduction Aria Templates is based on client-side templating: as templates are stored client side, if a piece of data changes, there is no need to manipulate DOM elements to update the UI, it is only needed to refresh a template or a part of it. When a template is refreshed, the Aria Templates framework erases &#8230;]]></description>
				<content:encoded><![CDATA[<h2>Introduction</h2>
<p>Aria Templates is based on client-side templating: as templates are stored client side, if a piece of data changes, there is no need to manipulate <a href="http://en.wikipedia.org/wiki/Document_Object_Model">DOM</a> elements to update the <a href="http://en.wikipedia.org/wiki/User_interface">UI</a>, it is only needed to <a href="http://ariatemplates.com/usermanual/Refresh">refresh</a> a template or a part of it.</p>
<p>When a template is refreshed, the Aria Templates framework erases the DOM structure and creates a new one with the updated data. This works fine in most cases. However, it is not always desirable to get rid of the previous DOM structure, especially for components, such as <a href="http://www.w3schools.com/tags/tag_iframe.asp">iframes</a>, which contain some state to preserve, or which are heavy to reload.</p>
<p>This blog post explains how to integrate iframes seamlessly in an Aria Templates application, while preserving the refresh feature, thanks to the <code>@embed:Element</code> widget. The same technique can also be applied for similar components.</p>
<h2>1 &#8211; The problem</h2>
<p>Consider the following template:</p>

<div class="wp_syntax"><table><tr><td class="code"><div class="at" style="font-family:monospace;"><span style="color: #F8F8F8;">&#123;</span><span style="color: #BBBEFF">Template</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #9FCA78">$classpath</span><span style="color: #F8F8F8;">:</span> <span style="color: #80FF00;">&quot;iframes.step1.Sample&quot;</span><br />
<span style="color: #F8F8F8;">&#125;</span><span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #F8F8F8;">&#123;</span><span style="color: #BBBEFF">macro</span> main<span style="color: #F8F8F8;">&#40;</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#123;</span><span style="color: red; font-weight: bold;">@aria:Button</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; label<span style="color: #F8F8F8;">:</span> <span style="color: #80FF00;">&quot;Refresh template&quot;</span><span style="color: #F8F8F8;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onclick<span style="color: #F8F8F8;">:</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fn<span style="color: #F8F8F8;">:</span> this.$refresh<span style="color: #F8F8F8;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; scope<span style="color: #F8F8F8;">:</span> this<span style="color: #F8F8F8;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; resIndex<span style="color: #F8F8F8;">:</span> <span style="color: #F8F8F8;">-</span><span style="color: #FF3A83;">1</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><span style="color: #F8F8F8;">/</span><span style="color: #F8F8F8;">&#125;</span> Last refresh<span style="color: #F8F8F8;">:</span> $<span style="color: #F8F8F8;">&#123;</span>new Date<span style="color: #F8F8F8;">&#40;</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8;">+</span><span style="color: #80FF00;">&quot;&quot;</span><span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&lt;</span>br <span style="color: #F8F8F8;">/&gt;&lt;</span>br <span style="color: #F8F8F8;">/&gt;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&lt;</span>iframe src<span style="color: #F8F8F8;">=</span><span style="color: #80FF00;">&quot;http://ariatemplates.com/&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; style<span style="color: #F8F8F8;">=</span><span style="color: #80FF00;">&quot;width:990px;height:500px;border-width:0px;display:block;&quot;</span><span style="color: #F8F8F8;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&lt;/</span>iframe<span style="color: #F8F8F8;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&lt;</span>br <span style="color: #F8F8F8;">/&gt;</span><br />
&nbsp; &nbsp; <span style="color: #F8F8F8;">&#123;</span><span style="color: #F8F8F8;">/</span><span style="color: #BBBEFF">macro</span><span style="color: #F8F8F8;">&#125;</span><br />
<span style="color: #F8F8F8;">&#123;</span><span style="color: #F8F8F8;">/</span><span style="color: #BBBEFF">Template</span><span style="color: #F8F8F8;">&#125;</span></div></td></tr></table></div>

<p>This template properly displays the iframe, and it is naturally possible to navigate inside the iframe. However, as soon as the template is refreshed, the current state of the iframe is lost and the iframe displays the original <a href="http://ariatemplates.com">http://ariatemplates.com</a> page.</p>
<p>Of course, we could say: let&#8217;s avoid refreshing this whole template, and only refresh parts of it. That strategy would probably work for very small applications. But if the iframe is supposed to be inside a <a href="http://ariatemplates.com/usermanual/Tab">tab panel</a> or a <a href="http://ariatemplates.com/usermanual/Dialog">dialog</a> and the state of the iframe is supposed to be kept when hiding and opening again the panel or the dialog, or if the iframe is contained in a template used as a sub-template of another template in a big application, it will become harder and harder to fight against the concept of refreshes, on which Aria Templates is built.</p>
<p>Fortunately, the <code>@embed:Element</code> widget was designed to solve this kind of issues, as explained in the next section.</p>
<h2>2 &#8211; A first (nearly working) solution</h2>
<p>The <code>@embed:Element</code> widget is expecting in its <a href="http://ariatemplates.com/aria/guide/apps/apidocs/#aria.embed.CfgBeans:ElementCfg">configuration</a> a reference to a controller. The controller is called just after the widget is inserted in the DOM (<code>onEmbededElementCreate</code>), and just before it is removed from it (<code>onEmbededElementDispose</code>). As a consequence, it seems easy to create a controller which manages the iframe DOM element, and makes sure it is reused across refreshes. Let&#8217;s consider the following code:</p>

<div class="wp_syntax"><table><tr><td class="code"><div class="javascript" style="font-family:monospace;">Aria.<span style="color: #F8F8F8;">classDefinition</span><span style="color: #F8F8F8;">&#40;</span><span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #EDA3ED">$classpath</span> <span style="color: #F8F8F8">:</span> <span style="color: #80FF00;">'iframes.step2.EmbedController'</span><span style="color: #F8F8F8">,</span><br />
&nbsp; &nbsp; <span style="color: #EDA3ED">$constructor</span> <span style="color: #F8F8F8">:</span> <span style="color: #37A3ED">function</span> <span style="color: #F8F8F8;">&#40;</span>url<span style="color: #F8F8F8">,</span> style<span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">var</span> document <span style="color: #F8F8F8">=</span> Aria.$window.<span style="color: #F8F8F8;">document</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">var</span> domElt <span style="color: #F8F8F8">=</span> document.<span style="color: #F8F8F8;">createElement</span><span style="color: #F8F8F8;">&#40;</span><span style="color: #80FF00;">'iframe'</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; domElt.<span style="color: #F8F8F8;">setAttribute</span><span style="color: #F8F8F8;">&#40;</span><span style="color: #80FF00;">'src'</span><span style="color: #F8F8F8">,</span> url<span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; domElt.<span style="color: #F8F8F8;">style</span>.<span style="color: #F8F8F8;">cssText</span> <span style="color: #F8F8F8">=</span> style<span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">this</span>._domElt <span style="color: #F8F8F8">=</span> domElt<span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">this</span>._domContainer <span style="color: #F8F8F8">=</span> <span style="color: #37A3ED">null</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><span style="color: #F8F8F8">,</span><br />
&nbsp; &nbsp; <span style="color: #EDA3ED">$destructor</span> <span style="color: #F8F8F8">:</span> <span style="color: #37A3ED">function</span> <span style="color: #F8F8F8;">&#40;</span><span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">if</span> <span style="color: #F8F8F8;">&#40;</span><span style="color: #37A3ED">this</span>._domContainer<span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">this</span>._domContainer.<span style="color: #F8F8F8;">removeChild</span><span style="color: #F8F8F8;">&#40;</span><span style="color: #37A3ED">this</span>._domElt<span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">this</span>._domContainer <span style="color: #F8F8F8">=</span> <span style="color: #37A3ED">null</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">this</span>._domElt <span style="color: #F8F8F8">=</span> <span style="color: #37A3ED">null</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><span style="color: #F8F8F8">,</span><br />
&nbsp; &nbsp; <span style="color: #EDA3ED">$prototype</span> <span style="color: #F8F8F8">:</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; onEmbededElementCreate <span style="color: #F8F8F8">:</span> <span style="color: #37A3ED">function</span> <span style="color: #F8F8F8;">&#40;</span>domContainer<span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">if</span> <span style="color: #F8F8F8;">&#40;</span><span style="color: #37A3ED">this</span>._domContainer<span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">this</span>.$logError<span style="color: #F8F8F8;">&#40;</span><span style="color: #80FF00;">&quot;The iframe controller is used in multiple places!&quot;</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">return</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">this</span>._domContainer <span style="color: #F8F8F8">=</span> domContainer<span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">this</span>._domContainer.<span style="color: #F8F8F8;">appendChild</span><span style="color: #F8F8F8;">&#40;</span><span style="color: #37A3ED">this</span>._domElt<span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><span style="color: #F8F8F8">,</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; onEmbededElementDispose <span style="color: #F8F8F8">:</span> <span style="color: #37A3ED">function</span> <span style="color: #F8F8F8;">&#40;</span>domContainer<span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">if</span> <span style="color: #F8F8F8;">&#40;</span><span style="color: #37A3ED">this</span>._domContainer <span style="color: #F8F8F8">==</span> domContainer<span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; domContainer.<span style="color: #F8F8F8;">removeChild</span><span style="color: #F8F8F8;">&#40;</span><span style="color: #37A3ED">this</span>._domElt<span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">this</span>._domContainer <span style="color: #F8F8F8">=</span> <span style="color: #37A3ED">null</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><br />
<span style="color: #F8F8F8;">&#125;</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span></div></td></tr></table></div>

<p>For simplicity, each instance of this controller manages a single iframe DOM element. The DOM element is built in the <code>$constructor</code>. When the <code>@embed:Element</code> widget is inserted in the DOM, we simply append the iframe to the <code>domContainer</code> element, which is the DOM element of the widget. When the widget is about to be removed from the DOM (for example: on refresh), we simply do the reverse (removing the iframe from the <code>domContainer</code>).</p>
<p>Now, here is the template which uses the <code>@embed:Element</code> widget and our new controller. Note that the <code>embed</code> widget library needs to be included in the template header:</p>

<div class="wp_syntax"><table><tr><td class="code"><div class="at" style="font-family:monospace;"><span style="color: #F8F8F8;">&#123;</span><span style="color: #BBBEFF">Template</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #9FCA78">$classpath</span> <span style="color: #F8F8F8;">:</span> <span style="color: #80FF00;">&quot;iframes.step2.Sample&quot;</span><span style="color: #F8F8F8;">,</span><br />
&nbsp; &nbsp; <span style="color: #9FCA78">$hasScript</span> <span style="color: #F8F8F8;">:</span> true<span style="color: #F8F8F8;">,</span><br />
&nbsp; &nbsp; $wlibs<span style="color: #F8F8F8;">:</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #80FF00;">&quot;embed&quot;</span><span style="color: #F8F8F8;">:</span> <span style="color: #80FF00;">&quot;aria.embed.EmbedLib&quot;</span><br />
&nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><br />
<span style="color: #F8F8F8;">&#125;</span><span style="color: #F8F8F8;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #F8F8F8;">&#123;</span><span style="color: #BBBEFF">macro</span> main<span style="color: #F8F8F8;">&#40;</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#123;</span><span style="color: red; font-weight: bold;">@aria:Button</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; label<span style="color: #F8F8F8;">:</span> <span style="color: #80FF00;">&quot;Refresh template&quot;</span><span style="color: #F8F8F8;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onclick<span style="color: #F8F8F8;">:</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fn<span style="color: #F8F8F8;">:</span> this.$refresh<span style="color: #F8F8F8;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; scope<span style="color: #F8F8F8;">:</span> this<span style="color: #F8F8F8;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; resIndex<span style="color: #F8F8F8;">:</span> <span style="color: #F8F8F8;">-</span><span style="color: #FF3A83;">1</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><span style="color: #F8F8F8;">/</span><span style="color: #F8F8F8;">&#125;</span> Last refresh<span style="color: #F8F8F8;">:</span> $<span style="color: #F8F8F8;">&#123;</span>new Date<span style="color: #F8F8F8;">&#40;</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8;">+</span><span style="color: #80FF00;">&quot;&quot;</span><span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&amp;</span>nbsp<span style="color: #F8F8F8;">;</span> <span style="color: #F8F8F8;">&#123;</span><span style="color: red; font-weight: bold;">@aria:Button</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; label<span style="color: #F8F8F8;">:</span> <span style="color: #80FF00;">&quot;Reset iframe&quot;</span><span style="color: #F8F8F8;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onclick<span style="color: #F8F8F8;">:</span> resetEmbedController<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><span style="color: #F8F8F8;">/</span><span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&lt;</span>br <span style="color: #F8F8F8;">/&gt;&lt;</span>br <span style="color: #F8F8F8;">/&gt;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#123;</span>@embed<span style="color: #F8F8F8;">:</span>Element <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; controller<span style="color: #F8F8F8;">:</span> getEmbedController<span style="color: #F8F8F8;">&#40;</span><span style="color: #F8F8F8;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><span style="color: #F8F8F8;">/</span><span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&lt;</span>br <span style="color: #F8F8F8;">/&gt;</span><br />
&nbsp; &nbsp; <span style="color: #F8F8F8;">&#123;</span><span style="color: #F8F8F8;">/</span><span style="color: #BBBEFF">macro</span><span style="color: #F8F8F8;">&#125;</span><br />
<br />
<span style="color: #F8F8F8;">&#123;</span><span style="color: #F8F8F8;">/</span><span style="color: #BBBEFF">Template</span><span style="color: #F8F8F8;">&#125;</span></div></td></tr></table></div>

<p>And here is the associated script:</p>

<div class="wp_syntax"><table><tr><td class="code"><div class="javascript" style="font-family:monospace;">Aria.<span style="color: #F8F8F8;">tplScriptDefinition</span><span style="color: #F8F8F8;">&#40;</span><span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #EDA3ED">$classpath</span> <span style="color: #F8F8F8">:</span> <span style="color: #80FF00;">'iframes.step2.SampleScript'</span><span style="color: #F8F8F8">,</span><br />
&nbsp; &nbsp; <span style="color: #EDA3ED">$dependencies</span> <span style="color: #F8F8F8">:</span> <span style="color: #F8F8F8;">&#91;</span><span style="color: #80FF00;">'iframes.step2.EmbedController'</span><span style="color: #F8F8F8;">&#93;</span><span style="color: #F8F8F8">,</span><br />
&nbsp; &nbsp; <span style="color: #EDA3ED">$prototype</span> <span style="color: #F8F8F8">:</span> <span style="color: #F8F8F8;">&#123;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; resetEmbedController <span style="color: #F8F8F8">:</span> <span style="color: #37A3ED">function</span> <span style="color: #F8F8F8;">&#40;</span><span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">if</span> <span style="color: #F8F8F8;">&#40;</span><span style="color: #37A3ED">this</span>.<span style="color: #F8F8F8;">data</span>.<span style="color: #F8F8F8;">embedController</span><span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">this</span>.<span style="color: #F8F8F8;">data</span>.<span style="color: #F8F8F8;">embedController</span>.$dispose<span style="color: #F8F8F8;">&#40;</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">this</span>.<span style="color: #F8F8F8;">data</span>.<span style="color: #F8F8F8;">embedController</span> <span style="color: #F8F8F8">=</span> <span style="color: #37A3ED">null</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">this</span>.$refresh<span style="color: #F8F8F8;">&#40;</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><span style="color: #F8F8F8">,</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; getEmbedController <span style="color: #F8F8F8">:</span> <span style="color: #37A3ED">function</span> <span style="color: #F8F8F8;">&#40;</span><span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">if</span> <span style="color: #F8F8F8;">&#40;</span><span style="color: #F8F8F8">!</span><span style="color: #37A3ED">this</span>.<span style="color: #F8F8F8;">data</span>.<span style="color: #F8F8F8;">embedController</span><span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">this</span>.<span style="color: #F8F8F8;">data</span>.<span style="color: #F8F8F8;">embedController</span> <span style="color: #F8F8F8">=</span> <span style="color: #37A3ED">new</span> iframes.<span style="color: #F8F8F8;">step2</span>.<span style="color: #F8F8F8;">EmbedController</span><span style="color: #F8F8F8;">&#40;</span><span style="color: #80FF00;">'http://ariatemplates.com/'</span><span style="color: #F8F8F8">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #80FF00;">'width:990px;height:500px;border-width:0px;display:block;'</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">return</span> <span style="color: #37A3ED">this</span>.<span style="color: #F8F8F8;">data</span>.<span style="color: #F8F8F8;">embedController</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><br />
<span style="color: #F8F8F8;">&#125;</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span></div></td></tr></table></div>

<p>An instance of the controller is created the first time it is needed and then it is stored in the data model.</p>
<p>Unfortunately, among the browsers I tested, this solution only works as expected in Internet Explorer, surprisingly. Other browsers (Firefox, Chrome and Safari) reload an iframe when it is moved in the DOM with <code>removeChild</code> and <code>appendChild</code>. This behavior is reported as a bug <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=254144">in Mozilla</a> and in <a href="https://bugs.webkit.org/show_bug.cgi?id=13574">Webkit</a>, but it will probably not change soon, as bug reports were opened in 2004 and 2007.</p>
<h2>3 &#8211; A second (working) solution</h2>
<p>So, how to improve our previous solution to make it work in all browsers? Simply by making sure the iframe always stays at the same place in the DOM structure. We can append it directly to the &lt;body&gt;, and then visually position it absolutely with the appropriate CSS style. When the widget is displayed we compute the position and size of <code>domContainer</code> and apply it to the iframe, and when the widget is disposed, we use the &#8220;display:none&#8221; style to hide the iframe. Let&#8217;s have a look to the updated controller:</p>

<div class="wp_syntax"><table><tr><td class="code"><div class="javascript" style="font-family:monospace;">Aria.<span style="color: #F8F8F8;">classDefinition</span><span style="color: #F8F8F8;">&#40;</span><span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #EDA3ED">$classpath</span> <span style="color: #F8F8F8">:</span> <span style="color: #80FF00;">'iframes.step3.EmbedController'</span><span style="color: #F8F8F8">,</span><br />
&nbsp; &nbsp; <span style="color: #EDA3ED">$dependencies</span> <span style="color: #F8F8F8">:</span> <span style="color: #F8F8F8;">&#91;</span><span style="color: #80FF00;">'aria.utils.Dom'</span><span style="color: #F8F8F8;">&#93;</span><span style="color: #F8F8F8">,</span><br />
&nbsp; &nbsp; <span style="color: #EDA3ED">$constructor</span> <span style="color: #F8F8F8">:</span> <span style="color: #37A3ED">function</span> <span style="color: #F8F8F8;">&#40;</span>url<span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">var</span> document <span style="color: #F8F8F8">=</span> Aria.$window.<span style="color: #F8F8F8;">document</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">var</span> domElt <span style="color: #F8F8F8">=</span> document.<span style="color: #F8F8F8;">createElement</span><span style="color: #F8F8F8;">&#40;</span><span style="color: #80FF00;">'iframe'</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; domElt.<span style="color: #F8F8F8;">setAttribute</span><span style="color: #F8F8F8;">&#40;</span><span style="color: #80FF00;">'src'</span><span style="color: #F8F8F8">,</span> url<span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; domElt.<span style="color: #F8F8F8;">style</span>.<span style="color: #F8F8F8;">cssText</span> <span style="color: #F8F8F8">=</span> <span style="color: #37A3ED">this</span>._currentStyle <span style="color: #F8F8F8">=</span> <span style="color: #37A3ED">this</span>._getStyle<span style="color: #F8F8F8;">&#40;</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; document.<span style="color: #F8F8F8;">body</span>.<span style="color: #F8F8F8;">appendChild</span><span style="color: #F8F8F8;">&#40;</span>domElt<span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">this</span>._domElt <span style="color: #F8F8F8">=</span> domElt<span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">this</span>._domContainer <span style="color: #F8F8F8">=</span> <span style="color: #37A3ED">null</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><span style="color: #F8F8F8">,</span><br />
&nbsp; &nbsp; <span style="color: #EDA3ED">$destructor</span> <span style="color: #F8F8F8">:</span> <span style="color: #37A3ED">function</span> <span style="color: #F8F8F8;">&#40;</span><span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">this</span>._domContainer <span style="color: #F8F8F8">=</span> <span style="color: #37A3ED">null</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">if</span> <span style="color: #F8F8F8;">&#40;</span><span style="color: #37A3ED">this</span>._domElt<span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">this</span>._domElt.<span style="color: #F8F8F8;">parentElement</span>.<span style="color: #F8F8F8;">removeChild</span><span style="color: #F8F8F8;">&#40;</span><span style="color: #37A3ED">this</span>._domElt<span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">this</span>._domElt <span style="color: #F8F8F8">=</span> <span style="color: #37A3ED">null</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><span style="color: #F8F8F8">,</span><br />
&nbsp; &nbsp; <span style="color: #EDA3ED">$prototype</span> <span style="color: #F8F8F8">:</span> <span style="color: #F8F8F8;">&#123;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; _getStyle <span style="color: #F8F8F8">:</span> <span style="color: #37A3ED">function</span> <span style="color: #F8F8F8;">&#40;</span><span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">if</span> <span style="color: #F8F8F8;">&#40;</span><span style="color: #37A3ED">this</span>._domContainer<span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">var</span> geometry <span style="color: #F8F8F8">=</span> aria.<span style="color: #F8F8F8;">utils</span>.<span style="color: #F8F8F8;">Dom</span>.<span style="color: #F8F8F8;">getGeometry</span><span style="color: #F8F8F8;">&#40;</span><span style="color: #37A3ED">this</span>._domContainer<span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">if</span> <span style="color: #F8F8F8;">&#40;</span>geometry<span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">var</span> <span style="color: #BDAE9D">scroll</span> <span style="color: #F8F8F8">=</span> aria.<span style="color: #F8F8F8;">utils</span>.<span style="color: #F8F8F8;">Dom</span>._getDocumentScroll<span style="color: #F8F8F8;">&#40;</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; geometry.<span style="color: #F8F8F8;">x</span> <span style="color: #F8F8F8">+=</span> <span style="color: #BDAE9D">scroll</span>.<span style="color: #F8F8F8;">scrollLeft</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; geometry.<span style="color: #F8F8F8;">y</span> <span style="color: #F8F8F8">+=</span> <span style="color: #BDAE9D">scroll</span>.<span style="color: #F8F8F8;">scrollTop</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">var</span> res <span style="color: #F8F8F8">=</span> <span style="color: #F8F8F8;">&#91;</span><span style="color: #80FF00;">&quot;border-width:0px;position:absolute;left:&quot;</span><span style="color: #F8F8F8">,</span> geometry.<span style="color: #F8F8F8;">x</span><span style="color: #F8F8F8">,</span> <span style="color: #80FF00;">&quot;px;top:&quot;</span><span style="color: #F8F8F8">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; geometry.<span style="color: #F8F8F8;">y</span><span style="color: #F8F8F8">,</span> <span style="color: #80FF00;">&quot;px;width:&quot;</span><span style="color: #F8F8F8">,</span> geometry.<span style="color: #F8F8F8;">width</span><span style="color: #F8F8F8">,</span> <span style="color: #80FF00;">&quot;px;height:&quot;</span><span style="color: #F8F8F8">,</span> geometry.<span style="color: #F8F8F8;">height</span><span style="color: #F8F8F8">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #80FF00;">&quot;px;display:block;&quot;</span><span style="color: #F8F8F8;">&#93;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">return</span> res.<span style="color: #F8F8F8;">join</span><span style="color: #F8F8F8;">&#40;</span><span style="color: #80FF00;">&quot;&quot;</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">return</span> <span style="color: #80FF00;">&quot;display:none;&quot;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><span style="color: #F8F8F8">,</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; updateStyle <span style="color: #F8F8F8">:</span> <span style="color: #37A3ED">function</span> <span style="color: #F8F8F8;">&#40;</span><span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">var</span> newStyle <span style="color: #F8F8F8">=</span> <span style="color: #37A3ED">this</span>._getStyle<span style="color: #F8F8F8;">&#40;</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">if</span> <span style="color: #F8F8F8;">&#40;</span><span style="color: #37A3ED">this</span>._domElt <span style="color: #F8F8F8">&amp;&amp;</span> newStyle <span style="color: #F8F8F8">!=</span> <span style="color: #37A3ED">this</span>._currentStyle<span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">this</span>._domElt.<span style="color: #F8F8F8;">style</span>.<span style="color: #F8F8F8;">cssText</span> <span style="color: #F8F8F8">=</span> newStyle<span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">this</span>._currentStyle <span style="color: #F8F8F8">=</span> newStyle<span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><span style="color: #F8F8F8">,</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; onEmbededElementCreate <span style="color: #F8F8F8">:</span> <span style="color: #37A3ED">function</span> <span style="color: #F8F8F8;">&#40;</span>domContainer<span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">if</span> <span style="color: #F8F8F8;">&#40;</span><span style="color: #37A3ED">this</span>._domContainer<span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">this</span>.$logError<span style="color: #F8F8F8;">&#40;</span><span style="color: #80FF00;">&quot;The iframe controller is used in multiple places!&quot;</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">return</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">this</span>._domContainer <span style="color: #F8F8F8">=</span> domContainer<span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">this</span>.<span style="color: #F8F8F8;">updateStyle</span><span style="color: #F8F8F8;">&#40;</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><span style="color: #F8F8F8">,</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; onEmbededElementDispose <span style="color: #F8F8F8">:</span> <span style="color: #37A3ED">function</span> <span style="color: #F8F8F8;">&#40;</span>domContainer<span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">if</span> <span style="color: #F8F8F8;">&#40;</span><span style="color: #37A3ED">this</span>._domContainer <span style="color: #F8F8F8">==</span> domContainer<span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">this</span>._domContainer <span style="color: #F8F8F8">=</span> <span style="color: #37A3ED">null</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">this</span>.<span style="color: #F8F8F8;">updateStyle</span><span style="color: #F8F8F8;">&#40;</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><br />
<span style="color: #F8F8F8;">&#125;</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span></div></td></tr></table></div>

<p>This controller uses the <a href="http://ariatemplates.com/aria/guide/apps/apidocs/#aria.utils.Dom:getGeometry:method">getGeometry</a> method to get the position and size of the <code>domContainer</code> in the viewport, and it adds the current scroll position to get an absolute position (no longer relative to the viewport).</p>
<p>Note that in order to use the new controller, it&#8217;s now necessary to specify a size in the attributes of the <code>@embed:Element</code> widget directly:</p>

<div class="wp_syntax"><table><tr><td class="code"><div class="at" style="font-family:monospace;"><span style="color: #F8F8F8;">&#123;</span>@embed<span style="color: #F8F8F8;">:</span>Element <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; controller<span style="color: #F8F8F8;">:</span> getEmbedController<span style="color: #F8F8F8;">&#40;</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8;">,</span><br />
&nbsp; &nbsp; attributes<span style="color: #F8F8F8;">:</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; style<span style="color: #F8F8F8;">:</span> <span style="color: #80FF00;">&quot;width:990px;height:500px;&quot;</span><br />
&nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><br />
<span style="color: #F8F8F8;">&#125;</span><span style="color: #F8F8F8;">/</span><span style="color: #F8F8F8;">&#125;</span></div></td></tr></table></div>

<p>With this controller it is now possible to include persistent iframes in templates.</p>
<h2>4 &#8211; Improving the solution for dialogs</h2>
<p>Now, when trying to include an iframe with the controller of the previous section in a <a href="http://ariatemplates.com/usermanual/Dialog">dialog</a>, it does not display anything. Why? Here are the reasons and how to solve the issue:
<ul>
<li>Before displaying a dialog, Aria Templates first checks its dimensions, and this is done out of the viewport (with negative coordinates). So, at the time <code>onEmbededElementCreate</code> is called, the <code>domContainer</code> is not yet correctly positioned. To fix this, it is necessary to delay a bit the call to <code>updateStyle</code> with <code>setTimeout</code>:

<div class="wp_syntax"><table><tr><td class="code"><div class="javascript" style="font-family:monospace;">onEmbededElementCreate <span style="color: #F8F8F8">:</span> <span style="color: #37A3ED">function</span> <span style="color: #F8F8F8;">&#40;</span>domContainer<span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #37A3ED">if</span> <span style="color: #F8F8F8;">&#40;</span><span style="color: #37A3ED">this</span>._domContainer<span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">this</span>.$logError<span style="color: #F8F8F8;">&#40;</span><span style="color: #80FF00;">&quot;The iframe controller is used in multiple places!&quot;</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">return</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #37A3ED">this</span>._domContainer <span style="color: #F8F8F8">=</span> domContainer<span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; setTimeout<span style="color: #F8F8F8;">&#40;</span>aria.<span style="color: #F8F8F8;">utils</span>.<span style="color: #37A3ED">Function</span>.<span style="color: #F8F8F8;">bind</span><span style="color: #F8F8F8;">&#40;</span><span style="color: #37A3ED">this</span>.<span style="color: #F8F8F8;">updateStyle</span><span style="color: #F8F8F8">,</span> <span style="color: #37A3ED">this</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">,</span> <span style="color: #FF3A83;">1</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
<span style="color: #F8F8F8;">&#125;</span></div></td></tr></table></div>

</li>
<li>Another reason is that the dialog is displayed with a high z-index value, so it appears above the iframe, hiding it completely. To fix this, it is necessary to apply a z-index value to the iframe. Even if the following method does not take into account the special behaviors of z-Index (see <a href="http://philipwalton.com/articles/what-no-one-told-you-about-z-index/">this interesting article</a>), it allows to compute a z-Index value that will probably work for common use cases:

<div class="wp_syntax"><table><tr><td class="code"><div class="javascript" style="font-family:monospace;">_computeZIndex <span style="color: #F8F8F8">:</span> <span style="color: #37A3ED">function</span> <span style="color: #F8F8F8;">&#40;</span>element<span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #37A3ED">var</span> zIndex <span style="color: #F8F8F8">=</span> <span style="color: #FF3A83;">1</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; <span style="color: #37A3ED">var</span> body <span style="color: #F8F8F8">=</span> Aria.$window.<span style="color: #F8F8F8;">document</span>.<span style="color: #F8F8F8;">body</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; <span style="color: #37A3ED">while</span> <span style="color: #F8F8F8;">&#40;</span>element <span style="color: #F8F8F8">&amp;&amp;</span> element <span style="color: #F8F8F8">!=</span> body<span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">var</span> elementZIndex <span style="color: #F8F8F8">=</span> parseInt<span style="color: #F8F8F8;">&#40;</span>element.<span style="color: #F8F8F8;">style</span>.<span style="color: #F8F8F8;">zIndex</span><span style="color: #F8F8F8">,</span> <span style="color: #FF3A83;">10</span><span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #37A3ED">if</span> <span style="color: #F8F8F8;">&#40;</span><span style="color: #F8F8F8">!</span>isNaN<span style="color: #F8F8F8;">&#40;</span>elementZIndex<span style="color: #F8F8F8;">&#41;</span><span style="color: #F8F8F8;">&#41;</span> <span style="color: #F8F8F8;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; zIndex <span style="color: #F8F8F8">=</span> elementZIndex <span style="color: #F8F8F8">+</span> <span style="color: #FF3A83;">1</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; element <span style="color: #F8F8F8">=</span> element.<span style="color: #F8F8F8;">parentNode</span><span style="color: #F8F8F8">;</span><br />
&nbsp; &nbsp; <span style="color: #F8F8F8;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #37A3ED">return</span> zIndex<span style="color: #F8F8F8">;</span><br />
<span style="color: #F8F8F8;">&#125;</span></div></td></tr></table></div>

</li>
<li>In case the dialog is movable, it is important to update the position of the iframe when the dialog is moved. However, as the iframe is not included in the dialog DOM structure, and because of the way the dialog is currently implemented, it is probably best for the user experience to simply hide the iframe when the user starts dragging the dialog and make it visible again when he drops it. This can be implemented simply with a <code>setVisible</code> method on the controller (see the next section for the code to download).</li>
</ul>
<h2>Source code</h2>
<p>Here is a <a href="http://ariatemplates.com/blog/wp-content/uploads/2013/01/iframes.zip" rel="attachment wp-att-614">zip file</a> containing the source code of the 4 previous sections. To try those samples, you can simply put the iframes folder at the root of your web server. Then you will probably have to update the <code>/iframes/index.html</code> file so that it contains the correct reference to the Aria Templates framework files installed on your web server.</a></p>
<h2>Conclusion</h2>
<p>This blog post explained how to use the <code>@embed:Element</code> widget to display persistent iframes with Aria Templates. The same technique can be applied for other components as well. Note that the first solution is working well for maps, and it is used internally by the <code>@embed:Map</code> widget.</p>
<p>If you found this blog post useful, or if you have any interesting remark, please do not hesitate to leave a comment below.</p>
]]></content:encoded>
			<wfw:commentRss>http://ariatemplates.com/blog/2013/01/iframes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Aria Templates 1.3.4</title>
		<link>http://ariatemplates.com/blog/2013/01/aria-templates-1-3-4/</link>
		<comments>http://ariatemplates.com/blog/2013/01/aria-templates-1-3-4/#comments</comments>
		<pubDate>Fri, 11 Jan 2013 16:19:36 +0000</pubDate>
		<dc:creator>Fabio Crisci</dc:creator>
				<category><![CDATA[Releases]]></category>

		<guid isPermaLink="false">http://ariatemplates.com/blog/?p=552</guid>
		<description><![CDATA[Here we are with our first release of 2013. Among the changes done in this sprint there are few new features: HTML checkbox widget ew simple checkbox widget in the HTML library with a bindable checked property. Pull Request #285. Array of listeners in aria.html.Element Gives the ability to add multiple event listeners on widgets &#8230;]]></description>
				<content:encoded><![CDATA[<p>Here we are with our first release of 2013.</p>
<p>Among the <a href="https://github.com/ariatemplates/ariatemplates/issues?milestone=13&#038;page=1&#038;state=closed" title="Changes in 1.3.4">changes</a> done in this sprint there are few new features:</p>
<ul>
<li><strong>HTML checkbox widget</strong><br />
<blockquote><p>ew simple checkbox widget in the HTML library with a bindable checked property. Pull Request <a href="https://github.com/ariatemplates/ariatemplates/pull/285" title="Pull Request #285">#285</a>.</p></blockquote>
</li>
<li><strong>Array of listeners in aria.html.Element</strong><br />
<blockquote><p>Gives the ability to add multiple event listeners on widgets extending from Element. Pull Request <a href="https://github.com/ariatemplates/ariatemplates/pull/320" title="Pull Request #320">#320</a>.</p></blockquote>
</li>
<li><strong>Vertical splitter implementation</strong><br />
<blockquote><p>Now its possible create splitter in both horizontal and vertical direction. See GH Pull Request <a href="https://github.com/ariatemplates/ariatemplates/pull/311" title="Pull Request #311">#311</a>.</p></blockquote>
</li>
</ul>
<p>See you in 3 weeks!</p>
]]></content:encoded>
			<wfw:commentRss>http://ariatemplates.com/blog/2013/01/aria-templates-1-3-4/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Aria Templates 1.3.3</title>
		<link>http://ariatemplates.com/blog/2013/01/aria-templates-1-3-3/</link>
		<comments>http://ariatemplates.com/blog/2013/01/aria-templates-1-3-3/#comments</comments>
		<pubDate>Fri, 11 Jan 2013 15:50:46 +0000</pubDate>
		<dc:creator>Fabio Crisci</dc:creator>
				<category><![CDATA[Releases]]></category>

		<guid isPermaLink="false">http://ariatemplates.com/blog/?p=546</guid>
		<description><![CDATA[During the last sprint of 2012 we released a new version of Aria Templates, 1.3.3 with the following : Performance enhancements for Flow Controllers and Interceptors There has been a refactoring of Interceptors, specifically in relation to Flow Controllers which has greatly improved performances for all browsers and most notably for IE. Pull request #270. &#8230;]]></description>
				<content:encoded><![CDATA[<p>During the last sprint of 2012 we released a new version of Aria Templates, 1.3.3 with the following <a href="https://github.com/ariatemplates/ariatemplates/issues?milestone=12&#038;state=closed" title="changes" target="_blank"></a>:</p>
<ul>
<li><strong>Performance enhancements for Flow Controllers and Interceptors</strong><br />
<blockquote><p>There has been a refactoring of Interceptors, specifically in relation to Flow Controllers which has greatly improved performances for all browsers and most notably for IE. Pull request <a href="https://github.com/ariatemplates/ariatemplates/pull/270/" title="Pull request #270" target="_blank">#270</a>.</p></blockquote>
</li>
<li><strong>Enhancement of the TextInput widget of the html library</strong><br />
<blockquote><p>The following features have been added to the html TextInput widget:</p>
<ul>
<li>Possibility to set the type &#8220;password&#8221; on it (by setting property &#8220;password&#8221; of the widget configuration to true) (GH pull request <a href="https://github.com/ariatemplates/ariatemplates/pull/265/" title="Pull request #265" target="_blank">#265</a>).</li>
<li>Possibility to call $focus providing an id. (GH pull requests <a href="https://github.com/ariatemplates/ariatemplates/pull/267/" title="Pull request #267" target="_blank">#267</a> and <a href="https://github.com/ariatemplates/ariatemplates/pull/268/" title="Pull request #268" target="_blank">#268</a>)</li>
<li>Introducing the autoselect feature. (GH pull requests <a href="https://github.com/ariatemplates/ariatemplates/pull/272/" title="Pull request #272" target="_blank">#272</a>)</li>
<li>Introducing cross browser support for placeholder attribute. (GH pull request <a href="https://github.com/ariatemplates/ariatemplates/pull/288/" title="Pull request #288" target="_blank">#288</a>)</li>
</ul>
</blockquote>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://ariatemplates.com/blog/2013/01/aria-templates-1-3-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
