<?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>All Markup News</title>
	<atom:link href="http://psdinhtml.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://psdinhtml.com</link>
	<description>Blog All Markup News</description>
	<lastBuildDate>Sat, 04 Sep 2010 02:07:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Same Markup: Using , , and</title>
		<link>http://psdinhtml.com/same-markup-using-and/</link>
		<comments>http://psdinhtml.com/same-markup-using-and/#comments</comments>
		<pubDate>Sat, 04 Sep 2010 02:07:00 +0000</pubDate>
		<dc:creator>tee</dc:creator>
				<category><![CDATA[W3C News]]></category>

		<guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10057962</guid>
		<description><![CDATA[<p>On this blog we&#8217;ve repeatedly discussed enabling the "Same Markup" for Internet Explorer 9. Part of making "Same Markup" a reality involves supporting the right features in IE9 to make the same HTML, JavaScript, and CSS "just work" the same way they do in other browsers. Part of how IE9 contributes to enabling the "Same Markup" is through support for the &#60;canvas&#62;, &#60;audio&#62;, and &#60;video&#62; elements from HTML5. These were introduced in the third platform preview and continue to be improved with each update. </p>
<p>In <a rel="nofollow" target="_blank" href="http://blogs.msdn.com/b/ie/archive/2010/04/14/same-markup-writing-cross-browser-code.aspx">my first post on "Same Markup"</a>, I described the effort as an "n-way street". Each browser has a part to play by supporting the right features with the right behavior. Web developers also have a part to play in how they code for cross-browser differences where they unfortunately still exist. The most important part of working across browsers for web developers is to detect features, not browsers. So in this post I'll outline how to use feature detection for &#60;canvas&#62;, &#60;audio&#62;, and &#60;video&#62;. </p>
<h3>Detecting Support from HTML Markup</h3>
<p>Unlike other features, support for &#60;canvas&#62;, &#60;audio&#62;, and &#60;video&#62; can be detected directly from HTML markup. This involves simply using the desired element, then placing fallback content inside of it intended for browsers that don't have support for these elements. Browsers with support will hide this content from the user and display only the &#60;canvas&#62;, &#60;audio&#62;, or &#60;video&#62; element itself. </p>
<pre><code><span class="comment">&#60;!-- <strong>Example 1:</strong> Basic &#60;canvas&#62; fallback --&#62;</span>
&#60;canvas&#62; This text only displays in browsers without canvas support.
&#60;/canvas&#62;</code></pre>
<pre><code><span class="comment">&#60;!-- <strong>Example 2:</strong> Basic &#60;audio&#62; fallback --&#62;</span>
&#60;audio&#62; This text only displays in browsers without audio support.
&#60;/audio&#62;</code></pre>
<pre><code><span class="comment">&#60;!-- <strong>Example 3:</strong> Basic &#60;video&#62; fallback --&#62;</span>
&#60;video&#62; This text only displays in browsers without video support.
&#60;/video&#62;</code></pre>
<p>One caveat to keep in mind is that fallback content is only hidden visually. &#60;script&#62; blocks and other items in fallback content will always execute, even in browsers that support these elements. </p>
<pre><code><span class="comment">&#60;!-- <strong>Example 4:</strong> &#60;script&#62; always executes in fallback content --&#62;</span>
&#60;canvas&#62; &#60;script&#62; alert("This always runs, even when canvas is supported."); &#60;/script&#62;
&#60;/canvas&#62;</code></pre>
<p>Of course, fallback content should also be useful. Exactly what qualifies as useful can vary depending on what you are trying to do. One approach is to point the user at a download for an upgrade, but in most cases it is a better experience for consumers to fall back to alternative approaches for delivering the content. For example, if you're drawing something that doesn't change much to a canvas, you may be able to fall back to an image that gets generated server-side. A better alternative could involve including a framework which implements canvas on top of existing web technologies or using a widely deployed plug-in. </p>
<p>The &#60;audio&#62; and &#60;video&#62; elements tend to have more options for fallback via plug-ins, whether through a media player or an app built on top of a widely deployed technology such as Flash or Silverlight. At the very least you can provide the user with a link to download the file so they can play it locally. The examples below provide a rough view of this type of fallback, though the &#60;object&#62; tag generally requires a number of varying parameters specific to the chosen plug-in. </p>
<pre><code><span class="comment">&#60;!-- <strong>Example 5:</strong> Provide useful fallback content for &#60;audio&#62; --&#62;</span>
&#60;audio src="<span class="pseudo">myaudio</span>"&#62; &#60;object type="<span class="pseudo">audio-plugin-mime-type</span>" data="<span class="pseudo">myaudio</span>"&#62; &#60;a href="<span class="pseudo">myaudio</span>"&#62;Download the audio file&#60;/a&#62; &#60;/object&#62;
&#60;/audio&#62;</code></pre>
<pre><code><span class="comment">&#60;!-- <strong>Example 6:</strong> Provide useful fallback content for &#60;video&#62; --&#62;</span>
&#60;video src="<span class="pseudo">myvideo</span>"&#62; &#60;object type="<span class="pseudo">video-plugin-mime-type</span>" data="<span class="pseudo">myvideo</span>"&#62; &#60;a href="<span class="pseudo">myvideo</span>"&#62;Download the video file&#60;/a&#62; &#60;/object&#62;
&#60;/video&#62;</code></pre>
<h3>Detecting Support from Script</h3>
<p>In addition to HTML markup, support for &#60;canvas&#62;, &#60;audio&#62;, and &#60;video&#62; can also be detected from script. This detection can be performed many ways, but one of the simplest is to check for the existence of the appropriate interface object off of window. </p>
<pre><code><span class="comment">// <strong>Example 7:</strong> Simple feature detection for &#60;canvas&#62;</span>
if(window.HTMLCanvasElement) { <span class="comment">// Code requiring canvas support</span>
}</code></pre>
<pre><code><span class="comment">// <strong>Example 8:</strong> Simple feature detection for &#60;audio&#62;</span>
if(window.HTMLAudioElement) { <span class="comment">// Code requiring audio support</span>
}</code></pre>
<pre><code><span class="comment">// <strong>Example 9:</strong> Simple feature detection for &#60;video&#62;</span>
if(window.HTMLVideoElement) { <span class="comment">// Code requiring video support</span>
}</code></pre>
<p>An alternative approach for detecting &#60;audio&#62; and &#60;video&#62; involves checking for the existence of the canPlayType method on a dynamically created &#60;audio&#62; or &#60;video&#62; element. This is used by a number of frameworks and is generally preferred if you also intend to use the canPlayType method to test for supported codecs (which will be covered in a future post). If you simply need to test whether &#60;audio&#62; or &#60;video&#62; is supported, then I find the approach outlined above in examples 8 and 9 to be more obvious and equally as effective. </p>
<pre><code><span class="comment">// <strong>Example 10:</strong> Alternate feature detection for &#60;audio&#62;</span>
if(document.createElement("audio").canPlayType) { <span class="comment">// Code requiring audio support</span>
}</code></pre>
<pre><code><span class="comment">// <strong>Example 11:</strong> Alternate feature detection for &#60;video&#62;</span>
if(document.createElement("video").canPlayType) { <span class="comment">// Code requiring video support</span>
}</code></pre>
<p>A similar alternative approach can be used for detecting &#60;canvas&#62; support. In this case, most frameworks have settled on checking for the existence of the getContext method. This makes sense for &#60;canvas&#62; given that this method is required in order to retrieve a context for rendering. </p>
<pre><code><span class="comment">// <strong>Example 12:</strong> Alternate feature detection for &#60;canvas&#62;</span>
if(document.createElement("canvas").getContext) { <span class="comment">// Code requiring canvas support</span>
}</code></pre>
<h3>Next Steps</h3>
<p>If you have previously used browser detection to decide whether to use &#60;canvas&#62;, &#60;audio&#62;, or &#60;video&#62;, now is the time to update to use feature detection instead. Also, make sure you have a DOCTYPE at the top of your page (e.g. &#60;!DOCTYPE html&#62;) so your content doesn't render in Quirks Mode. In IE9, Quirks Mode is used for compatibility and consequently the &#60;canvas&#62;, &#60;audio&#62;, and &#60;video&#62; elements will not work there. </p>
<p>Stay tuned for future posts covering how to detect supported codecs and specify multiple sources using the &#60;audio&#62; and &#60;video&#62; elements. </p>
<p>Tony Ross <br />Program Manager </p>
<p>Edit 9/3 - added link to earlier blog post in second paragraph</p><div style="clear:both"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=10057962" width="1" height="1">]]></description>
		<wfw:commentRss>http://psdinhtml.com/same-markup-using-and/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Same Markup: Using , , and</title>
		<link>http://psdinhtml.com/same-markup-using-and/</link>
		<comments>http://psdinhtml.com/same-markup-using-and/#comments</comments>
		<pubDate>Sat, 04 Sep 2010 02:07:00 +0000</pubDate>
		<dc:creator>tee</dc:creator>
				<category><![CDATA[W3C News]]></category>

		<guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10057962</guid>
		<description><![CDATA[<p>On this blog we&#8217;ve repeatedly discussed enabling the "Same Markup" for Internet Explorer 9. Part of making "Same Markup" a reality involves supporting the right features in IE9 to make the same HTML, JavaScript, and CSS "just work" the same way they do in other browsers. Part of how IE9 contributes to enabling the "Same Markup" is through support for the &#60;canvas&#62;, &#60;audio&#62;, and &#60;video&#62; elements from HTML5. These were introduced in the third platform preview and continue to be improved with each update. </p>
<p>In <a rel="nofollow" target="_blank" href="http://blogs.msdn.com/b/ie/archive/2010/04/14/same-markup-writing-cross-browser-code.aspx">my first post on "Same Markup"</a>, I described the effort as an "n-way street". Each browser has a part to play by supporting the right features with the right behavior. Web developers also have a part to play in how they code for cross-browser differences where they unfortunately still exist. The most important part of working across browsers for web developers is to detect features, not browsers. So in this post I'll outline how to use feature detection for &#60;canvas&#62;, &#60;audio&#62;, and &#60;video&#62;. </p>
<h3>Detecting Support from HTML Markup</h3>
<p>Unlike other features, support for &#60;canvas&#62;, &#60;audio&#62;, and &#60;video&#62; can be detected directly from HTML markup. This involves simply using the desired element, then placing fallback content inside of it intended for browsers that don't have support for these elements. Browsers with support will hide this content from the user and display only the &#60;canvas&#62;, &#60;audio&#62;, or &#60;video&#62; element itself. </p>
<pre><code><span class="comment">&#60;!-- <strong>Example 1:</strong> Basic &#60;canvas&#62; fallback --&#62;</span>
&#60;canvas&#62; This text only displays in browsers without canvas support.
&#60;/canvas&#62;</code></pre>
<pre><code><span class="comment">&#60;!-- <strong>Example 2:</strong> Basic &#60;audio&#62; fallback --&#62;</span>
&#60;audio&#62; This text only displays in browsers without audio support.
&#60;/audio&#62;</code></pre>
<pre><code><span class="comment">&#60;!-- <strong>Example 3:</strong> Basic &#60;video&#62; fallback --&#62;</span>
&#60;video&#62; This text only displays in browsers without video support.
&#60;/video&#62;</code></pre>
<p>One caveat to keep in mind is that fallback content is only hidden visually. &#60;script&#62; blocks and other items in fallback content will always execute, even in browsers that support these elements. </p>
<pre><code><span class="comment">&#60;!-- <strong>Example 4:</strong> &#60;script&#62; always executes in fallback content --&#62;</span>
&#60;canvas&#62; &#60;script&#62; alert("This always runs, even when canvas is supported."); &#60;/script&#62;
&#60;/canvas&#62;</code></pre>
<p>Of course, fallback content should also be useful. Exactly what qualifies as useful can vary depending on what you are trying to do. One approach is to point the user at a download for an upgrade, but in most cases it is a better experience for consumers to fall back to alternative approaches for delivering the content. For example, if you're drawing something that doesn't change much to a canvas, you may be able to fall back to an image that gets generated server-side. A better alternative could involve including a framework which implements canvas on top of existing web technologies or using a widely deployed plug-in. </p>
<p>The &#60;audio&#62; and &#60;video&#62; elements tend to have more options for fallback via plug-ins, whether through a media player or an app built on top of a widely deployed technology such as Flash or Silverlight. At the very least you can provide the user with a link to download the file so they can play it locally. The examples below provide a rough view of this type of fallback, though the &#60;object&#62; tag generally requires a number of varying parameters specific to the chosen plug-in. </p>
<pre><code><span class="comment">&#60;!-- <strong>Example 5:</strong> Provide useful fallback content for &#60;audio&#62; --&#62;</span>
&#60;audio src="<span class="pseudo">myaudio</span>"&#62; &#60;object type="<span class="pseudo">audio-plugin-mime-type</span>" data="<span class="pseudo">myaudio</span>"&#62; &#60;a href="<span class="pseudo">myaudio</span>"&#62;Download the audio file&#60;/a&#62; &#60;/object&#62;
&#60;/audio&#62;</code></pre>
<pre><code><span class="comment">&#60;!-- <strong>Example 6:</strong> Provide useful fallback content for &#60;video&#62; --&#62;</span>
&#60;video src="<span class="pseudo">myvideo</span>"&#62; &#60;object type="<span class="pseudo">video-plugin-mime-type</span>" data="<span class="pseudo">myvideo</span>"&#62; &#60;a href="<span class="pseudo">myvideo</span>"&#62;Download the video file&#60;/a&#62; &#60;/object&#62;
&#60;/video&#62;</code></pre>
<h3>Detecting Support from Script</h3>
<p>In addition to HTML markup, support for &#60;canvas&#62;, &#60;audio&#62;, and &#60;video&#62; can also be detected from script. This detection can be performed many ways, but one of the simplest is to check for the existence of the appropriate interface object off of window. </p>
<pre><code><span class="comment">// <strong>Example 7:</strong> Simple feature detection for &#60;canvas&#62;</span>
if(window.HTMLCanvasElement) { <span class="comment">// Code requiring canvas support</span>
}</code></pre>
<pre><code><span class="comment">// <strong>Example 8:</strong> Simple feature detection for &#60;audio&#62;</span>
if(window.HTMLAudioElement) { <span class="comment">// Code requiring audio support</span>
}</code></pre>
<pre><code><span class="comment">// <strong>Example 9:</strong> Simple feature detection for &#60;video&#62;</span>
if(window.HTMLVideoElement) { <span class="comment">// Code requiring video support</span>
}</code></pre>
<p>An alternative approach for detecting &#60;audio&#62; and &#60;video&#62; involves checking for the existence of the canPlayType method on a dynamically created &#60;audio&#62; or &#60;video&#62; element. This is used by a number of frameworks and is generally preferred if you also intend to use the canPlayType method to test for supported codecs (which will be covered in a future post). If you simply need to test whether &#60;audio&#62; or &#60;video&#62; is supported, then I find the approach outlined above in examples 8 and 9 to be more obvious and equally as effective. </p>
<pre><code><span class="comment">// <strong>Example 10:</strong> Alternate feature detection for &#60;audio&#62;</span>
if(document.createElement("audio").canPlayType) { <span class="comment">// Code requiring audio support</span>
}</code></pre>
<pre><code><span class="comment">// <strong>Example 11:</strong> Alternate feature detection for &#60;video&#62;</span>
if(document.createElement("video").canPlayType) { <span class="comment">// Code requiring video support</span>
}</code></pre>
<p>A similar alternative approach can be used for detecting &#60;canvas&#62; support. In this case, most frameworks have settled on checking for the existence of the getContext method. This makes sense for &#60;canvas&#62; given that this method is required in order to retrieve a context for rendering. </p>
<pre><code><span class="comment">// <strong>Example 12:</strong> Alternate feature detection for &#60;canvas&#62;</span>
if(document.createElement("canvas").getContext) { <span class="comment">// Code requiring canvas support</span>
}</code></pre>
<h3>Next Steps</h3>
<p>If you have previously used browser detection to decide whether to use &#60;canvas&#62;, &#60;audio&#62;, or &#60;video&#62;, now is the time to update to use feature detection instead. Also, make sure you have a DOCTYPE at the top of your page (e.g. &#60;!DOCTYPE html&#62;) so your content doesn't render in Quirks Mode. In IE9, Quirks Mode is used for compatibility and consequently the &#60;canvas&#62;, &#60;audio&#62;, and &#60;video&#62; elements will not work there. </p>
<p>Stay tuned for future posts covering how to detect supported codecs and specify multiple sources using the &#60;audio&#62; and &#60;video&#62; elements. </p>
<p>Tony Ross <br />Program Manager </p>
<p>Edit 9/3 - added link to earlier blog post in second paragraph</p><div style="clear:both"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=10057962" width="1" height="1">]]></description>
		<wfw:commentRss>http://psdinhtml.com/same-markup-using-and/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add-ons, Installation Experiences, and User Consent</title>
		<link>http://psdinhtml.com/add-ons-installation-experiences-and-user-consent/</link>
		<comments>http://psdinhtml.com/add-ons-installation-experiences-and-user-consent/#comments</comments>
		<pubDate>Sat, 04 Sep 2010 00:10:00 +0000</pubDate>
		<dc:creator>tee</dc:creator>
				<category><![CDATA[W3C News]]></category>

		<guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10057928</guid>
		<description><![CDATA[<p>As discussed in previous blog posts, add-ons can have a material impact on browser <a rel="nofollow" target="_blank" href="http://blog.mozilla.com/addons/2010/06/14/improve-extension-startup-performance/">performance</a>. IE measures <a rel="nofollow" target="_blank" href="http://blogs.msdn.com/b/ie/archive/2010/08/31/add-on-performance-part-2-helping-consumers-make-informed-decisions.aspx">the performance of add-ons</a> so that <a rel="nofollow" target="_blank" href="http://lifehacker.com/5318940/internet-explorer-determines-which-add+ons-slow-down-browsing">users can make informed decisions</a> about them. It is important to understand how add-ons arrive on a user&#8217;s system to begin with because browser performance is so important to site developers and to consumers. The notification and control that users have around the add-on installation process is equally important because add-ons can also have an impact on user privacy and information sharing. This blog post surveys the current installation experience for different kinds of add-ons in different browsers and how the add-on installation experience can be more robust for consumers.</p>
<p>First, let&#8217;s look at mark-up based add-ons in IE. These add-ons describe their functionality without any executable code, typically using XML. Examples are OpenSearch providers, Web Slices, and Accelerators. There is no code in the add-on itself and no code involved when the add-on is installed. Consumers install these add-ons from within the browser. There is clear consumer consent as part of that in-browser installation experience:</p>
<p><img src="http://ieblog.members.winisp.net/images/Herman-addon-install-1.png"></p>
<p>Binary add-ons, like Toolbars and BHOs, are full Windows programs that run within the browser. The installers for these Windows programs are other Windows programs that run outside the browser. Some add-on installations are the result of a user explicitly seeking them out and installing them. Other add-on installations are bundled with other software. These can be a surprise to users, and are often installed without explicit consent.&#160; Technically, browsers can only detect that an add-on was installed, not what consent the user gave during installation. We hope you&#8217;ll share your favorite examples of software installation surprises in the comments. It is not clear from within the browser what consent (if any) a consumer has given when one of these add-ons is installed. It is clear that the next time the user starts IE, the new add-ons will affect browser performance and reliability, and possibly privacy. </p>
<p>Add-ons can also affect privacy. Additional code running in the browser can send user information to websites. (You can read more about an add-on that sent user information inappropriately <a rel="nofollow" target="_blank" href="http://www.eweek.com/c/a/Security/Mozilla-Firefox-Addon-Pulled-for-Stealing-Passwords-399326/">here</a>.) For this reason, when users start IE8&#8217;s InPrivate Browsing feature, IE runs <i>without</i> toolbars and BHOs. The user expects an InPrivate session to be private, and there is no way for IE to know what information add-ons save on the user&#8217;s system or send to websites.&#160; </p>
<p>Because many add-on setup experiences surprise users, some browsers today seek user conformation before they run newly installed add-ons. For example, here&#8217;s the dialog that Firefox 3.6 shows the first time the user starts it after installing an add-on:</p>
<p><img src="http://ieblog.members.winisp.net/images/Herman-addon-install-2.png"></p>
<p>Note that before seeing this prompt, the user initiated the add-on installation explicitly and clicked two prompts <i>within</i> the browser to install the add-on. </p>
<p>On today&#8217;s web, consumers face many different threats to browser security, reliability, performance, and privacy. We work closely with other software vendors to make experiences within IE better for consumers. For example, we exchange feedback with toolbar vendors about their work and the <a rel="nofollow" target="_blank" href="http://blogs.msdn.com/b/ie/archive/2009/09/09/guidelines-for-add-on-developers.aspx">IE Add-on Guidelines and Requirements</a>. Many times, these conversations result in <a rel="nofollow" target="_blank" href="http://blogs.msdn.com/b/ie/archive/2010/08/11/add-on-guidelines-and-requirements-in-action-upgrade-advisor.aspx">improvements to add-ons</a>. Microsoft treats all add-ons and software vendors consistently with respect to these guidelines and requirements. Given the ambiguities and risks around add-ons, consumers benefit from having more information and more control over how add-ons are installed. </p>
<p>Herman Ng</p>
<p>Program Manager, Internet Explorer</p><div style="clear:both"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=10057928" width="1" height="1">]]></description>
		<wfw:commentRss>http://psdinhtml.com/add-ons-installation-experiences-and-user-consent/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>10.62 Release Candidate</title>
		<link>http://psdinhtml.com/10-62-release-candidate/</link>
		<comments>http://psdinhtml.com/10-62-release-candidate/#comments</comments>
		<pubDate>Fri, 03 Sep 2010 08:49:36 +0000</pubDate>
		<dc:creator>Arjan van Leeuwen</dc:creator>
				<category><![CDATA[W3C News]]></category>

		<guid isPermaLink="false">urn:myopera-desktopteam-blog-16703262</guid>
		<description><![CDATA[It is about time for an update to our stable branch and hence we have a nice new 10.62 build for you. The fixes listed below are since the 10.61 final. <br /><br />Since this is a release candidate please let us know if you see any regressions since 10.61 and remember fixes to 10.70 that are missing are not regressions! ;)<br /><br /><strong>Note:</strong> These packages have the old non-unified build numbers. However, 10.70 and above will continue to have unified build numbers. Also because this is the 10.6x line we still have PowerPC.<br /><br /><strong><span style="font-size:140%">Download</span></strong><br /><ul class="bullets"><li><a rel="nofollow" target="_blank" href="http://snapshot.opera.com/windows/stability_10.62-3499/Opera_1062_3499_in.exe">Windows MSI</a> / <a rel="nofollow" target="_blank" href="http://snapshot.opera.com/windows/stability_10.62-3499/Opera_1062_3499_classic.exe">Windows Classic</a><br /> </li><li><a rel="nofollow" target="_blank" href="http://snapshot.opera.com/mac/stability_10.62-8436/Opera_10.62_8436.dmg">Mac (Universal)</a> / <a rel="nofollow" target="_blank" href="http://snapshot.opera.com/mac/stability_10.62-8436/Opera_10.62_8436_Intel.dmg">Mac (Intel-only)</a><br /> </li><li><a rel="nofollow" target="_blank" href="http://snapshot.opera.com/unix/stability_10.62-6437/">Linux/FreeBSD</a></li></ul> ...]]></description>
		<wfw:commentRss>http://psdinhtml.com/10-62-release-candidate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exploring IE9&#8217;s Enhanced DOM Capabilities</title>
		<link>http://psdinhtml.com/exploring-ie9s-enhanced-dom-capabilities/</link>
		<comments>http://psdinhtml.com/exploring-ie9s-enhanced-dom-capabilities/#comments</comments>
		<pubDate>Thu, 02 Sep 2010 22:25:00 +0000</pubDate>
		<dc:creator>tee</dc:creator>
				<category><![CDATA[W3C News]]></category>

		<guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10057500</guid>
		<description><![CDATA[<p>For IE9 Platform Preview 4, we significantly re-architected how the Chakra JavaScript engine integrates into IE. This re-architecture, described in <a rel="nofollow" target="_blank" href="http://blogs.msdn.com/b/ie/archive/2010/08/04/html5-modernized-fourth-ie9-platform-preview-available-for-developers.aspx">Dean&#8217;s post</a>, subtly changes the programming model of the DOM for IE9 standards mode, making it consistent with new ECMAScript 5 capabilities, more interoperable with other browsers and aligned with emerging standards (<a rel="nofollow" target="_blank" href="http://www.w3.org/TR/WebIDL/">WebIDL</a>).</p>
<p>In this post I want to dive into the details of some of these programming model changes. You can take advantage of these enhanced DOM capabilities in the latest platform preview build. To highlight these changes, I&#8217;ll reference the <a rel="nofollow" target="_blank" href="http://ie.microsoft.com/testdrive/HTML5/DOMCapabilities/Default.html">Enhanced DOM Capabilities demo page</a> that we released with the fourth Platform Preview.</p>
<p align="center"><span><img height="233" width="377" src="http://ieblog.members.winisp.net/images/Travis_FastDom.jpg" alt="All 24 puzzle pieces assembled into the image of the IE logo. This is a screenshot of IE9 running the Enhanced DOM capabilities demo at the IE Test Drive web page: http://ie.microsoft.com/testdrive/" border="0"></span></p>
<p>That demo tests 24 capabilities that span 4 general categories:</p>
<ul>
<li>DOM object inheritance from native JavaScript objects </li>
<li>JavaScript functional harmony with DOM objects </li>
<li>Interoperable programming features </li>
<li>New ECMAScript 5 support applied to DOM objects </li>
</ul>
<p>The first two are closely related, so I&#8217;ll discuss them together:</p>
<p><b>DOM object inheritance from native JavaScript objects and JavaScript functional harmony with DOM objects.</b>
<p>Prior to IE9, the JavaScript engine was connected to the DOM via classic COM bindings. These legacy bindings allowed for only primitive object and function representations of the DOM to the JavaScript engine. Consequently, many basic JavaScript features that developers expected to be available to all objects and functions (including DOM objects like Window, Document, NodeList, etc.) were only available to native JavaScript objects (Array, Number, etc.). </p>
<p>The ECMAScript standard specifies basic operations that should work uniformly on all JavaScript objects, but allows &#8220;host objects&#8221; to deviate from those standard specifications. IE&#8217;s old JavaScript engine treated DOM objects as &#8220;host objects&#8221; which meant that basic JavaScript operations such as property access could behave oddly. While allowed by ECMAScript, inconsistent behavior between DOM objects and JavaScript objects created differences web developers had to account for.</p>
<p>For example, one common puzzler for many web developers was why IE DOM functions were reported as &#8220;object&#8221; to the <b>typeof</b> JavaScript operator rather than "function" (this capability is specifically checked in the demo as piece #10).</p>
<p>In IE9&#8217;s Standards Mode, we build our DOM as native JavaScript objects and functions rather than as &#8220;host objects,&#8221; thus enabling the features that web developers expect from native objects.</p>
<p><b>Interoperable programming features</b></p>
<p>The third group of capabilities showcase unique IE programming model behaviors that web developers commonly stumbled over. Because these behaviors were unique to the IE programming model, web developers found that their code didn't work the same across different browsers. </p>
<p>As part of our new integration architecture, we removed many of the inconsistencies that kept the same script from working the same way across browsers. The programming model changes may cause sites that have conditional code written for IE to behave differently in IE9 than it did before. Therefore, it is worthwhile describing these changes in more depth.</p>
<p><i>Functions now enumerated </i></p>
<p>In IE8 and before, enumerating a DOM object did not include any of that DOM object&#8217;s member functions. IE9 now enumerates any property on a DOM object that has its &#8220;enumerable&#8221; property descriptor value set to &#8216;true&#8217;. (In other words, enumeration can be programmatically altered.) Functions are now enumerated by default to be consistent with other browsers.</p>
<p><i>Removed implicit function invocation </i></p>
<p>DOM functions in previous versions of IE were quite special. Not only did they claim to be <b>typeof</b> &#8220;object&#8221;, but they also retained a static &#8216;this&#8217; value which referred to the object to which they belonged. Consequently, it was possible to cache a reference to a DOM function, and invoke it without explicitly passing the &#8216;this&#8217; value:</p>
<blockquote>
<p class="code_travil"><span style="color:#00b050">// Works in IE8 and earlier versions <br />// Doesn't work in IE9 or other browsers</span><span> <br /><b>var</b> cachedGetElementById = document.getElementById; <br />cachedGetElementById('value');</span></p>
</blockquote>
<p>In IE9, this now throws an exception, as it does in other browsers. Code that formerly depended on this IE behavior may use the &#8220;.call&#8221; workaround:</p>
<blockquote>
<p class="code_travil"><span style="color:#00b050">// Works in IE8/IE9 and other browsers <br />// Doesn't work in IE7 and earlier versions; </span><span><br /><b>var</b> cachedGetElementById = document.getElementById; <br />cachedGetElementById.<span style="background:yellow">call</span>(document, 'value');</span></p>
</blockquote>
<p>ECMAScript 5 provides a &#8220;bind&#8221; method for functions which allows them to take on the programming characteristics formerly supported by IE:</p>
<blockquote>
<p class="code_travil"><span style="color:#00b050">// Works natively in IE9 because of ECMAScript 5's 'bind' API</span><span> <br /><b>var</b> cachedGetElementById = document.getElementById.<span style="background:yellow">bind</span>(document); <br />cachedGetElementById('value');</span></p>
</blockquote>
<p><i>Support for DOM exceptions and &#8216;const&#8217; properties </i></p>
<p>The IE9 enhanced DOM now includes W3C-specified <a rel="nofollow" target="_blank" href="http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-17189187">DOM exception</a> objects and standardized error codes that web developers can use to determine (generally) the nature of a DOM API failure. These codes are commonly compared against well-defined 'const' properties to aid in code readability:</p>
<blockquote>
<p class="code_travil"><span>&#8230; <br /><b>catch</b>(ex) { <br />&#160;&#160; <b>if</b> (ex.code == DOMException.INDEX_SIZE_ERR) <br />&#160;&#160;&#160;&#160;&#160; &#8230; <br />}</span></p>
</blockquote>
<p>The enhanced DOM provides the pre-defined 'const' properties as well as the architecture to throw and catch DOM exceptions.</p>
<p><i>Consistent toString behavior </i></p>
<p>With Chakra and the DOM fully integrated, the DOM does not have its own implementation of toString (a function that converts any object into a string form). While the old DOM&#8217;s toString implementation was similar to the JavaScript built-in version, it was not the same and often returned inconsistent or puzzling results. IE9 DOM objects now inherit and use the JavaScript built-in toString for more uniform results.</p>
<p><i>Separation of property and attribute storage </i></p>
<p>In the previous architecture, DOM objects had their own property storage. This property storage was the same as the storage location for attributes (those found in the HTML markup). With IE9's new architecture, an element&#8217;s attribute storage is now separate from the dynamic properties assigned to an element's script object. To illustrate this separation, consider the following example markup:</p>
<blockquote>
<p class="code_travil"><span>&#60;div <span style="color:#943634">id</span>="myId" <span style="color:#943634">class</span>="c" <span style="color:#943634">user-defined-attribute</span>="test"&#62;</span></p>
</blockquote>
<p>In the above example, &#8220;id&#8221;, &#8220;class&#8221;, and &#8220;user-defined-attribute&#8221; are attributes. The div element's JavaScript object also exposes similar properties:</p>
<blockquote>
<p class="code_travil"><span style="color:green">// Get the JavaScript object representing the body</span><span> <br /><b>var</b> divOb = document.getElementById(&#8216;myId&#8217;); <br />divOb.id; <span>&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color:green">// "myId"</span> <br />divOb.className; <span style="color:green">// "c"</span></span></p>
</blockquote>
<p>These JavaScript properties retrieve the values stored in an element&#8217;s attribute list. For example, &#8220;id&#8221; retrieves the value of the &#8220;id&#8221; attribute. &#8220;className&#8221; retrieves the value of the &#8220;class&#8221; attribute.</p>
<p>In previous versions of IE, any dynamically-added properties would &#8220;magically&#8221; appear in the element&#8217;s attribute list and vice-versa due to the shared storage location. This could lead to unexpected results:</p>
<blockquote>
<p class="code_travil"><span>&#60;div <span style="color:#943634">id</span>="myId" <span style="color:#943634">class</span>="c" <span style="color:#943634">user-defined-attribute</span>="test"&#62; <br />&#8230; <br /><b>var</b> divOb = document.getElementById("myId"); <br /><span style="color:#00b050">// The next statement unexpectedly adds "userProperty" as <br />// an attribute to the element.</span><span style="color:green"> <br /></span>divOb.userProperty = "test" <br /><br /><span style="color:#00b050">// How many attributes?</span> <br />alert("Total attributes = " + divOb.attributes.length);<span style="color:green"></span></span></p>
</blockquote>
<p>IE9 and other browsers alert three total attributes ("id", "class", and "user-defined-attribute"), whereas previous versions of IE alert 4, adding "userProperty" to the list. The reverse example is more common&#8212;code that expects user-defined attributes to appear as dynamic properties:</p>
<blockquote>
<p class="code_travil"><span>&#60;div <span style="color:#943634">id</span>="myId" <span style="color:#943634">class</span>="c" <span style="color:#943634">user-defined-attribute</span>="test" <span style="color:#943634">userAttribute</span>="test"&#62; <br />&#8230; <br /><b>var</b> divOb = document.getElementById("myId");<span style="color:green"> <br />// Get the "userAttribute" and "user-defined-attribute" value <br />// (only worked in IE8 and previous versions) <br /></span><b>var</b> value1 = divOb.userAttribute; <br /><b>var</b> value2 = divOb["user-defined-attribute"];</span></p>
</blockquote>
<p>We&#8217;ve seen a lot of code that expects this legacy IE behavior. The interoperable way to retrieve unknown attributes is to use &#8220;getAttribute,&#8221;</p>
<blockquote>
<p class="code_travil"><b><span>var</span></b><span> value1 = divOb.getAttribute("userAttribute"); <br /><b>var </b>value2 = divOb.getAttribute("user-defined-attribute");</span></p>
</blockquote>
<p>and dynamic properties should not be queried through the attributes collection.</p>
<p><b>New ECMAScript 5 capabilities <br /></b></p>
<p>In the last group of capability tests, <i>new</i> functionality provided by Chakra&#8217;s implementation of ECMAScript 5 is applied to the DOM. One of the primary goals for the enhanced DOM in IE9 was to provide a representation of the DOM that made logical sense within the context of the ECMAScript 5 language semantics. This was made much easier because one of the primary goals of ECMAScript 5 is to better support the functionality needed by DOM objects! In our implementation, we represented the DOM using as many native ECMAScript 5 language features as possible, including extensive use of accessor (getter/setter) properties. </p>
<p>This native integration allows <b>all</b> of the new ECMAScript5 features to work equally well with native objects as with DOM objects. </p>
<p>The enhanced DOM capabilities demo shows only 24 samples of what is possible when the DOM is fully integrated with an ECMAScript 5-capable JavaScript engine like Chakra. We are very excited about this support in IE9 and want to help get better interoperability for ECMAScript language bindings across browsers. An important step is standardizing these binding within the W3C, and we&#8217;re happy to contribute to that effort.</p>
<p>W3C web standards have always supplied <a rel="nofollow" target="_blank" href="http://www.w3.org/TR/DOM-Level-2-Core/ecma-script-binding.html">a language binding for ECMAScript</a> implementations as a way to translate the standard IDL (Interface Definition Language) into JavaScript objects. However, these bindings lacked sufficient detail to create much more than a simple &#8220;host object&#8221; binding (a binding without consideration of the full spectrum of ECMAScript language features). While other browsers have a much more comprehensive language binding than simply &#8220;host objects,&#8221; integration inconsistencies remain. These inconsistencies can really frustrate JavaScript framework developers who wish to write abstraction layers and features on top of the basic language support. The need for consistency led to a proposed standard called <a rel="nofollow" target="_blank" href="http://www.w3.org/TR/WebIDL/">WebIDL</a> (Web Interface Definition Language). The WebIDL specification describes in much more precise detail, how to translate a given W3C spec written using WebIDL into JavaScript objects.</p>
<p>In a follow-up post, I will describe in more detail how we used WebIDL to inform and guide the development of the IE9 enhanced DOM.</p>
<p>Please testdrive the IE9 enhanced DOM. We look forward to your comments and feedback.</p>
<p>Travis Leithead <br />IE Program Manager</p>
<p><i></i><i></i></p>
<div></div>
<div style="clear:both"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=10057500" width="1" height="1">]]></description>
		<wfw:commentRss>http://psdinhtml.com/exploring-ie9s-enhanced-dom-capabilities/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
