<?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>Search News &#187; Microsoft News</title>
	<atom:link href="http://searchlogger.net/news/cat/microsoft-official/feed" rel="self" type="application/rss+xml" />
	<link>http://searchlogger.net/news</link>
	<description>Current Search News</description>
	<lastBuildDate>Fri, 10 Sep 2010 07:01:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Debugging Common Canvas Issues</title>
		<link>http://blogs.msdn.com/b/ie/archive/2010/09/08/debugging-common-canvas-issues.aspx</link>
		<comments>http://blogs.msdn.com/b/ie/archive/2010/09/08/debugging-common-canvas-issues.aspx#comments</comments>
		<pubDate>Wed, 08 Sep 2010 22:12:00 +0000</pubDate>
		<dc:creator>ieblog</dc:creator>
				<category><![CDATA[Microsoft News]]></category>

		<guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10057589</guid>
		<description><![CDATA[<p>As we’ve <a href="http://blogs.msdn.com/b/ie/archive/2010/07/01/ie9-includes-hardware-accelerated-canvas.aspx">previously discussed</a>, IE9 includes support for HTML5 canvas. You can test it out right now by downloading the latest <a href="http://ie.microsoft.com/testdrive/Default.html">platform preview</a>. In our testing of sites that use the latest web standards, we are pleased to see that many canvas sites just work in IE9. For those of you using &#60;canvas&#62; on your site, we have two tips to make sure it works properly across browsers and in IE9: use feature detection instead of browser detection, and use <span class="code">&#60;!DOCTYPE html&#62;.</span></p>  <p><b>Be sure to use feature detection instead of browser detection</b></p>  <p>If you are using browser detection, such as automatically falling back to a non-canvas implementation if you detect that the user is using an IE User Agent string, you may be blocking HTML5 content from rendering in IE9. Instead of doing browser detection, you should <a href="http://blogs.msdn.com/b/ie/archive/2010/09/03/same-markup-using-canvas-audio-and-video.aspx">do feature detection</a> to check if the user’s browser has a certain capability. For instance, you can use this code to check if your user’s browser supports canvas:</p>  <pre><code>var canvas = document.createElement(&#34;canvas&#34;);<br />if (canvas.getContext &#38;&#38; canvas.getContext(&#34;2d&#34;)) {
{<br />	<span class="comment">// Code requiring canvas support</span><br />} else {<br />	<span class="comment">// Canvas isn't available. Put non-canvas fallback here</span><br />}<br /></code></pre>

<p>This eliminates the need for you to make assumptions about current browser feature support and ensures your site will continue to work as browsers evolve. We explain more about feature detection in <a href="http://blogs.msdn.com/b/ie/archive/2010/04/14/same-markup-writing-cross-browser-code.aspx">this</a> post. </p>

<p><b>How to check if the user’s browser supports Canvas:</b></p>

<ul>
  <li><span style="color: green;font-weight: bold">DO</span>: Canvas feature detection code </li>

  <li><span style="color: red;font-weight: bold">DON’T</span>: Browser detection using User Agent string </li>

  <li><span style="color: red;font-weight: bold">DON’T</span>: Conditional comments </li>
</ul>

<p><b>Make sure your site is in IE9 mode</b></p>

<p>By default, if your site is following web standards, such as using a standards <a href="http://en.wikipedia.org/wiki/Doctype">DOCTYPE</a>, IE9 will render it in standards mode. You can check if your site is in this mode by bringing up the Developer Tools (press F12) and checking to see if your site is in IE9 standards Document Mode.</p>

<p><img alt="screenshot of the developer tools with Document Mode: &#39;IE9 standards highlighted&#39;" src="http://ieblog.members.winisp.net/images/Jatinder_DebuggingCanvas_1.png" /></p>

<p>Canvas is a new feature only supported in IE9 standards mode – a design decision we took to ensure that legacy document modes remain fully backward compatible. If you see a Document Mode for your site other than IE9 standards, HTML5 elements like canvas won’t be displayed. For example, if you don’t have a DOCTYPE in your page, IE9 will display the site in <a href="http://en.wikipedia.org/wiki/Quirks_mode">Quirks Mode</a>. To ensure your page works as expected in IE9, we recommend that you add a strict DOCTYPE to your webpages. For example, you could add the <a href="http://dev.w3.org/html5/spec/syntax.html#the-doctype">W3C HTML5 DOCTYPE</a>:</p>

<p><code>&#60;!DOCTYPE html&#62; </code></p>

<p>Or you can use a common strict DOCTYPE such as this:</p>

<p><code>&#60;!DOCTYPE HTML PUBLIC &#34;-//W3C//DTD HTML 4.01//EN&#34; &#34;http://www.w3.org/TR/html4/strict.dtd&#34;&#62; </code></p>

<p>You can read more about how IE determines the document mode <a href="http://blogs.msdn.com/b/ie/archive/2010/06/16/ie-s-compatibility-features-for-site-developers.aspx">here</a>.</p>

<p><b>Interoperability and Canvas</b></p>

<p>Interoperability is a high priority for IE9, to the point where we recommend sending IE9 the same standards-based markup your site sends to other browsers. Most canvas sites should just work on IE9 if the site was originally developed for another browser. That being said, there are a few behavior differences between browsers. For instance, consider the shadow demo from the <a href="http://ie.microsoft.com/testdrive/Graphics/CanvasPad/?c=shadows">Canvas Pad</a> test drive site.</p>

<p><img alt="a canvas rendering from IE9" src="http://ieblog.members.winisp.net/images/Jatinder_DebuggingCanvas_ie.png" /> <img alt="same canvas rendered in Chrome - gradients and shadows look different than IE9" src="http://ieblog.members.winisp.net/images/Jatinder_DebuggingCanvas_Chrome.png" /> <img alt="same canvas rendered in Firefox - similar to IE9 but certain shadows rendered differently than IE9 or Chrome" src="http://ieblog.members.winisp.net/images/Jatinder_DebuggingCanvas_FF.png" /> <img alt="same canvas rendered in Safari - shadows different yet again" src="http://ieblog.members.winisp.net/images/Jatinder_DebuggingCanvas_Safari.png" /> <img alt="same canvas rendered in Opera - also different" src="http://ieblog.members.winisp.net/images/Jatinder_DebuggingCanvas_opera.png" /></p>

<div></div>

<p>This is one example of a canvas feature that is rendered a little differently in each browser. We are making IE9 interoperable whenever possible, but for some canvas features, other browsers do not have a complete or correct implementation. In these cases, we follow the <a href="http://dev.w3.org/html5/2dcontext/#shadows">W3C spec</a>. We <a href="http://dvcs.w3.org/hg/html/file/055c55f80c18/tests/submission/Microsoft/canvas/">submit test cases to the W3C</a> as a way to help ensure everyone agrees on how the spec should be interpreted and implemented. To learn more about our shadow implementation, check out our <a href="http://samples.msdn.microsoft.com/ietestcenter/#html5Canvas">canvas tests from the IE Test Center</a>. </p>

<p>The purpose of the W3C spec is to define a standard that all browsers should follow. If we find examples where browsers uniformly behave differently from the spec, we feel that spec should be updated to reflect the interoperable behavior, if it makes sense for web developers. For instance, HTMLFrameElement did not contain the contentWindow attribute in the <a href="http://dev.w3.org/html5/spec/Overview.html#htmliframeelement">W3C spec</a>; however IE8, Firefox, and Chrome all support this attribute. We filed a <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=10116">bug</a> with a proposed change, and the HTML5 editor updated the latest revision of the spec. </p>

<p>If something looks unexpected in IE9 and you believe it is an interoperability issue or an area where we deviate from the spec, please let us know by filing a bug with <a href="https://connect.microsoft.com/">Microsoft Connect</a>. One of our goals around the platform previews and the beta of IE9 is to give our users a chance to give us as much feedback as possible, so don’t hesitate to let us know if you think you see a bug!</p>

<p>Thanks,
  <br />Elizabeth Ford and Jatinder Mann

  <br />Program Managers, Internet Explorer</p>

<p>Edit 9/9: Updated the detection code sample to be more robust.&#160; Thanks to Paul Irish for pointing out this problem.</p><div style="clear:both"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=10057589" width="1" height="1"/>]]></description>
		<wfw:commentRss>http://blogs.msdn.com/b/ie/archive/2010/09/08/debugging-common-canvas-issues.aspx/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Transitioning Existing Code to the ES5 Getter/Setter APIs</title>
		<link>http://blogs.msdn.com/b/ie/archive/2010/09/07/transitioning-existing-code-to-the-es5-getter-setter-apis.aspx</link>
		<comments>http://blogs.msdn.com/b/ie/archive/2010/09/07/transitioning-existing-code-to-the-es5-getter-setter-apis.aspx#comments</comments>
		<pubDate>Wed, 08 Sep 2010 01:03:00 +0000</pubDate>
		<dc:creator>ieblog</dc:creator>
				<category><![CDATA[Microsoft News]]></category>

		<guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10059043</guid>
		<description><![CDATA[<p>In my recent blog post, <a href="http://blogs.msdn.com/b/ie/archive/2010/08/25/chakra-interoperability-means-more-than-just-standards.aspx">Chakra: Interoperability Means More Than Just Standards</a>, I explained why IE9 only supports the ECMAScript 5 API for defining getter/setter methods. I also mentioned that it is fairly trivial to define a simple compatibility library to help transition existing code to this new API. This is part of what it means to support the same markup using <a href="http://blogs.msdn.com/b/ie/archive/2010/04/14/same-markup-writing-cross-browser-code.aspx">feature detection</a>, <a href="http://blogs.msdn.com/b/ie/archive/2010/06/10/same-markup-explaining-quot-jscript-version-quot-and-styling-new-html5-elements.aspx">not browser detection</a>, so you get the same results in different browsers. In this post I&#8216;ll show you the code for such a library.</p>
<p>Using the non-standardized legacy getter/setter API supported by some browsers you normally define a getter/setter property in a manner such as this:</p>
<pre><code>myObject.__defineGetter__("p", function() {<span class="comment">/* getter function body */</span>});<br />myObject.__defineSetter__("p", function(v) {<span class="comment">/* setter function body */</span>});<br /></code></pre>
<p>Using the standard ES5 API, the equivalent definitions look like this:</p>
<pre><code>Object.defineProperty(myObject,"p",<br />   {get: function() {<span class="comment">/* getter function body */</span>}}<br />);<br />Object.defineProperty(myObject,"p",<br />   {set: function(v) {<span class="comment">/* setter function body */</span>}}<br />);<br /></code></pre>
<p>As you can see, each <span class="code">__defineGetter__</span> or <span class="code">__defineSetter__</span> method call is mapped to an equivalent call to the ES5 <span class="code">Object.defineProperty</span> function. If you have existing code that contains many such calls that you need to work in IE9 or any other ES5 complaint browser, you can avoid a lot of editing and automate this mapping process. You can do this by creating definitions of <span class="code">__defineGetter__</span> and <span class="code">__defineSetter__</span> that use <span class="code">defineProperty</span> to create the getter/setter properties and include these definitions in your code. Here is what you need:</p>
<pre><code><span class="comment">//emulate legacy getter/setter API using ES5 APIs</span><br />try {<br />   if (!Object.prototype.__defineGetter__ &#38;&#38;<br />        Object.defineProperty({},"x",{get: function(){return true}}).x) {<br />      Object.defineProperty(Object.prototype, "__defineGetter__",<br />         {enumerable: false, configurable: true,<br />          value: function(name,func)<br />             {Object.defineProperty(this,name,<br />                 {get:func,enumerable: true,configurable: true});<br />      }});<br />      Object.defineProperty(Object.prototype, "__defineSetter__",<br />         {enumerable: false, configurable: true,<br />          value: function(name,func)<br />             {Object.defineProperty(this,name,<br />                 {set:func,enumerable: true,configurable: true});<br />      }});<br />   }<br />} catch(defPropException) {<span class="comment">/*Do nothing if an exception occurs*/</span>};<br /></code></pre>
<p>The <span class="code">if</span> statement does <i>feature detection</i> to determine if the compatibility definitions are necessary. There are two parts to this determination. First it checks whether <span class="code">__defineGetter__</span> is already available. If it isn&#8217;t, it then checks that <span class="code">defineProperty</span> is available and that it supports creating getter properties. It does this by trying to use <span class="code">defineProperty</span> to actually define a getter property named x for a new object and then trying to access that property. If <span class="code">defineProperty</span> isn&#8217;t available the attempt to call it will raise an exception which is caught by the <span class="code">try-catch</span> statement that surrounds the <span class="code">if</span> statement. If <span class="code">defineProperty</span> is available but it does support the creation of getter/setter properties on normal objects the call will either throw an exception or the access to the value of x will return undefined, which is a <span class="code">false</span> value. This testing of both the existence and operation of <span class="code">defineProperty</span> is necessary because IE8 includes <span class="code">defineProperty</span> but only supports its use with DOM objects. This is an example of a situation that illustrates that browser feature detection sometimes needs to carefully probe for the desired functionality. Simple checking for the existence of an object or method is not always sufficient.</p>
<p>If these conditions are met then it is possible to emulate the legacy API. The two calls to <span class="code">defineProperty</span> in the body of the <span class="code">if</span> define the actual legacy API methods. The bodies of these methods, when called also use <span class="code">defineProperty</span> to create getter or setter properties.</p>
<p>This code should be inserted at the beginning of an application before any calls to <span class="code">__defineGetter__</span> or <span class="code">__defineSetter__</span> are made. In practice, you may want to insert this code into a separate script file that you load before any other code.</p>
<p>With this compatibility code included, your application that uses <span class="code">__defineGetter__</span> or <span class="code">__defineSetter__</span> should work on any browser that supports getter/setter properties. If a browser only supports the new ES5 API, the compatibility methods are automatically defined and used. If a browser only supports the legacy API or if it supports both the legacy and ES5 APIs the compatibility methods are not necessary, and the built-in versions of <span class="code">__defineGetter__</span> or <span class="code">__defineSetter__</span> are used.</p>
<p>What if you are writing new code that needs to define getter/setter properties? You probably will want that code to run in both new ES5-based browsers and in older browsers that only support the legacy API? You could use this same compatibility package and use the legacy API to define the getter/setter properties. However, it is more forward compatible to write new code using the standard ES5 APIs. You can do this by creating a different compatibility package that uses the legacy API to emulate the ES5 API. Here is the code:</p>
<pre><code><span class="comment">//emulate ES5 getter/setter API using legacy APIs</span><br />if (Object.prototype.__defineGetter__&#38;&#38;!Object.defineProperty) {<br />   Object.defineProperty=function(obj,prop,desc) {<br />      if ("get" in desc) obj.__defineGetter__(prop,desc.get);<br />      if ("set" in desc) obj.__defineSetter__(prop,desc.set);<br />   }<br />}<br /></code></pre>
<p>The <span class="code">if</span> statement is again a feature detection check. This time it makes sure that the old API is present and that the ES5 API is missing. If this is the case, it defines the <span class="code">Object.defineProperty</span> function to detect any uses that are trying to define either a getter or a setter or both and then uses the legacy API to actually define them. Note that this is only a partial implementation of the <span class="code">defineProperty</span> functionality. ES5&#8217;s <span class="code">defineProperty</span> function can be used to perform other forms of property definition or redefinition in addition to defining getter/setter properties. Many of these new capabilities cannot be easily emulated using common legacy APIs so this compatibility version of the function does not attempt to do so. It just supports getter/setter property definitions.</p>
<p>We all want more capable browsers that enable more compelling web sites. Sometimes new browser functionality introduces dilemmas for web developers who want the same markup to produce the same results across browsers. Developers may ask; do you use the new functionality with the result that your application will not work on older browsers, or do you simply ignore the new functionality? Simple compatibility packages like the ones described here are a pragmatic way to deal with these situations and get the best of both worlds.</p>
<p>Allen Wirfs-Brock</p>
<p>Microsoft JavaScript Language Architect </p>
<p>Edit 9/7 - fixed type in third paragraph</p><div style="clear:both"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=10059043" width="1" height="1"/>]]></description>
		<wfw:commentRss>http://blogs.msdn.com/b/ie/archive/2010/09/07/transitioning-existing-code-to-the-es5-getter-setter-apis.aspx/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Same Markup: Using , , and</title>
		<link>http://blogs.msdn.com/b/ie/archive/2010/09/03/same-markup-using-canvas-audio-and-video.aspx</link>
		<comments>http://blogs.msdn.com/b/ie/archive/2010/09/03/same-markup-using-canvas-audio-and-video.aspx#comments</comments>
		<pubDate>Sat, 04 Sep 2010 02:07:00 +0000</pubDate>
		<dc:creator>ieblog</dc:creator>
				<category><![CDATA[Microsoft News]]></category>

		<guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10057962</guid>
		<description><![CDATA[<p>On this blog we’ve repeatedly discussed enabling the &#34;Same Markup&#34; for Internet Explorer 9. Part of making &#34;Same Markup&#34; a reality involves supporting the right features in IE9 to make the same HTML, JavaScript, and CSS &#34;just work&#34; the same way they do in other browsers. Part of how IE9 contributes to enabling the &#34;Same Markup&#34; 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 href="http://blogs.msdn.com/b/ie/archive/2010/04/14/same-markup-writing-cross-browser-code.aspx">my first post on &#34;Same Markup&#34;</a>, I described the effort as an &#34;n-way street&#34;. 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(&#34;This always runs, even when canvas is supported.&#34;);
	&#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=&#34;<span class="pseudo">myaudio</span>&#34;&#62;
	&#60;object type=&#34;<span class="pseudo">audio-plugin-mime-type</span>&#34; data=&#34;<span class="pseudo">myaudio</span>&#34;&#62;
		&#60;a href=&#34;<span class="pseudo">myaudio</span>&#34;&#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=&#34;<span class="pseudo">myvideo</span>&#34;&#62;
	&#60;object type=&#34;<span class="pseudo">video-plugin-mime-type</span>&#34; data=&#34;<span class="pseudo">myvideo</span>&#34;&#62;
		&#60;a href=&#34;<span class="pseudo">myvideo</span>&#34;&#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(&#34;audio&#34;).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(&#34;video&#34;).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. In order to avoid false positives in a couple of mobile browsers, an additional check confirming that a context can actually be retrieved is needed as well (thanks to Paul Irish for pointing this out).</p>

<pre><code><span class="comment">// <strong>Example 12:</strong> Alternate feature detection for &#60;canvas&#62;</span>
var canvas = document.createElement(&#34;canvas&#34;);
if(canvas.getContext &#38;&#38; canvas.getContext(&#34;2d&#34;)) {
	<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<br />

Edit 9/9 – Edited Example 12 based on feedback from Paul Irish.</p><div style="clear:both"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=10057962" width="1" height="1"/>]]></description>
		<wfw:commentRss>http://blogs.msdn.com/b/ie/archive/2010/09/03/same-markup-using-canvas-audio-and-video.aspx/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add-ons, Installation Experiences, and User Consent</title>
		<link>http://blogs.msdn.com/b/ie/archive/2010/09/03/add-ons-installation-experiences-and-user-consent.aspx</link>
		<comments>http://blogs.msdn.com/b/ie/archive/2010/09/03/add-ons-installation-experiences-and-user-consent.aspx#comments</comments>
		<pubDate>Sat, 04 Sep 2010 00:10:00 +0000</pubDate>
		<dc:creator>ieblog</dc:creator>
				<category><![CDATA[Microsoft 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 href="http://blog.mozilla.com/addons/2010/06/14/improve-extension-startup-performance/">performance</a>. IE measures <a 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 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" alt="Accelerator installation consent dialog from IE8" /></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 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" alt="Firefox add-on installation consent dialog" /></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 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 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://blogs.msdn.com/b/ie/archive/2010/09/03/add-ons-installation-experiences-and-user-consent.aspx/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exploring IE9&#8217;s Enhanced DOM Capabilities</title>
		<link>http://blogs.msdn.com/b/ie/archive/2010/09/02/dup-exploring-ie9-s-enhanced-dom-capabilities.aspx</link>
		<comments>http://blogs.msdn.com/b/ie/archive/2010/09/02/dup-exploring-ie9-s-enhanced-dom-capabilities.aspx#comments</comments>
		<pubDate>Thu, 02 Sep 2010 22:25:00 +0000</pubDate>
		<dc:creator>ieblog</dc:creator>
				<category><![CDATA[Microsoft 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 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 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 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><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 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 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 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://blogs.msdn.com/b/ie/archive/2010/09/02/dup-exploring-ie9-s-enhanced-dom-capabilities.aspx/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add-on Performance part 2: Helping consumers make informed decisions</title>
		<link>http://blogs.msdn.com/b/ie/archive/2010/08/31/add-on-performance-part-2-helping-consumers-make-informed-decisions.aspx</link>
		<comments>http://blogs.msdn.com/b/ie/archive/2010/08/31/add-on-performance-part-2-helping-consumers-make-informed-decisions.aspx#comments</comments>
		<pubDate>Wed, 01 Sep 2010 01:27:00 +0000</pubDate>
		<dc:creator>ieblog</dc:creator>
				<category><![CDATA[Microsoft News]]></category>

		<guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10056620</guid>
		<description><![CDATA[<p>The <a href="http://www.ietestdrive.com/">platform previews</a> show the focus in IE9 on performance, interoperable HTML5 through same markup, and hardware acceleration. We&#8217;ve also posted here about the work we&#8217;ve done with <a href="http://blogs.msdn.com/b/ie/archive/2010/08/11/add-on-guidelines-and-requirements-in-action-upgrade-advisor.aspx">add-on developers</a>, and we shared some <a href="http://blogs.msdn.com/b/ie/archive/2010/08/03/add-on-performance-part-1-measuring-add-on-performance.aspx">data about add-on performance</a> and how we measure it. </p>
<p>In this post, we cover more of our thinking about measuring add-on performance and how to help consumers to stay in control of their browsing experience.</p>
<h3>Add-on Performance and Site Performance </h3>
<p>We&#8217;ve written about the <a href="http://blogs.msdn.com/b/ie/archive/2010/07/06/a-gpu-powered-shopping-experience-with-amazon-com.aspx">different</a> <a href="http://blogs.msdn.com/b/ie/archive/2010/07/14/caching-improvements-in-internet-explorer-9.aspx">dimensions</a> of <a href="http://blogs.msdn.com/b/ie/archive/2010/08/18/microsoft-to-co-chair-new-w3c-web-performance-working-group.aspx">performance</a> in the web platform. We have also talked about the <a href="http://blogs.msdn.com/b/ie/archive/2010/08/03/add-on-performance-part-1-measuring-add-on-performance.aspx">role add-ons play</a> in overall browser performance. Site developers want a reliable, fast platform to run their web sites. Consumers (site visitors) want a reliable, fast experience of those sites. The perception of site speed includes the user&#8217;s experience of the site, the browser, and the installed add-ons. </p>
<p>As discussed in <a href="http://blogs.msdn.com/b/ie/archive/2010/08/03/add-on-performance-part-1-measuring-add-on-performance.aspx">Add-on Performance part 1</a>, add-ons can have a material impact on site performance and the consumer experience. Our goal with IE is that users have everything they <a href="http://blogs.msdn.com/b/ie/archive/2009/07/18/how-to-make-ie-open-new-tabs-faster.aspx">need to make informed decisions</a> and <a href="http://blogs.msdn.com/b/ie/archive/2009/09/09/guidelines-for-add-on-developers.aspx">remain in control</a> of their browsing experience. </p>
<h3>Measuring performance to inform decisions</h3>
<p>It is important that people stay in control of their browsing experience. This includes many aspects of using the browser including downloads, <a href="http://blogs.msdn.com/b/ie/archive/2010/08/01/online-privacy-tracking-and-ie8-s-inprivate-filtering.aspx">privacy</a>, security, and controlling which add-ons to use. The ideal experience allows people to have exactly the add-ons they want &#8211; no more no less. </p>
<p>For users, there is a basic cost to benefit decision to make with add-ons. To make an informed decision, the user needs to have a clear view on the costs of the add-on as well as the apparent benefits. Most people understand the benefit they get from using an add-on they choose to install. It is more difficult to understand the full cost that add-ons bring to your browsing experience in terms of performance, responsiveness, and reliability. </p>
<p>When we introduced <a href="http://blogs.msdn.com/b/ie/archive/2009/03/03/create-a-dynamic-web-slice-in-5-minutes.aspx">Web Slices</a>, <a href="http://blogs.msdn.com/b/ie/archive/2009/03/27/accelerator-spotlight.aspx">Accelerators</a> and updates <a href="http://blogs.msdn.com/b/ie/archive/2010/02/17/search-providers-best-practices-on-setting-the-default.aspx">to search providers</a> in IE8 we started a pattern of making sure that people are in control of the add-on capabilities in their browser. These types of declarative add-ons do not have performance or reliability costs to the browsing experience. The main impact they have is taking up space in the favorites bar or right click menu. Sites can promote web slices or add-ons, and the user is in control to decide whether to add them or not. This is an important part of the add-on experience even for <a href="http://blogs.msdn.com/b/ieinternals/archive/2009/08/21/agcore-addon-hangs-internet-explorer.aspx">savvy users</a>; namely that people must <i>consent</i> to have the add-on.</p>
<p>For the types of add-ons that do have a potential performance and reliability cost (toolbars and BHOs), the user needs additional information. IE8 users can see the <a href="http://blogs.msdn.com/b/ie/archive/2009/07/18/how-to-make-ie-open-new-tabs-faster.aspx">load time for add-ons in the Manage add-ons</a> dialog. This is a good start, but there is more IE can do to help people fully understand the impact an add-on has on browsing performance. </p>
<p>Ideally IE would measure both load time and the additional time it takes to navigate to sites (navigation time). Measuring this time for every navigation, including the first time the add-on runs, is crucial because it represents how long the user actually had to wait to load IE and navigate to their favorite sites on their PC. </p>
<p>An important part of informing users is providing a threshold to understand the impact of add-ons have on performance. No matter what hardware you&#8217;re running on - from low end netbooks which throttle the CPU for long battery life or high end gaming desktops &#8211; human perception thresholds don&#8217;t change. <a href="http://hcibib.org/sam/1.html">Several</a> <a href="http://www.useit.com/alertbox/response-times.html">studies</a> regarding website response time report that users notice any delay over 0.2 seconds. Actions that are faster than 0.2 seconds appear instantaneous.&#160; Scenarios with response times slower than that threshold can feel &#8220;slow&#8221; to users. Of course, the individual person should be free to choose a different threshold that matches their particular browsing needs. </p>
<p>When considering the performance of add-ons, it is useful to do so in relationship to this threshold. People think about the speed of actions in the browser, like opening a new site, rather than the speed of individual add-ons, so what matters to the user is the total amount of time taken by add-ons. From the user&#8217;s point of view, they don&#8217;t care if it&#8217;s one add-on taking 2 seconds or 10 add-ons each taking 0.2 seconds. Informing users means providing the visibility on everything that is contributing to the performance they experience, with enough detail that the user stays in control. With this information people can make decisions about individual add-ons in the context of all the other add-ons that they&#8217;re running.</p>
<h3>A personal decision</h3>
<p><a href="http://blogs.msdn.com/b/ie/archive/2010/08/03/add-on-performance-part-1-measuring-add-on-performance.aspx">In part 1</a> of this series we shared statistical data about add-on performance which is compiled from people who opt into sending <a href="http://www.microsoft.com/products/ceip/EN-US/default.mspx">telemetry</a>. Because this data is anonymous it&#8217;s useful for spotting broad trends and working with add-on partners but it&#8217;s not useful for helping a specific person in their environment. What matters to a person is what happens on his or her own machine. So, they need data that&#8217;s specifically about their add-ons on their machine with their browsing habits; purely local data. This enables them to make the most informed decision about the add-ons they use and to stay in control over their browsing experience</p>
<p>With this information, the user can make an informed choice. They understand the value of the add-on features and the performance implications. People may decide that an add-on is so valuable that they&#8217;re willing to wait a &#188; second or even a &#189; second during their browsing. People may also decide that they don&#8217;t utilize the features of a particular add-on frequently so they disable it until they want it. Consistent with other browsers, IE makes re-enabling add-ons easy through the Manage add-ons dialog. The most popular entry point is in the right-click menu of the command bar but it can also be accessed from the tools menu, the right click menu for a page (under accelerators), the search box dropdown menu (under search providers), windows control panel and of course from the options dialog. Microsoft doesn&#8217;t share information with developers about individual users disabling or enabling add-ons in keeping with our privacy policy. Using add-ons is a personal choice, so IE never automatically enables or disables an add-on &#8211; the user is in control and they choose which to enable and which to disable. IE gives people the information they need to make an informed decision.</p>
<h3>More details for add-on developers</h3>
<p>For background, we&#8217;ve talked about <a href="http://blogs.msdn.com/b/ie/archive/2010/06/21/measuring-browser-performance-with-the-windows-performance-tools.aspx">using windows tools</a> to measure load and navigation <a href="http://blogs.msdn.com/b/ie/archive/2010/08/03/add-on-performance-part-1-measuring-add-on-performance.aspx">performance of add-ons</a>. Here&#8217;s more detail about the load and navigation measurements so add-on developers can test the performance of their products or do something more like build capabilities into their products to detect when browsing is slowed and tune the add-on experience appropriately.</p>
<p><b>Add-on Load time (Load Time)</b></p>
<p>IE8 measures load time when a new tab is created and IE initializes all enabled add-ons (and IE9 will do this too). IE calls CoCreateInstance(), ShowDW() and SetSite() for each add-on. In IE8, an add-on&#8217;s load time is the total time it takes to return from the CoCreateInstance() and SetSite() calls. In the future, we&#8217;ll also measure the ShowDW() function call.</p>
<p><b>Webpage Navigation (Navigation Time) </b></p>
<p>Earlier in this post, we talked about the importance of measuring navigation time. Here&#8217;s how we do it on the IE team and how we recommend add-on developers do it. An add-on&#8217;s navigation time is the time it takes to handle the following three DWebBrowser2 events while navigating to a webpage:</p>
<ul>
<li>BeforeNavigate </li>
<li>NavigateComplete </li>
<li>DocumentComplete </li>
</ul>
<p>We start measuring a navigation time for all enabled add-ons once IE fires a top-level BeforeNavigate event. </p>
<p>Sites may cause several navigation events to fire as they download images or content in frames. So, we keep an open tally of the time the add-ons take for each event on that page until the user<b>:</b></p>
<ul>
<li>Navigates (another top-level BeforeNavigate) </li>
<li>Cancels the navigation </li>
<li>Closes the tab </li>
<li>Closes IE </li>
</ul>
<p>Once that occurs, we append the navigation time data point for each of the add-ons to the list. </p>
<p>When showing the load or navigation time data to users, we average up to the last 10 data points. We don&#8217;t measure the performance of disabled add-ons since they aren&#8217;t running or taking any time to load or navigate. Instead we show the latest data we have in parenthesis to inform the enable decision for people.</p>
<p>In everything we do including add-on performance measurement, IE treats all add-ons from all developers the same. Only the user makes decisions to enable or disable add-ons.</p>
<p>Thanks, <br />Herman Ng</p>
<p>Edit on 8/31 - replaced ExtensionShowDW with ShowDW() and refer to it as a function call rather than an event in 'Add-on Load time (Load Time)' paragraph.&#160; Also removed extra period.</p><div style="clear:both"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=10056620" width="1" height="1"/>]]></description>
		<wfw:commentRss>http://blogs.msdn.com/b/ie/archive/2010/08/31/add-on-performance-part-2-helping-consumers-make-informed-decisions.aspx/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Ready for SVG Open</title>
		<link>http://blogs.msdn.com/b/ie/archive/2010/08/31/getting-ready-for-svg-open.aspx</link>
		<comments>http://blogs.msdn.com/b/ie/archive/2010/08/31/getting-ready-for-svg-open.aspx#comments</comments>
		<pubDate>Tue, 31 Aug 2010 15:34:00 +0000</pubDate>
		<dc:creator>ieblog</dc:creator>
				<category><![CDATA[Microsoft News]]></category>

		<guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10056018</guid>
		<description><![CDATA[<div>   <p>I recently <a href="http://channel9.msdn.com/posts/LarryLarsen/Internet-Explorer-9-Platform-Preview-4-A-Look-at-SVG-in-IE9/">demonstrated Test Driving Modern SVG</a> using the SVG Dice sample currently on the <a href="http://ie.microsoft.com/testdrive/Default.html">Internet Explorer 9 Test Drive site</a>. While building this sample, I learned that both performance and interoperability for SVG are a subtle continuum and are <i>not</i> binary. This point resonated with me so much that I modified my presentation for this week’s <a href="http://www.svgopen.org">SVG Open Conference</a> entitled “<a href="http://www.svgopen.org/2010/registration.php?section=abstracts_and_proceedings#paper_70">The Future of SVG and HTML5</a>” to include methods by which the SVG developer community can rally around to make SVG more interoperable.</p>    <h4>Testing SVG vs. Test Driving SVG</h4>    <p>SVG has its roots in a document format. The most popular use case today is the static document format. Complex engineering diagrams and other illustrations are well suited for SVG given their requirements for scalability, high fidelity printing, and portability. </p>    <p>With HTML5, the future of SVG is about the next generation of the interactive graphic web which exercises SVG in new ways. As a community, we need to think about how we test the SVG specification differently.</p> </div>  <h5>Testing SVG</h5>  <p>The W3C SVG Test Suites attempt to “test” the ability to implement the spec, but as we learned in the working group, this is not enough to guarantee an interoperable set where a developer can use the same markup that works across all browsers. The SVG Test Suite is not intended to test conformance, but rather whether or not the spec can be implemented. From the <a href="http://www.w3.org/Graphics/SVG/WG/wiki/Test_Suite_Overview">W3C SVG Test Wiki:</a></p>  <blockquote>   <p>“Our test suites are necessary, but not sufficient, to test conformance… Thus, representations of tested support is skewed toward the more complex features of SVG, and is not an accurate view of overall SVG support”</p> </blockquote>  <p>In other words, the existing test suite doesn’t test whether a browser conforms to the spec. To this end, we are working closely with the SVG Working Group to help round out these tests; in fact, there is an external effort to create an <a href="http://svgtorture.googlecode.com/svn/trunk/automated/test.html">SVG DOM 1.1 conformance test</a> by the SVG Interest Group. At the time of writing, IE9 passes 100% of these automated tests. In concert with the SVG Working Group, we are helping to resolve these interoperability issues by continuing to enhance the SVG Test Suite through regular contributions.</p>  <p>Additionally, there exists an imbalance between the number of requirements in the modules in the SVG Specification, and the number of tests in the SVG Test Suite that represent those requirements. The Internet Explorer team helps to address this imbalance through test asset contributions. But this is not enough. We have contributed <a href="http://samples.msdn.microsoft.com/ietestcenter/#svg11e2">56 tests</a> and expect to continue to deliver more over time.</p>  <h5>Test Driving SVG</h5>  <p>The better measure of conformance and more importantly interoperability was do develop more complex SVG for the web. My own experience in test driving SVG by developing the <a href="http://ie.microsoft.com/testdrive/Performance/SVGDice/Default.xhtml">SVG Dice</a> demo illustrates some of the places where we have more work to do as a community on interoperability of SVG.</p>   <div style="width:500px;height:290px">  <img src="http://ecn.channel9.msdn.com/o9/ch9/4185/564185/IE9201003_512_ch9.png" style="margin-top:0;padding-top:0" />         <a href="http://go.microsoft.com/fwlink/?LinkID=124807"> <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" /> </a>    &#60;!-- Script to detect lack of codec support and force fallback to contained  --&#62;
                    
		var vid = document.getElementById("myvid");
		if(vid &#38;&#38; vid.canPlayType &#38;&#38; !vid.canPlayType("video/mp4").match(/^(probably&#124;maybe)$/i)) {
			vid.parentNode.insertBefore(vid.firstElementChild, vid);
			vid.style.display = "none";
	document.getElementById("image2").style.display="none";
	document.getElementById("div2").style.height="377px";
		}
	/*script to hide the play image if in IE8 */
		if (vid &#38;&#38; vid.canPlayType==null) {
			document.getElementById("image2").style.display="none";
			document.getElementById("div2").style.height="377px";
		}
	  </div>  <p>The SVG specification contains over 2000 individual requirements. This is a large number in comparison to other web specifications and means that there is plenty of room for different interpretations. We strive in the SVG W3C Working Group to identify these differences. When I developed the SVG demo with the requirement that it works across browsers, my eyes were opened to some of the difficulties web developers face. </p>  <p>Most of the interoperability issues stem from a combination of the large number of requirements, the dependencies on other specifications, and the lack of significant content on the web to ensure the features are interpreted the same by both developer and browser vendors alike. SVG is relatively new ground for web developers and whereas HTML and CSS have enjoyed decades of refinement by a large scale of users, SVG has not yet had the same level of use and scrutiny. </p>  <p>Now that SVG is a part of HTML5, we expect to see traditional web developers learning new and better ways to improve experiences for their users using vector graphics. At the last <a href="http://blogs.msdn.com/b/ie/archive/2010/06/08/getting-to-svg-2-0-a-report-from-the-svg-working-group-face-to-face-may-24th-june-1st-2010.aspx">SVG Face to Face meeting</a>, the SVG Working Group <a href="http://www.w3.org/Graphics/SVG/WG/wiki/User_talk:Pdengler">assembled scenarios for SVG</a> that provide for more targeted use cases for the next generation, graphical web. SVG plays an integral role here.</p>  <h4>Comparing Implementations</h4>  <p>I wrote the SVG Dice demo from my own understanding of the specification using Internet Explorer 9 and subsequently tested it in other browsers. In most cases where I ran into conflicting behavior, at least two browsers still agreed. Sometimes Internet Explorer’s behavior matched Chrome or Safari, and other times it matched Firefox or Opera. Because Internet Explorer is the most recent implementation, it benefits from an SVG Specification that is in <a href="http://www.w3.org/TR/SVG11/">last call</a> where at least some of the ambiguities and conflicts have been resolved in the specification. Clearly there are more.</p>  <p>Something that caught me off guard was the impact of performance on my development effort. </p> <!-- Declarative Video tag -->    <a href="http://go.microsoft.com/fwlink/?LinkID=124807"> <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" /> </a> &#60;!-- Script to detect lack of codec support and force fallback to contained  --&#62;
		var vid = document.getElementById("myvid2");
		if(vid &#38;&#38; vid.canPlayType &#38;&#38; !vid.canPlayType("video/mp4").match(/^(probably&#124;maybe)$/i)) {
			vid.parentNode.insertBefore(vid.firstElementChild, vid);
			vid.style.display = "none";
		}
	  <p>From a developer’s perspective, I wanted to use the same graphic features like opacity, gradients, and masks in all browsers, in order to provide a consistent interoperable user experience, but I couldn’t do that because of performance concerns. Fully hardware accelerated graphics on Windows helps to move these graphic intensive computations to the GPU. I added the “Low Fidelity” mode to enable users to experience this demo in browsers that don’t make full use of the GPU. One nice side effect is that this also demonstrates CSS styling of SVG. </p>  <h5>The Surprising “Switching Event”</h5>  <p>Debugging the differences between browsers caused a very interesting “switching event” for me as a developer. There were a few outstanding bugs in the IE9 debugging tools (now fixed) which prevented me from placing breakpoints in code when working with SVG, so I used the popular Firebug add-on for Firefox. However, running the demo on Firefox was too slow, so I reverted back to Internet Explorer 9 to debug.</p>  <p>I eventually found work-arounds for most of the incompatibilities without having to write browser specific code, but it required far more effort than expected or considered reasonable.&#160; We have more work to do here as a community in building the promise of same markup for SVG.</p>  <h4>The Code</h4>  <p>Because SVG is an older spec but new to a lot of developers, I thought I would review some of the code and concepts in this demo up close.</p>  <h5>The Document Structure</h5>  <p>As a first example, most browsers do not yet support SVG in HTML5.&#160; I had to structure the document as XHTML with inline SVG. </p>  <div>   <pre><span style="color: #0000ff">&#60;!</span><span style="color: #800000">DOCTYPE</span> <span style="color: #ff0000">html</span><span style="color: #0000ff">&#62;</span><br /><span style="color: #0000ff">&#60;</span><span style="color: #800000">html</span> <span style="color: #ff0000">id</span><span style="color: #0000ff">=&#34;demohtml&#34;</span> <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">=&#34;http://www.w3.org/1999/xhtml&#34;</span> <span style="color: #ff0000">class</span><span style="color: #0000ff">=&#34;testdrive&#34;</span><span style="color: #0000ff">&#62;</span><br />  <span style="color: #0000ff">&#60;</span><span style="color: #800000">head</span><span style="color: #0000ff">&#62;</span><br />    <span style="color: #0000ff">&#60;</span><span style="color: #800000">title</span><span style="color: #0000ff">&#62;</span><br />      SVG Dice<br />    <span style="color: #0000ff">&#60;/</span><span style="color: #800000">title</span><span style="color: #0000ff">&#62;</span><br />  <span style="color: #0000ff">&#60;/</span><span style="color: #800000">head</span><span style="color: #0000ff">&#62;</span><br />  <span style="color: #0000ff">&#60;</span><span style="color: #800000">body</span> <span style="color: #ff0000">id</span><span style="color: #0000ff">=&#34;demobody&#34;</span> <span style="color: #ff0000">onload</span><span style="color: #0000ff">=&#34;Setup()&#34;</span><span style="color: #0000ff">&#62;</span><br />    <span style="color: #0000ff">&#60;</span><span style="color: #800000">audio</span> <span style="color: #ff0000">id</span><span style="color: #0000ff">=&#34;sndRemove&#34;</span> <span style="color: #ff0000">volume</span><span style="color: #0000ff">=&#34;1&#34;</span> <span style="color: #ff0000">src</span><span style="color: #0000ff">=&#34;assets/remove.mp3&#34;</span> <span style="color: #ff0000">preload</span><span style="color: #0000ff">=&#34;true&#34;</span>  <span style="color: #0000ff">&#62;&#60;/</span><span style="color: #800000">audio</span><span style="color: #0000ff">&#62;</span><br />    <span style="color: #0000ff">&#60;</span><span style="color: #800000">svg</span>  <span style="color: #ff0000">overflow</span><span style="color: #0000ff">=&#34;visible&#34;</span> <span style="color: #ff0000">id</span><span style="color: #0000ff">=&#34;theSVG&#34;</span> <span style="color: #ff0000">xmlns</span>=<span style="color: #ff0000">http:</span>//<span style="color: #ff0000">www</span>.<span style="color: #ff0000">w3</span>.<span style="color: #ff0000">org</span>/<span style="color: #ff0000">2000</span>/<span style="color: #ff0000">svg</span><br />         <span style="color: #ff0000">xmlns:xlink</span><span style="color: #0000ff">=&#34;http://www.w3.org/1999/xlink&#34;</span> <span style="color: #ff0000">width</span><span style="color: #0000ff">=&#34;100%&#34;</span> <span style="color: #ff0000">height</span><span style="color: #0000ff">=&#34;100%&#34;</span> <span style="color: #0000ff">&#62;</span><br />    <span style="color: #0000ff">&#60;/</span><span style="color: #800000">svg</span><span style="color: #0000ff">&#62;</span><br />  <span style="color: #0000ff">&#60;/</span><span style="color: #800000">body</span><span style="color: #0000ff">&#62;</span><br /><span style="color: #0000ff">&#60;/</span><span style="color: #800000">html</span><span style="color: #0000ff">&#62;</span><br />    <br /></pre>

  <br /></div>

<p>The above simple <code>&#60;!DOCTYPE html&#62;</code> sets Internet Explorer 9 to run in “standards mode” where SVG is supported. Notice that the SVG is embedded directly into the HTML. Both the css and the script are linked in via the HTML elements as expected.</p>

<div>
  <pre><span style="color: #0000ff">&#60;</span><span style="color: #800000">script</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&#34;text/javascript&#34;</span> <span style="color: #ff0000">src</span><span style="color: #0000ff">=&#34;demo.js&#34;</span><span style="color: #0000ff">&#62;&#60;/</span><span style="color: #800000">script</span><span style="color: #0000ff">&#62;</span><br /><span style="color: #0000ff">&#60;</span><span style="color: #800000">link</span> <span style="color: #ff0000">rel</span><span style="color: #0000ff">=&#34;Stylesheet&#34;</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&#34;text/css&#34;</span> <span style="color: #ff0000">href</span><span style="color: #0000ff">=&#34;demo.css&#34;</span> <span style="color: #0000ff">/&#62;</span><br /></pre>

  <br /></div>

<p>At this point I have my basic html and svg document, stylesheet, script file structures. Next I need to build the graphical elements, provide the styles and write the script necessary for the animations and user experience.</p>

<h5>Adding the Content </h5>

<p>One of the great benefits and unique nature of the web development community is what we called the “copy/paste” use case. Any developer can readily <a href="http://commons.wikimedia.org/w/index.php?title=Special%3ASearch&#38;search=public+domain+SVG">search Wikimedia</a> for public domain SVG art and use these directly in their applications or on their sites. Other popular tools exist for generating new or modifying existing content, from the open source <a href="http://www.inkscape.org/">Inkscape</a> which focuses specifically on SVG, to other graphic tools from Microsoft and Adobe which export to SVG. I used existing open source clip art for the dice and for the boat.</p>

<p>Initially I had kept these SVG sources in different files for the purpose of separation. Unfortunately, I ran into several different issues across browsers from sizing to SVG Images support, which forced me to include all of the SVG in the one HTML file. </p>

<p>SVG contains the concept of &#60;defs&#62;, which is used to define an element(s) with styles and attributes, that can be re &#60;use&#62;d later. These two concepts are very powerful. They allow me to create many different sized dice for use as the image on the cup, those that fall into the cup, or those that roll across the screen during game play. I organized the &#60;defs&#62; from the various files at the top document immediately after the SVG tag.</p>

<div>
  <pre><span style="color: #0000ff">&#60;</span><span style="color: #800000">defs</span><span style="color: #0000ff">&#62;</span><br />    <span style="color: #008000">&#60;!-- for left die --&#62;</span><br />    <span style="color: #0000ff">&#60;</span><span style="color: #800000">linearGradient</span> <span style="color: #ff0000">id</span><span style="color: #0000ff">=&#34;<span style="background-color: yellow">grad21</span>&#34;</span> <span style="color: #ff0000">x1</span><span style="color: #0000ff">=&#34;.445&#34;</span> <span style="color: #ff0000">x2</span><span style="color: #0000ff">=&#34;.554&#34;</span> <span style="color: #ff0000">y1</span><span style="color: #0000ff">=&#34;.442&#34;</span> <span style="color: #ff0000">y2</span><span style="color: #0000ff">=&#34;.555&#34;</span><span style="color: #0000ff">&#62;</span><br />        <span style="color: #0000ff">&#60;</span><span style="color: #800000">stop</span> <span style="color: #ff0000">stop-opacity</span><span style="color: #0000ff">=&#34;.9&#34;</span> <span style="color: #ff0000">offset</span><span style="color: #0000ff">=&#34;0&#34;</span> <span style="color: #ff0000">stop-color</span><span style="color: #0000ff">=&#34;#470808&#34;</span><span style="color: #0000ff">/&#62;</span><br />        <span style="color: #0000ff">&#60;</span><span style="color: #800000">stop</span> <span style="color: #ff0000">stop-opacity</span><span style="color: #0000ff">=&#34;.9&#34;</span> <span style="color: #ff0000">offset</span><span style="color: #0000ff">=&#34;.65&#34;</span> <span style="color: #ff0000">stop-color</span><span style="color: #0000ff">=&#34;#700d0d&#34;</span><span style="color: #0000ff">/&#62;</span><br />        <span style="color: #0000ff">&#60;</span><span style="color: #800000">stop</span> <span style="color: #ff0000">stop-opacity</span><span style="color: #0000ff">=&#34;.9&#34;</span> <span style="color: #ff0000">offset</span><span style="color: #0000ff">=&#34;1&#34;</span> <span style="color: #ff0000">stop-color</span><span style="color: #0000ff">=&#34;#8c1111&#34;</span><span style="color: #0000ff">/&#62;</span><br />    <span style="color: #0000ff">&#60;/</span><span style="color: #800000">linearGradient</span><span style="color: #0000ff">&#62;</span><br /><span style="color: #0000ff">&#60;/</span><span style="color: #800000">defs</span><span style="color: #0000ff">&#62;</span><br /></pre>

  <br /></div>

<p>These &#60;defs&#62; are later referenced:</p>

<div>
  <pre><span style="color: #008000">&#60;!-- edges --&#62;</span><br /><span style="color: #0000ff">&#60;</span><span style="color: #800000">path</span> <span style="color: #ff0000">d</span><span style="color: #0000ff">=&#34;M 2474 4434 L 4860 2945 C 5009 &#34;</span> <span style="color: #ff0000">fill</span><span style="color: #0000ff">=&#34;url(<span style="background-color: yellow">#grad21</span>)&#34;</span><span style="color: #0000ff">/&#62;</span><br /></pre>

  <br /></div>

<p>Once the &#60;defs&#62; were in place and the main clipart content was inline, I designed the rest of the experience, keeping in mind that SVG renders in layers from top to bottom. The majority of the remaining content was the scoreboard, the felt, the text and the cup.</p>

<h5>Adding the User Interactivity and Animations</h5>

<p>One of the more challenging aspects of this demo was organizing the sizing. One of the first things I do in the code is register the resize event, and set up the dimensions of the &#60;svg&#62; and the contained svg fragments. For simplicity, I &#60;g&#62;rouped them so I can apply scaling and positioning individually.</p>

<div>
  <pre>document.getElementById(<span style="color: #006080">&#34;theSVG&#34;</span>).setAttribute(<span style="color: #006080">&#34;width&#34;</span>, surfaceWidth.toString() + <span style="color: #006080">&#34;px&#34;</span>);</pre>

  <br /></div>

<p>Something to take notice of immediately here is that this JavaScript code is familiar to web developers because it is standard JavaScript working with the DOM. SVG has its own DOM methods which I use, but I mostly stick to DOM Level 2 constructs as there is general agreement in the SVG Working Group that the SVG DOM might need revisiting.</p>

<p>Next I needed to take both of the static dice as SVG Fragments, and create some code to clone them, store references in an array with properties that allow me to manipulate their transforms for the animation effects, as well as ensure the physics engine recognizes them accordingly. The loop to create the dice is straightforward; it loops through the number of dice desired, clones the original into the DOM and creates an array to manage them.</p>

<p>Note: Most code samples here are trimmed for brevity, but all of the code is on the Platform Preview site <a href="http://ie.microsoft.com/testdrive/Performance/SVGDice/Default.xhtml">http://ie.microsoft.com/testdrive/Performance/SVGDice/Default.xhtml</a>)</p>

<p>First I clone the prototype and add it to the DOM, setting some default attributes along the way. Note the establishment of the transform is used to move the dice (translate), rotate the dice (rotate) and size the dice (scale).</p>

<div>
  <pre><span style="color: #008000">// create an instance of die #1 and add it to the SVG Doc</span><br /><span style="color: #0000ff">this</span>.die1 = createElement(<span style="color: #006080">&#34;g&#34;</span>);<br /><span style="color: #0000ff">var</span> tmpChild = <span style="color: #0000ff">this</span>.die1.appendChild(createElement(<span style="color: #006080">&#34;g&#34;</span>));<br /><span style="color: #0000ff">var</span> tmpNode = <span style="color: #0000ff">this</span>.die1.appendChild(tmpChild);<br />tmpNode.appendChild(nodeDie1.cloneNode(<span style="color: #0000ff">true</span>));<br /><span style="color: #008000">// set some default attributes</span><br /><span style="color: #0000ff">this</span>.die1.setAttribute(<span style="color: #006080">&#34;id&#34;</span>, <span style="color: #006080">&#34;die_1_&#34;</span> + number.toString());<br /><span style="color: #0000ff">this</span>.die1.setAttribute(<span style="color: #006080">&#34;transform&#34;</span>, <br />    <span style="color: #006080">&#34;translate(&#34;</span> + <span style="color: #0000ff">this</span>.x.toString() + <span style="color: #006080">&#34;,&#34;</span> + <span style="color: #0000ff">this</span>.y.toString() + <span style="color: #006080">&#34;) <br />    scale (&#34;</span> + <span style="color: #0000ff">this</span>.scale.toString() + <span style="color: #006080">&#34;)&#34;</span>);<br /><br /></pre>

  <br /></div>

<p>I wanted to make use of the &#60;use&#62; element here as this is a great way to clone a group of SVG fragments. Unfortunately, the implementation of &#60;use&#62; varies across browsers, specifically in the case of styling and events.</p>

<p>Next I use the SVGDOM getBBox() method to grab the dimensions of the die as we shrink each one along the way. This method returns an SVGRect which is used in the physics engine to detect collision.</p>

<div>
  <pre><span style="color: #0000ff">var</span> rectSize = <span style="color: #0000ff">this</span>.die1.getBBox(); <span style="color: #008000">// calculate dimensions for use with physics</span><br /><span style="color: #0000ff">this</span>.height = rectSize.height;<br /><span style="color: #0000ff">this</span>.width = rectSize.width;<br /></pre>

  <br /></div>

<p>One of my favorite parts of building this sample was the discovery and use of the <a href="http://box2d-js.sourceforge.net/">Box2DJS</a> engine which made physics a breeze! This engine is used in many projects and is now available to web developers. Before I create the dice, I actually initialize the world around me:</p>

<div>
  <pre><span style="color: #0000ff">function</span> createWorld(width, height) {<br />    <span style="color: #0000ff">var</span> worldAABB = <span style="color: #0000ff">new</span> b2AABB();<br /><br />    <span style="color: #0000ff">var</span> world = <span style="color: #0000ff">new</span> b2World(worldAABB, gravity, doSleep);<br />    createGround(world, width, height);<br />    <span style="color: #008000">// Side</span><br />    createBox(world, 0, 0, 30, height);<br />    createBox(world, width, 0, 30, height);<br />    createBox(world, 0, 0, width + 30, 30);<br />    createBox(world, 0,height , width+30,30);<br /><br />    <span style="color: #0000ff">return</span> world;<br />}<br /></pre>

  <br /></div>

<p>And then during dice creation I add each die to the world and give it an initial velocity.</p>

<div>
  <pre><span style="color: #008000">// add this dice to the physics engine</span><br /><span style="color: #0000ff">this</span>.circleBody = createBall(world, <span style="color: #0000ff">this</span>.xTrans, <span style="color: #0000ff">this</span>.yTrans, <span style="color: #0000ff">this</span>.width);    <br /><span style="color: #008000">// give the force a slightly random starting velocity</span><br /><span style="color: #0000ff">this</span>.circleBody.SetLinearVelocity(initialForce);<br /></pre>

  <br /></div>

<p>After adding some user interaction to add dice, I remove dice and shake the cup. Then, I create a timer and step the world.</p>

<div>
  <pre>timer = window.setInterval(DoStuff, 16);<br /><span style="color: #008000">// move the world</span><br />world.Step(timeStep, iteration);<br /></pre>

  <br /></div>

<p>The Die class has a prototype update function that is called when the world steps. The primary mechanism for moving the dice is to get the coordinates from the physics engine and set the transform property with all of the elements originally established:</p>

<div>
  <pre><span style="color: #0000ff">var</span> transFormString = <span style="color: #006080">&#34;translate(&#34;</span> + Math.round(<span style="color: #0000ff">this</span>.circleBody.m_position.x)<br />     + <span style="color: #006080">&#34;,&#34;</span> + Math.round(<span style="color: #0000ff">this</span>.circleBody.m_position.y) + <span style="color: #006080">&#34;) scale (&#34;</span> +<br />     <span style="color: #0000ff">this</span>.scale.toString() + <span style="color: #006080">&#34;) rotate(&#34;</span> + Math.round(<span style="color: #0000ff">this</span>.rotation).toString()<br />     + <span style="color: #006080">&#34;,&#34;</span> + Math.round(<span style="color: #0000ff">this</span>.xTrans).toString() + <span style="color: #006080">&#34;,&#34;</span> +<br />     Math.round(<span style="color: #0000ff">this</span>.yTrans).toString() + <span style="color: #006080">&#34;)&#34;</span>;<br /></pre>

  <br /></div>

<p>We now have moving, rolling, colliding dice.</p>

<p>Note that using the transform attribute is not necessarily the fastest approach, depending upon the implementation. As mentioned previously, I shied away from the SVGDOM which provides methods such as setTranslate() and setRotate(). The method I chose here considers potential future use of <a href="http://www.w3.org/TR/css3-2d-transforms/">CSS Transforms</a> with <a href="http://www.w3.org/TR/css3-transitions/">CSS Transitions</a> and/or <a href="http://www.w3.org/TR/css3-animations/">CSS Animations</a>.</p>

<h5>Styling the Graphics</h5>

<p>Lastly, I wanted to take advantage of SVG integrated into the DOM and use CSS to change the style of the scene. Since the original art came from a design tool, it contained RGB values for colors and opacities.</p>

<div>
  <pre><span style="color: #0000ff">&#60;</span><span style="color: #800000">linearGradient</span> <span style="color: #ff0000">id</span><span style="color: #0000ff">=&#34;cgrad2c&#34;</span> <span style="color: #ff0000">x1</span><span style="color: #0000ff">=&#34;1&#34;</span> <span style="color: #ff0000">x2</span><span style="color: #0000ff">=&#34;.17&#34;</span> <span style="color: #ff0000">y1</span><span style="color: #0000ff">=&#34;0&#34;</span> <span style="color: #ff0000">y2</span><span style="color: #0000ff">=&#34;.58&#34;</span><span style="color: #0000ff">&#62;</span><br />    <span style="color: #0000ff">&#60;</span><span style="color: #800000">stop</span> <span style="background-color: yellow"><span style="color: #ff0000">stop-opacity</span><span style="color: #0000ff">=&#34;.9&#34;</span> <span style="color: #ff0000">offset</span><span style="color: #0000ff">=&#34;0&#34;</span>  <span style="color: #ff0000">stop-color</span><span style="color: #0000ff">=&#34;#700d0d&#34;</span></span><span style="color: #0000ff">/&#62;</span><br />    <span style="color: #0000ff">&#60;</span><span style="color: #800000">stop</span> <span style="background-color: yellow"><span style="color: #ff0000">stop-opacity</span><span style="color: #0000ff">=&#34;.9&#34;</span> <span style="color: #ff0000">offset</span><span style="color: #0000ff">=&#34;1&#34;</span> <span style="color: #ff0000">stop-color</span><span style="color: #0000ff">=&#34;#b51616&#34;</span></span><span style="color: #0000ff">/&#62;</span><br /><span style="color: #0000ff">&#60;/</span><span style="color: #800000">linearGradient</span><span style="color: #0000ff">&#62;</span><br /></pre>

  <br /></div>

<p>I replaced these RGB values with styles:</p>

<div>
  <pre><span style="color: #0000ff">&#60;</span><span style="color: #800000">linearGradient</span> <span style="color: #ff0000">id</span><span style="color: #0000ff">=&#34;cgrad2c&#34;</span> <span style="color: #ff0000">x1</span><span style="color: #0000ff">=&#34;1&#34;</span> <span style="color: #ff0000">x2</span><span style="color: #0000ff">=&#34;.17&#34;</span> <span style="color: #ff0000">y1</span><span style="color: #0000ff">=&#34;0&#34;</span> <span style="color: #ff0000">y2</span><span style="color: #0000ff">=&#34;.58&#34;</span><span style="color: #0000ff">&#62;</span><br />    <span style="color: #0000ff">&#60;</span><span style="color: #800000">stop</span> <span style="background-color: yellow"><span style="color: #ff0000">class</span><span style="color: #0000ff">=&#34;diceCorner6&#34;</span></span><span style="color: #0000ff">/&#62;</span><br />    <span style="color: #0000ff">&#60;</span><span style="color: #800000">stop</span> <span style="background-color: yellow"><span style="color: #ff0000">class</span><span style="color: #0000ff">=&#34;diceCorner7&#34;</span></span><span style="color: #0000ff">&#62;</span><br /><span style="color: #0000ff">&#60;/</span><span style="color: #800000">linearGradient</span><span style="color: #0000ff">&#62;</span><br /></pre>

  <br /></div>

<p>This allowed me to create style sheets for each of these styles:</p>

<div>
  <pre>g#classHandler<span style="color: #cc6633">.vegas</span> <span style="background-color: yellow;color: #cc6633">.diceCorner6</span> {stop-opacity:<span style="color: #006080">.9;</span>offset:0;stop-<span style="color: #0000ff">color</span>:<span style="color: #006080">#700d0d;</span>}<br />g#classHandler<span style="color: #cc6633">.vegas</span> <span style="background-color: yellow;color: #cc6633">.diceCorner6</span> {stop-opacity:<span style="color: #006080">.9;</span>offset:1;stop-<span style="color: #0000ff">color</span>:<span style="color: #006080">#b51616;</span>}<br /><br />g#classHandler<span style="color: #cc6633">.lowfidielity</span> <span style="background-color: yellow;color: #cc6633">.diceCorner6</span> {offset:0;stop-<span style="color: #0000ff">color</span>:<span style="color: #006080">#000000;</span>}<br />g#classHandler<span style="color: #cc6633">.lowfidielity</span> <span style="background-color: yellow;color: #cc6633">.diceCorner6</span> {offset:1;stop-<span style="color: #0000ff">color</span>:<span style="color: #006080">#000000;</span>}<br /></pre>

  <br /></div>

<p>And then set the one class property at the top of the document to change all of the styles in the document:</p>

<div>
  <pre><span style="color: #008000">// set the overall stylesheet via class</span><br />document.getElementById(<span style="color: #006080">&#34;classHandler&#34;</span>).setAttribute(<span style="color: #006080">&#34;class&#34;</span>, style);<br /></pre>

  <br /></div>

<p>This allows the user to change the style sheet even while the dice are rolling as there is no difference to the DOM as to when these styles are changed. Hardware accelerated graphics in Internet Explorer 9 enable this to happen very quickly.</p>

<h3>Call to Action</h3>

<p>Start working with SVG in Internet Explorer 9. IE9 is platform complete for SVG in the latest platform preview release. Experiment with the feature set and tell us about incompatibilities or bugs you find using the “Report Issue” command and on <a href="https://connect.microsoft.com/IE">Microsoft Connect</a>.</p>

<p>The IE team is testing sites, libraries and other SVG content on the web. Our goal is to help authors with their content and find any bugs in our feature set. One important best practice is using <a href="http://blogs.msdn.com/b/ie/archive/2010/06/10/same-markup-explaining-quot-jscript-version-quot-and-styling-new-html5-elements.aspx">feature detection, not browser detection</a> when testing for SVG support. Help us find the places where developers are detecting specific browsers instead of testing for functionality, and make any changes to open source libraries, or contact content authors such that we can help fix any issues that may arise.</p>

<p>We’re excited to see web developers start using this technology and the next generation, graphically rich, websites built with SVG.</p>

<p>Patrick Dengler 
  <br />Senior Program Manager 

  <br />Internet Explorer</p><div style="clear:both"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=10056018" width="1" height="1"/>]]></description>
		<wfw:commentRss>http://blogs.msdn.com/b/ie/archive/2010/08/31/getting-ready-for-svg-open.aspx/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Performance: Profiling how different web sites use browser subsystems</title>
		<link>http://blogs.msdn.com/b/ie/archive/2010/08/30/performance-profiling-how-different-web-sites-use-browser-subsystems.aspx</link>
		<comments>http://blogs.msdn.com/b/ie/archive/2010/08/30/performance-profiling-how-different-web-sites-use-browser-subsystems.aspx#comments</comments>
		<pubDate>Mon, 30 Aug 2010 19:47:00 +0000</pubDate>
		<dc:creator>ieblog</dc:creator>
				<category><![CDATA[Microsoft News]]></category>

		<guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10055904</guid>
		<description><![CDATA[<p>When we <a href="http://blogs.msdn.com/b/ie/archive/2009/11/18/an-early-look-at-ie9-for-developers.aspx">first showed IE9</a> at <a href="http://www.microsoftpdc.com/2009/KEY02">the Professional Developers Conference last fall</a>, we discussed how real world browser performance involves many different subsystems. Different websites use these subsystems in different ways, and to build a fast real world browser you have to start by understanding these overall patterns. This post provides an inside look at how these subsystems impact the performance of five real world websites. We use Internet Explorer 8 for this analysis, and as <a href="http://www.beautyoftheweb.com/Invitation/">IE9 approaches</a> we’ll talk more about how these performance characteristics evolve.</p>  <p>All modern web browsers are conceptually similar. Browser vendors have different priorities (for example, supporting many different operating systems or optimizing for one). Browser vendors also have different engineering approaches which influence their programming languages, tools, and processes. When you step back from the specific engineering details though, all modern browsers connect to a server and execute the same markup and script. They all essentially do the same thing to enable customers to interact with web sites.</p>  <p><b>Browser Subsystems</b></p>  <p>The Internet Explorer web platform is composed of 11 core subsystems. All modern browsers provide these capabilities, and while the names and component boundaries vary slightly between browsers, the process is nearly identical.</p>  <blockquote><img alt="Progression of IE subsystems.  Networking --&#62; HTML --&#62; CSS --&#62; Collections --&#62; Javascript --&#62; Marshalling --&#62; Native OM --&#62; Formatting --&#62; Block Building --&#62; Layout --&#62; Display" src="http://ieblog.members.winisp.net/images/JasonWeber_PerfProfiling_1.png" /> </blockquote>  <p>Here’s a brief overview of these subsystems in the order they’re encountered when you load a web site:</p>  <blockquote>   <p><b>Networking:</b> The first subsystem generally encountered is networking. The networking subsystem is responsible for all communication between the client and server, including local caching of web content. The networking subsystem is generally gated on the performance of the user’s network</p>    <p><b>HTML:</b> As HTML documents are downloaded from the server they’re passed to an HTML subsystem which parses the document, initiates additional downloads in the networking subsystem, and creates a structural representation of the document. Modern browsers also contain related subsystems which are used for XHTML, XML and SVG documents.</p>    <p><b>CSS:</b> When CSS is encountered, whether that’s inside an HTML document or a CSS document, it’s passed to a CSS subsystem which parses the style information and creates a structural representation that can be referenced later.</p>    <p><b>Collections:</b> HTML documents often contain metadata, for example the information described in the document head or the attributes applied to an element. The collections subsystem is responsible for storing and accessing this metadata.</p>    <p><b>JavaScript: </b>When script is encountered, it’s passed directly to the JavaScript subsystem which is responsible for executing that script. The JavaScript subsystem is probably the most well-known of the browser subsystems thanks to the visibility it has received over the last few years.</p>    <p><b>Marshaling: </b>Because<b> </b>most JavaScript engines are not directly integrated into the browser, there is a communication layer between the browser and the script engine. Passing information through this communication layer is generally referred to as marshaling.</p>    <p><b>Native OM: </b>JavaScript interacts with the document through the Document Object Model API’s. These API’s are generally provided through a subsystem which knows how to access and manipulate the document and is the primary interaction point between the script engine and the browser.</p>    <p><b>Formatting:</b> Once the document is constructed, the browser needs to apply the style information before it can be displayed to the user. The formatting subsystem takes the HTML document and applies styles.</p>    <p><b>Block Building:</b> CSS is a block based layout system. After the document is styled, the next step is to construct the rectangular blocks that will be displayed to the user. This process determines things like the size of the blocks and is tightly integrated with the next stage - layout.</p>    <p><b>Layout:</b> Now that the browser has styled the content and constructed the blocks, it can go through the process of laying out the content. The layout subsystem is responsible for this algorithmically complex process.</p>    <p><b>Rendering:</b> The final stage of the process occurs inside the rendering subsystem where the final content is displayed to the user. This process is often referred to as “drawing to the screen” and may occur on the CPU, the GPU, or a combination of both.</p> </blockquote>  <p>As we’ve mentioned, different websites use these subsystems in different ways. Even websites that provide similar functionality, for example some of the world’s largest news websites which provide comparable experiences on their home pages including headlines and video, have very different performance characteristics.</p>  <p><b>Profiling News Sites</b></p>  <p>To help you understand what we mean, we took five of the world’s largest news websites and <a href="http://blogs.msdn.com/b/ie/archive/2010/06/21/measuring-browser-performance-with-the-windows-performance-tools.aspx">profiled</a> them loading inside IE8 using the <a href="http://msdn.microsoft.com/en-us/performance/cc825801.aspx">Windows Performance Tools</a>. We do this in a <a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&#38;FamilyID=cd8932f3-b4be-4e0e-a73b-4a373d85146d#filelist">controlled environment</a> to remove external variables and we load each site multiple times to ensure high confidence with the results. We factor out networking performance from these charts because that’s <a href="http://www.speedtest.net/">user dependent</a>. This approach allows us to see how long it takes the browser to load the web site and the breakdown of CPU time across subsystems. In the below chart, you can see that it took between 1,117 and 3,704 milliseconds to load these five pages - that’s between 1.1 and 3.7 seconds. The color coding represents the browser subsystem where the time was spent.</p>  <blockquote><img alt="Chart of subsystem Breakdownfor Common News Sites" src="http://ieblog.members.winisp.net/images/JasonWeber_PerfProfiling_2.png" longdesc="http://ieblog.members.winisp.net/misc/JasonWeber_PerfProfiling.txt" /> </blockquote>  <p>There are some revealing patterns in these results. For example, News Site #1 spent the majority of the time in <i>JavaScript</i>, News Site #2 spent the majority of the time in <i>Marshaling</i>, and News Site #5 spent the majority of time in the<i> Layout </i>process which includes <i>Formatting</i> and <i>Block Building</i>. For each website a different subsystem made the largest impact on performance.</p>  <p>It’s also interesting to see how much control the web developer has over their own site’s performance. Even though News Site #3 provided a comparable experience to their competitors, they follow <a href="http://www.amazon.com/dp/0596529309?tag=stevsoud-20&#38;camp=14573&#38;creative=327641&#38;linkCode=as1&#38;creativeASIN=0596529309&#38;adid=06PDDAM4F80D22NKCKCG&#38;">performance best practices</a> and the site is quickly loaded in just over a second. In contrast, News Site #4 doesn’t follow many best practices and takes over three times as long to load.</p>  <p>When we average these results together we can start to understand the relative impact each subsystem has across news sites. As you see below, every subsystem plays an important role in the performance of these News Sites with JavaScript (29%), Marshalling (18%) and Rendering (17%) making the largest impact.</p>  <blockquote><img alt="Chart of amount of time inside each browser subsystem on News Sites" src="http://ieblog.members.winisp.net/images/JasonWeber_PerfProfiling_3.png" longdesc="http://ieblog.members.winisp.net/misc/JasonWeber_PerfProfiling.txt" /></blockquote>  <p><b>Profiling Top AJAX Sites</b></p>  <p>News sites provide one view into how performance is multidimensional; however it’s important to look at other classes of web sites to see how these patterns change. When we perform the same analysis on the world’s top 25 AJAX sites, including some of the most sophisticated JavaScript applications like Facebook, Gmail and Hotmail, we get the following results.</p>  <blockquote><img alt="Chart of Amount of time inside each browser subsystem on AJAX sites" src="http://ieblog.members.winisp.net/images/JasonWeber_PerfProfiling_4.png" longdesc="http://ieblog.members.winisp.net/misc/JasonWeber_PerfProfiling.txt" /> </blockquote>  <p>As you can see the distribution has shifted slightly. Some subsystems including HTML, CSS and JavaScript become relatively less important and other subsystems including Formatting, Layout, Block Building and Rendering become <i>extremely</i> important. This can be surprising at first since most people associate AJAX sites with JavaScript. When you think about the patterns inside AJAX sites though, these results make sense. Inside most AJAX sites you generally have a small amount of JavaScript that manipulates the document. Once that script executes, the browser needs to go through almost all of the subsystems for that change to become visible to the user. That process is generally more expensive than executing the script itself.</p>  <p>You can see that performance of AJAX sites is also multi-dimensional and impacted by all of the subsystems in the browser. For AJAX sites, the most important subsystem is rendering which accounts for 31% of the time, followed by the JavaScript subsystem which accounts for 21% of the time. It’s interesting to see how JavaScript subsystem performance has proportionately more impact when loading a web page than when interacting with an AJAX site.</p>  <p><b>Bringing It All Together</b></p>  <p>To build a fast real world browser you have to understand how different browser subsystems impact performance in real world scenarios, and you have to focus on the subsystems that matter. For AJAX sites, that means focusing on Rendering (31%), JavaScript (21%), Formatting (14%) and Layout (12%). For news sites, that means focusing on JavaScript (29%), Marshalling (18%) and Rendering (17%). </p>  <p>With Internet Explorer 9, we worked on building the right foundation across the browser to ensure developers have a reliably fast platform. Over the last few months we’ve talked about some of the fundamental changes we made including <a href="http://blogs.msdn.com/b/ie/archive/2010/04/07/a-closer-look-at-internet-explorer-9-hardware-acceleration-through-flying-images.aspx">hardware accelerated graphics</a>, <a href="http://blogs.msdn.com/b/ie/archive/2010/03/18/the-new-javascript-engine-in-internet-explorer-9.aspx">compiled JavaScript</a>, and <a href="http://blogs.msdn.com/b/ie/archive/2010/08/04/html5-modernized-fourth-ie9-platform-preview-available-for-developers.aspx">natively integrating JavaScript</a> directly inside the browser. As we get closer to <a href="http://www.beautyoftheweb.com/Invitation/">the IE9 beta</a> we’ll talk more about how these subsystems come together in IE9 to change the performance characteristics compared to today’s generation of non-hardware accelerated browsers including IE8.</p>  <p>Jason Weber    <br />Lead Program Manager, Internet Explorer Performance</p><div style="clear:both"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=10055904" width="1" height="1"/>]]></description>
		<wfw:commentRss>http://blogs.msdn.com/b/ie/archive/2010/08/30/performance-profiling-how-different-web-sites-use-browser-subsystems.aspx/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More on SVG</title>
		<link>http://blogs.msdn.com/b/ie/archive/2010/08/27/more-on-svg.aspx</link>
		<comments>http://blogs.msdn.com/b/ie/archive/2010/08/27/more-on-svg.aspx#comments</comments>
		<pubDate>Fri, 27 Aug 2010 22:00:00 +0000</pubDate>
		<dc:creator>ieblog</dc:creator>
				<category><![CDATA[Microsoft News]]></category>

		<guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10054800</guid>
		<description><![CDATA[<p>The first IE9 Platform Preview unveiled <a href="http://blogs.msdn.com/b/ie/archive/2010/03/18/svg-in-ie9-roadmap.aspx">IE9’s initial support of SVG</a>. As explained previously, SVG is a vector image format managed by the W3C. The release of the third and fourth Platform Previews come with feature-complete SVG. Major additions include support for SVG gradients, patterns, clipping, and masking. These features are often used to create images with depth and texture and are typically found in more complex SVG files. Just like the rest of SVG in IE9, the newly added features are fully hardware accelerated. This results in impressive performance especially for computationally complex features such as clipping and masking. We continue to <a href="http://blogs.msdn.com/b/ie/archive/2010/06/08/getting-to-svg-2-0-a-report-from-the-svg-working-group-face-to-face-may-24th-june-1st-2010.aspx">work with the SVG Working Group</a> to resolve ambiguities in the SVG 1.1 2<sup>nd</sup> edition specification and to ensure that IE9’s SVG implementation is interoperable.</p>  <h3><b>9 Things I &#60;3 About SVG</b></h3>  <p>SVG’s benefits are multifaceted. It’s an incredibly flexible and powerful format that is ideal for a variety of use cases. Here are just a few of the reasons why SVG can play a critical part of the HTML5 web:</p>  <p><b>1. Scale-ability</b></p>  <p>An obvious benefit of SVG is scalability, as evidenced by the name <i>Scalable</i> Vector Graphics. This makes it an ideal format for maps, charts, and graphs – graphics where the detail is as important as the overall picture. With SVG, the fidelity of the graphic is maintained at all resolutions. A company logo or website icon can be created once and used many times in different places or sizes. The same image no longer needs to be saved at multiple resolutions, each tailored towards a specific purpose. Maps often need to be viewed as a whole in addition to being able to selectively see sections in detail. Currently, a common format for maps is a PDF file. This format makes it easy to to scale the map to different sizes,print at many resolutions with full fidelity, and provides the user with the ability to search within the document. SVG has all of these positive qualities natively supported; no plugins are required. Preset views of the same document can even be defined to make navigation to different sections simpler.</p>  <p><b>2. Script-ability</b></p>  <p>SVG is supported by a rich DOM, making it easy to script and manipulate SVG with Javascript. Because SVG shapes are graphic objects akin to HTML elements, SVG scripting uses common patterns that web developers already understand. SVG elements can take event handlers; they can be modified via the DOM or by the DOM L2 Core setAttribute() and getAttribute() methods. All attributes that describe the SVG element can be modified, from position to color to the shape of the element. The example below demonstrates how event handling and scripting can be used to create interactive SVG.</p>  <div style="border-bottom: black thin solid;border-left: black thin solid;padding-bottom: 10px;padding-left: 10px;width: 600px;padding-right: 10px;border-top: black thin solid;border-right: black thin solid;padding-top: 10px"> <p>Your browser or viewer does not support xhtml with svg, view this post in IE9 or another browser to use the examples. <a href="http://ie.microsoft.com/testdrive/">Get IE9 Platform Preview.</a></p>  <p style="font-weight:bold">Script: </p>  <pre><code>var colors = ["orange", "black", "yellow", "red", "blue", "fuchsia"];
var curColor = 0;

function alternateColor() {
	var circle = document.getElementById("myCircle");
	curColor = (curColor + 1) % colors.length;
	circle.setAttribute("fill", colors[curColor]);
	circle.setAttribute("stroke", colors[curColor]);
}</code></pre>

<p style="font-weight:bold">SVG: </p>

<pre><code>&#60;svg xmlns="http://www.w3.org/2000/svg" height="150" width="150"&#62;
	&#60;circle onclick="alternateColor();"
		cx="75" cy="75" r="50"
		fill="orange"
		stroke="orange" stroke-opacity=".5" stroke-width="10"
		id="myCircle"/&#62;
&#60;/svg&#62;</code></pre>

<img src="http://ieblog.members.winisp.net/misc/JennSVG/sample3_screenIE.png" />
</div>

<p><b>3. Style-ability</b></p>

<p>There are several ways to include SVG on a webpage. The &#60;embed&#62;, &#60;object&#62;, &#60;iframe&#62;, &#60;img&#62; tags can reference an SVG file. SVG can be included via CSS as a background-image or a list-style-image. To really integrate SVG with the page, it can be included inline in XHTML or HTML5. Standalone SVG documents and inline SVG have the advantage of being fully incorporated in the webpage. The SVG is treated just like other HTML elements and is styled with the same CSS block that styles the entire page. Websites – complete with icons, logos, navigation UI, and other SVG graphics – are skinnable with stylesheets alone. A print stylesheet can even be applied to your SVG images to allow more control over the appearance of the image on paper. Take a look at the example below. If you’re using a browser that supports SVG, you can switch between stylesheets to see how SVG images can change just by altering a simple stylesheet!</p>

<div style="border-bottom: black thin solid;border-left: black thin solid;padding-bottom: 10px;padding-left: 10px;width: 600px;padding-right: 10px;border-top: black thin solid;border-right: black thin solid;padding-top: 10px">

<img src="http://ieblog.members.winisp.net/misc/JennSVG/sample2_screenIE.png" />
</div>

<p><b>4. Search-ability</b></p>

<p>SVG is a format based on XML, so it’s composed of elements and attributes that are human-readable. Text in an SVG file shows up as text in markup. The XML format enables users to search the document for text, which is not possible in the more traditionally popular GIF and PNG image formats. For developers, the text-based format means that text in SVG images is surfaced to search engines. With this information, a website can be more comprehensively indexed and found by the right people. For example, a flow chart can be picked up by a search engine without requiring the web author to transcribe every panel of the chart.</p>

<p><b>5. Accessibility</b></p>

<p>In addition to the searchable aspect of SVG, another benefit of the text-based format is accessibility. Unlike raster images which can have a single, all-encompassing title text and description, the &#60;title&#62; and &#60;description&#62; elements can be applied to any SVG element. A web author can provide a description for each individual component in addition to the whole document, providing a more detailed description&#160; while making it easier to understand. An SVG document has structure to it, which can enable a clearer understanding of it. Additionally, the <a href="http://www.w3.org/TR/SVGMobile12/interact.html#focusable-attr">“focusable” attribute</a> can be added to make it easy to tab through select portions of the SVG.</p>

<p><b>6. Decorative Text</b></p>

<p>SVG is not restricted for use on graphically intense websites. It can be used throughout an HTML5 or XHTML file. It’s a terrific option for decorative text headers. SVG text can be styled in more ways than HTML text. Gradients and patterns can be used in SVG text. SVG text can also be stroked, unlike HTML text. Compared to raster images, SVG text is much more flexible for editing. Used in combination with a CSS block, text across many areas of the document can be given the same appearance, much like HTML headers today. And with <a href="http://blogs.msdn.com/b/ie/archive/2010/07/15/the-css-corner-better-web-typography-for-better-design.aspx">IE9’s support for WOFF</a>, you can even apply the same WOFF font used elsewhere on your page! SVG text can be rotated or laid out along a custom path. Overall, SVG text enables more flexibility and creativity in text on a webpage. Try the example below to see how easy it is to create decorative text!</p>

<div style="border-bottom: black thin solid;border-left: black thin solid;padding-bottom: 10px;padding-left: 10px;width: 700px;padding-right: 10px;border-top: black thin solid;border-right: black thin solid;padding-top: 10px">

<img src="http://ieblog.members.winisp.net/misc/JennSVG/sample1_screenIE.png" />
</div>

<p><b>7. Data-Driven/Server-Generated SVG</b></p>

<p>SVG is an XML specification, making it a good target format for server-generated images. Server-generated XML is fairly common; RSS and Atom feeds are a couple of examples. Maps, charts, and graphs often draw from a store of data. SVG is already a prime candidate for these types of documents. With the ease of XML generation, SVG really shines as a fantastic format for creation of these informational images.</p>

<p><b>8. Seamless Browsing Experience</b></p>

<p>One of SVG’s advantages over alternative 3rd party plug-ins (such as Flash or Silverlight) is native browser support which offers several benefits. To experience SVG on the web, users don’t need to install add-ons. Built-in support is convenient for the user and reduces exposure to potential add-on vulnerabilities. SVG is hardware accelerated in IE9, offering a smoother interactive and viewing experience for users. Additionally, SVG offers better integration with page markup, DOM, and script to provide for a consistent programming model and better user experiences.</p>

<p>In IE9, SVG is treated much like an image today and matches user expectations of an image: it can be saved into the PNG and BMP raster image formats; it can be copied and pasted into a Word document or Powerpoint presentation as a rasterized version -- much like PNGs, JPEGs, and GIFs found on the web today; it can be set as a desktop background; printing SVG is just like printing an image. The browser also takes advantage of the benefits of SVG: it can be saved in the SVG format; it can be copied and pasted into <a href="http://www.inkscape.org">Inkscape</a> for editing as SVG; SVG text is searchable. Native support for SVG makes it easier for users to have a consistent browsing experience.</p>

<p><b>9. Familiarity/View Source</b></p>

<p>Because SVG is an extension of XML, learning SVG is merely an adaptation of XML/HTML knowledge that many developers are already familiar with. Many of us learned HTML using a browser’s View Source feature with Web sites we admired. SVG works the same way: View Source on a SVG file or an HTML5 file with inline SVG, and you can see, learn, and understand how an SVG graphic was made. And SVG elements work with IE9’s&#160; debugging tools. As such, SVG is a web technology that is easy to pick up.</p>

<p>Additionally, several commonly used tools – such as Visio or Adobe Illustrator – are already capable of outputting SVG files. <a href="http://www.inkscape.org">Inkscape</a> is another fantastic tool for creating SVG; it specifically targets SVG as an output format and is free to download.&#160; Using SVG on the web is a natural transition.</p>

<h3><b>Call to Action</b></h3>

<p>If you plan to use SVG on your website, you may also want to provide fallback behavior for browsers that do not support SVG. Depending on the context, it may be appropriate to use text, an image, or a combination of both to supplant the SVG. Remember to use <a href="http://blogs.msdn.com/b/ie/archive/2010/06/10/same-markup-explaining-quot-jscript-version-quot-and-styling-new-html5-elements.aspx">feature detection, not browser detection</a> to determine which format to display. SVG has an <a href="http://www.w3.org/TR/SVG/feature.html#SVG11FeatureStrings">assortment of feature strings </a>to describe SVG support for different modules. Using a try-catch statement and the hasFeature() method, you can determine if SVG is supported by the browser. For example:</p>

<blockquote>
  <pre><code>try {
	if (document.implementation.hasFeature(&#34;http://www.w3.org/TR/SVG11/feature#Structure&#34;, &#34;1.1&#34;)) {
		// display SVG
	}
	else {
		//fallback behavior
	}
}
catch(e) {
	// fallback behavior
}</code></pre>
</blockquote>

<p>Alternatively, if you embed SVG on your page as separate .SVG files, you can use the take advantage of the &#60;object&#62; tag by placing your fallback behavior within as follows:</p>

<blockquote><code>&#60;object data=&#34;vectorPanda.svg&#34; type=&#34;image/svg+xml&#34;&#62;&#60;img src=&#34;pandaFallbackImage.png&#34;&#62;&#60;/object&#62;</code></blockquote>

<p>If you are already serving SVG in HTML5 pages on your website, make sure that your HTML5 pages have the proper doctype so the pages load in the <a href="http://blogs.msdn.com/b/ie/archive/2010/03/02/how-ie8-determines-document-mode.aspx">desired Document Mode</a>. With no DocType present, IE9 will render in Quirks Mode and your beautiful SVG content will not display. Including the HTML5 DocType is as simple as inserting <b>&#60;!DOCTYPE html&#62;</b> as the first line of your Web page’s markup.</p>

<p>If you’re serving SVG within XHTML or directly as SVG, ensure that your Web server is serving with the proper MIME types: 
  <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; XHTML = application/xhtml+xml 

  <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SVG = image/svg+xml</p>

<p>Please try SVG in the <a href="http://ie.microsoft.com/testdrive/">Platform Preview</a> and see how it can enhance your site! Let us know what cool ideas you come up with. We’d love to see them!</p>

<p>Jennifer Yu 
  <br />Program Manager</p><div style="clear:both"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=10054800" width="1" height="1"/>]]></description>
		<wfw:commentRss>http://blogs.msdn.com/b/ie/archive/2010/08/27/more-on-svg.aspx/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chakra: Interoperability Means More Than Just Standards</title>
		<link>http://blogs.msdn.com/b/ie/archive/2010/08/25/chakra-interoperability-means-more-than-just-standards.aspx</link>
		<comments>http://blogs.msdn.com/b/ie/archive/2010/08/25/chakra-interoperability-means-more-than-just-standards.aspx#comments</comments>
		<pubDate>Thu, 26 Aug 2010 00:31:00 +0000</pubDate>
		<dc:creator>ieblog</dc:creator>
				<category><![CDATA[Microsoft News]]></category>

		<guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10054364</guid>
		<description><![CDATA[<p>How do we decide whether to implement a feature that isn’t included in a standards specification? Like all browser providers, we often have to make this decision. In this post, I’ll use some real-world JavaScript examples to illustrate some of the principles we use to deliver an interoperable browser when the standards specification isn’t enough.</p> <p>In an ideal world, a standards specification is the complete story. A JavaScript implementation would just include everything in the <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMAScript specification</a> and nothing more. We believe that specifications published by <a href="http://en.wikipedia.org/wiki/Standards_organizations">standards organizations</a> such as <a href="http://www.ecma-international.org">Ecma International</a> or the <a href="http://www.w3.org/">W3C</a> are essential for interoperability among web browsers. Ideally, such specifications tell the browser implementers what features they need to provide and tell web developers what features they should be able to use. </p> <p>In the real world of the web, things are not so clear-cut. Specifications are seldom perfect and sometimes they are intentionally incomplete or ambiguous. Having served as editor for the ES5 specification, I know that there are always issues that don’t get fully resolved. The result is that there are widely implemented and used features that are not defined by any standard specification. If you are trying to build a browser that runs the existing web you have to implement many features that are not defined by a standards specification. </p> <h3>What’s the Real Regular Expression Grammar?</h3> <p>We built <a href="http://blogs.msdn.com/b/ie/archive/2010/03/18/the-new-javascript-engine-in-internet-explorer-9.aspx">Chakra</a> by carefully following the ECMAScript 5 (ES5) specification including the grammar for regular expressions. But when we started testing on actual web sites we started seeing pages not work because of syntax errors on some regular expression literals. For example, we failed on regular expressions containing a right square bracket such as:</p> <blockquote><code>next = /]/.exec(buffer);</code></blockquote> <p>The reason was that the grammar for regular expressions in the ECMAScript standard includes ] in a list of characters that you cannot directly use as a match character. The specification says that <code>/]/</code> is illegal and instead you need to say <code>/\]/</code>. It turns out that it is important that [ is restricted in this manner because otherwise it wouldn’t be possible to parse literals like <code>/axyz[a-d]qwer/</code>. However a lone ] that isn’t preceded by a [ really doesn’t present a parsing problem. But the standard still says that it is illegal.</p> <p>In practice, all browsers accept regular expressions such as <code>/]/</code> and web developers write them. </p> <p><i>Consensus feature</i> is a term we use to describe such features that are not part of any standard but which are universally implemented in an interoperable manner. In general, IE9 and any other new JavaScript implementation need to implement such consensus features in order to work with actual web content. The real challenge is identifying them, as they are not included in the standards specifications.</p> <p>We recognize that we have to support these sorts of consensus features and we will also be working to make sure that they get included in future editions of the appropriate web standards. However, not all JavaScript extensions are universally or uniformly implemented.</p> <h3>Why Doesn’t IE9 have those _ _ methods?</h3> <p>ES5 includes support for getter/setter methods. Similar features have been available in some web browsers for many years. Over that period, browser developers experimented with various syntaxes and APIs for defining such methods. Prior to ES5, the most widely implemented API for defining getter/setter methods used two methods named __defineGetter__ and __defineSetter__. Surrounding method names with two underscore characters is a convention that some browser developers use to identify methods that are either experimental features or which access unique low level capabilities of a specific JavaScript implementation. </p> <p><a href="http://www.ecma-international.org/memento/TC39.htm">ECMA TC39</a> members agreed that getter/setter methods should be included in the ES5 specification because their value had been clearly demonstrated. However, TC39 also chose to design a new API for defining them and to not standardize the __defineXXX__ APIs.</p> <p>Why did TC39 do this? Because of significant differences in the behaviors of the browsers that had provided that API. Standardizing on a common semantics for these methods would mean that some or perhaps all existing browser implementations would have to change to conform to the new semantics. That would probably break some applications that were written to work with those specific browsers. </p> <p>Another reason was to maintain consistent naming conventions. No other built-in names in ECMAScript begin or end with underscore characters. The association of such names with experimental or an implementation specific feature is widely known and using that convention for a standardized feature would be both misleading and would dilute the utility of the convention for future experiments.</p> <p>TC39 developed a new API based upon the <code>Object.defineProperty</code> method. This API not only supports defining getter/setter properties but also support other new capabilities of ES5. The __defineXXX__ methods were left out of the ES5 specification.</p> <p>Browsers that already provide the __defineXXX__ API are free to continue to supporting them unchanged for compatibility reasons. However, new code that is written to be interoperable among browsers supporting the ES5 standard should use <code>Object.defineProperty</code> to define getter/setter properties. </p> <p>We still get requests that we add the __defineXXX__ APIs to IE9. We understand why. Some developers already have code that uses those APIs and they would like that code run on IE9. However, we believe that supporting these APIs would not be in the best interests of the interoperable web. TC39 has already considered this API and concluded that it should not be standardized. If IE9 added support for the __defineXXX__ APIs, that action would move that API closer to being a permanent consensus feature of the web and would be essentially overriding the decision of TC39.</p> <p>Unfortunately, in the short term this creates a small amount of additional work for developers currently using the legacy API. However, it is trivial to create a simple compatibility library for your code that implements the __defineXXX__ APIs in terms of <code>Object.defineProperty</code>.</p> <h3>A Malfunctioning Consensus Feature </h3> <p>Within JavaScript code, a function can be referenced and called in code that precedes the actual function declaration. This is possible because JavaScript logically “hoists” all function declarations to the top of the containing code body. JavaScript also allows more than one function declaration to exist for the same function name. Consider a simple test function:</p> <blockquote><pre><code>function testFuncDeclarationOrder () {
   f1();
   function f1() {alert("first f1")}
   f1();
   function f1() {alert("second f1")}
   f1();
}</code></pre></blockquote>
<p>When called, this function produced the alert sequence: “second f1”, “second f1”,”second f1”. The reason is that JavaScript actually processes the function as if it had been written as:</p>
<blockquote><pre><code>function testFuncDeclarationOrder () {
   function f1() {alert("first f1")}
   function f1() {alert("second f1")}
   f1();
   f1();
   f1();
}</code></pre></blockquote>
<p>The ECMAScript specification has historically placed only one restriction upon the placement of function declaration. The ECMAScript standard does not include the ability to place a function declaration inside the body of a control structure statement. For example:</p><pre><code>if (someCondition) {
   function f1() {alert("f1")}
}</code></pre>
<p>The above code would produce a syntax error if parsed in according to the ECMAScript specification. However, if you try this in any browser, you will find that you do not get an error. Supporting function declarations anywhere a statement is permitted is a consensus feature of the web. If so, why wasn’t it included in ES5? Section 12 of the ES5 specification actually says something about this:</p>
<blockquote>NOTE Several widely used implementations of ECMAScript are known to support the use of FunctionDeclaration as a Statement. However there are significant and irreconcilable variations among the implementations in the semantics applied to such FunctionDeclarations. Because of these irreconcilable difference, the use of a FunctionDeclaration as a Statement results in code that is not reliably portable among implementations. It is recommended that ECMAScript implementations either disallow this usage of FunctionDeclaration or issue a warning when such a usage is encountered. Future editions of ECMAScript may define alternative portable means for declaring functions in a Statement context.</blockquote>
<p>What does this dense statement mean? Simply stated, the behavior across different browsers varied so widely that reconciling them was impractical. </p>
<p>So what does IE9 do? Does it disallow such statement level function declarations as recommended by ES5? No, it treats such declarations exactly like previous versions of IE.</p>
<p>Why did we make that decision? Because previous experiments by browser implementers found that rejecting such declarations broke many existing web pages.</p>
<p>This may seem surprising. How can a web page rely on features that behave different across browsers and still be interoperable among browsers? One possibility is that the code isn’t actually used. It may be in a function that is never called or whose result is not essential to the operation of the page. However, if the JavaScript implementation treated these functions as syntax errors the entire script would be rejected even though the code is never called.</p>
<p>We don’t like having to implement a feature that is such a hazard for developers. But its existence is enshrined in the web so we really had no choice. </p>
<h3>So What About const?</h3>
<p>We are sometimes asked whether we will support the <code>const</code> declaration in IE9. <code>const</code> is a non-standard JavaScript extension that provides a way to declare “named constant” values. A typical usage might be something like:</p>
<blockquote><code>const pi=3.14159;</code></blockquote>
<p>Several browsers support this feature but there are significant differences in their handling of unusual situations and in what they define to be errors. Here is an example that shows some of the differing behavior among the browsers that “support” <code>const</code>:</p><pre><code>// a function with multiple const declaration for the same name
function f() {
   alert('executing within f');
   const x=1;  //declare constant x as 1
   alert(x);
   const x=2;  //redeclare constant x as 2
   alert(x);
   x=3;        //try to assign 3 to x
   alert(x);
}
alert('about to call f'); f();</code></pre>
<p>Depending upon the browser, running this code it might: 
<ul>
<li>Issue a syntax error and not load the page. 
</li><li>Throw an exception when f is called. 
</li><li>Alert: '1', '2', '2'. This means conflicting <code>const</code> declarations are allowed but the assignment was ignored. 
</li><li>Alert '1', '2', '3'. This means that <code>const</code> was treated just like var.</li></ul>
</p><p>Basically, only very simple uses of the <code>const</code> declaration are interoperable among browsers that support the declaration. Many more elaborate uses, or scenarios that might trigger some error condition, are not interoperable among those browsers. 
</p><p>An actual JavaScript implementation can’t only support the trivial common use cases. A real implementation also has to do something for all the odd edge cases and error scenarios that exist on real web pages. Arguably, it’s mostly for situations like this that we have standardized specifications. It’s generally pretty obvious what should be done for the simple common use cases. It’s the edge cases that require a standards specification in order to have interoperable implementations. 
</p><p>TC39 seriously considered including <code>const</code> in ES5 and it was in early ES5 drafts. However, there were many issues about how it should be defined and how it interacts with other declarations. Ultimately, there was agreement within TC39 that standardization of <code>const</code> should wait for the “next” edition of the specification where perhaps some of these other problems could also be addressed. Basically, TC39 decided it did not want to standardize on a flawed feature. Instead, it chose to defer any standardization of <code>const</code> for a future where a single improved design could be incorporated into all browsers. 
</p><p>So, what is IE9 doing with <code>const</code>? So far, our decision has been to not support it. It isn’t yet a consensus feature as it has never been available on all browsers. There is no standard specification and there are significant semantic differences among all the existing browser implementation. In addition, we know that TC39 decided not to standardize any of the existing alternatives and wants to reconsider it in the next ECMAScript revisions. 
</p><p>We understand the desire of many web developers to have such a declaration. But we also don’t want to create another situation like conditional function declarations where the feature has to exist but web developers better not use it if they care about browser interoperability. In the end, it seems like the best long term solution for the web is to leave it out and to wait for standardization processes to run their course.</p>
<h4>Principled Decision Making</h4>
<p>These are just four JavaScript specific examples illustrating the sort of decisions we have to make in creating IE9. Many similar issues come up with regard to other web standards and consensus features. For each we perform a similar analysis. What does the standard say? How many websites actually require it? Is it a consensus feature with a common semantics? Are there multiple, incompatible variants of the feature? Is a standards committee working on it? Do any <a href="http://blogs.msdn.com/b/ie/archive/2010/06/25/javascript-same-code-and-a-standardized-test-suite.aspx">test suites</a> exist? Would our adoption help or hinder the standards processes? In the end it is a judgment call, and we try hard to make principled consistent decisions. 
</p><p>Allen Wirfs-Brock<br />Microsoft JavaScript Language Architect</p><div style="clear:both"></div><img src="http://blogs.msdn.com/aggbug.aspx?PostID=10054364" width="1" height="1"/>]]></description>
		<wfw:commentRss>http://blogs.msdn.com/b/ie/archive/2010/08/25/chakra-interoperability-means-more-than-just-standards.aspx/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
