<?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>Mozilla Hacks - the Web developer blog &#187; Feature</title>
	<atom:link href="http://hacks.mozilla.org/category/feature/feed/" rel="self" type="application/rss+xml" />
	<link>http://hacks.mozilla.org</link>
	<description>hacks.mozilla.org</description>
	<lastBuildDate>Wed, 08 Feb 2012 22:52:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Announcing Firefox Aurora 10</title>
		<link>http://hacks.mozilla.org/2011/11/announcing-firefox-aurora-10/</link>
		<comments>http://hacks.mozilla.org/2011/11/announcing-firefox-aurora-10/#comments</comments>
		<pubDate>Fri, 11 Nov 2011 22:34:00 +0000</pubDate>
		<dc:creator>Joe Stagner</dc:creator>
				<category><![CDATA[Aurora]]></category>
		<category><![CDATA[Developer Tools]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[Feature]]></category>
		<category><![CDATA[Featured Article]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[IndexedDB]]></category>
		<category><![CDATA[WebGL]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=10176</guid>
		<description><![CDATA[We&#8217;re happy to announce the availability of Aurora 10. (Download and Test Aurora 10) In additional to the normal improvements that you&#8217;ve come to expect like performance, security and bug fixes, Aurora 10 focuses in HTML5 enhancements. New additions HTML5 Visibility API createProcessingInstruction WebGL antialiasing 3D Transforms Visibility API Document.mozFullScreenEnabled\ Developer Tools Code Editor CSS [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;re happy to announce the availability of Aurora 10. <br/>(<a href="http://www.mozilla.org/en-US/firefox/channel/">Download and Test Aurora 10</a>)</p>
<p>In additional to the normal improvements that you&#8217;ve come to expect like performance, security and bug fixes, Aurora 10 focuses in HTML5 enhancements. </p>
<h2>New additions</h2>
<ul>
<li><a href="https://developer.mozilla.org/en/DOM/Using_the_Page_Visibility_API">HTML5 Visibility API </a></li>
<li><a href="https://developer.mozilla.org/en/DOM/document.createProcessingInstruction">createProcessingInstruction</a></li>
<li>WebGL antialiasing</li>
<li>3D Transforms</li>
<li>Visibility API</li>
<li>Document.mozFullScreenEnabled\</li>
</ul>
<h2>Developer Tools</h2>
<ul>
<li><a title="DevTools/Features/CodeEditor" href="https://wiki.mozilla.org/DevTools/Features/CodeEditor">Code Editor</a></li>
<li><a title="DevTools/Features/RulesView" href="https://wiki.mozilla.org/DevTools/Features/RulesView">CSS Rules View</a></li>
<li><a title="DevTools/Features/Highlighter" href="https://wiki.mozilla.org/DevTools/Features/Highlighter">Page Inspector/Highlighter</a></li>
<li><a title="DevTools/Features/ConsoleObjectCompletion" href="https://wiki.mozilla.org/DevTools/Features/ConsoleObjectCompletion">Console Object Completion</a></li>
<li><a title="DevTools/Features/StyleInspector" href="https://wiki.mozilla.org/DevTools/Features/StyleInspector">Style Inspector</a></li>
</ul>
<p>Aurora 10 also implements incremental enhancements like IndexedDB setVersion API changes. Ongoing detailed attention to evolving specifications help to keep Firefox at the front of the Web revolution. (Read more about <a href="https://developer.mozilla.org/en/IndexedDB/IndexedDB_primer">IndexedDB on MDN</a>.)</p>
<h2>DOM</h2>
<ul>
<li>We now fire a &#8220;load&#8221; event on stylesheet linking when the sheet load finishes or &#8220;error&#8221; if the load fails.</li>
<li>We turn the POSTDATA prompt into an information page (when navigating in session history).</li>
<li>We only forward event attributes on body/frameset to the window if we also forward the corresponding on* property.</li>
<li>We no longer allow more than one call to window.open() when we allow popups.</li>
<li>We fixed a bug where a success callback never fired when a position update is triggered after getCurrentPosition().</li>
<li>We removed replaceWholeText().</li>
<li>We fixed an error with createPattern(zero-size canvas).</li>
<li>We now handle putImageData(nonfinite) correctly.</li>
<li>We now throw INVALID_STATE_ERR when dispatching uninitialized events.</li>
<li>We&#8217;ve made Document.documentURI readonly.</li>
<li>We fixed document.importNode to comply with optional argument omitted.</li>
</ul>
<h2>Web workers</h2>
<ul>
<li>We now allow data URLs.</li>
<li>We implemented event.stopImmediatePropagation in workers.</li>
<li>We made XHR2 response/responseType work in Web Workers.</li>
</ul>
<h2>Graphics</h2>
<ul>
<li>We implement the WebGL OES_standard_derivatives extension.</li>
<li>We implement minimal-capabilities WebGL mode.</li>
</ul>
<h2>JavaScript</h2>
<ul>
<li>The function caller property no longer skips over eval frames.</li>
<li>We fixed E4X syntax so that it is not accepted in ES5 strict mode.</li>
<li>weakmap.set no longer returns itself instead of undefined.</li>
<li>We implemented the battery API.</li>
</ul>
<h2>Offline: IndexedDB enhancements</h2>
<ul>
<li>IndexedDB setVersion API changes</li>
<li>Added support for IDBObjectStore/IDBIndex.count</li>
<li>Various methods accept both keys and KeyRanges.</li>
<li>Added support for IDBCursor.advance.</li>
<li>Implemented deleteDatabase.</li>
<li> objectStoreNames are no longer updated on closed databases when another connection adds or removes object stores</li>
<li>IDBObjectStore.delete and IDBCursor.delete now return undefined.</li>
<li>No longer throws an error if there are unknown properties in the options objects to createObjectStore/createIndex.</li>
<li>We now the errorCode to &#8220;ABORT_ERR&#8221; for all pending requests when IDBTransaction.abort() is called.</li>
<li>Fixed the sort order for indexes.</li>
</ul>
<h2>Layout</h2>
<ul>
<li>We have updated the current rule for handling malformed media queries.</li>
<li>We now support the HTML5 &lt;bdi&gt; element and CSS property unicode-bidi: isolate.</li>
<li>The CSS3 implementation now supports unicode-bidi: plaintext.</li>
</ul>
<h2>Media</h2>
<ul>
<li>Implemented Document.mozFullScreenEnabled.</li>
<li>Enabled the DOM full-screen API on desktop Firefox by default.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2011/11/announcing-firefox-aurora-10/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>CSS 3D transformations in Firefox Nightly</title>
		<link>http://hacks.mozilla.org/2011/10/css-3d-transformations-in-firefox-nightly/</link>
		<comments>http://hacks.mozilla.org/2011/10/css-3d-transformations-in-firefox-nightly/#comments</comments>
		<pubDate>Wed, 26 Oct 2011 20:18:42 +0000</pubDate>
		<dc:creator>Chris Heilmann</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Demo]]></category>
		<category><![CDATA[Feature]]></category>
		<category><![CDATA[Featured Demo]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Standards]]></category>
		<category><![CDATA[Web Developers]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=10017</guid>
		<description><![CDATA[When the first 3D transformations in CSS got support on Webkit browsers people got incredibly excited about them. Now that they have matured we also support 3D CSS in Firefox. To see it for yourself, check out one of the latest nightly builds. You can see them in action in this demo of a rotating [...]]]></description>
			<content:encoded><![CDATA[<p>When the first 3D transformations in CSS got support on Webkit browsers people got incredibly excited about them. Now <a href="http://dev.w3.org/csswg/css3-3d-transforms/">that they have matured</a> we also support 3D CSS in Firefox. To see it for yourself, check out <a href="http://nightly.mozilla.org">one of the latest nightly builds</a>. </p>
<p>You can see them in action in <a href="http://thewebrocks.com/demos/html5-3d-css">this demo of a rotating HTML5 logo</a> and the screencast below:</p>
<p><video controls preload="none" style="width:100%;height:300px;" poster="http://cf.cdn.vid.ly/5l3j6a/poster.jpg"><source src="http://cf.cdn.vid.ly/5l3j6a/mp4.mp4" type="video/mp4"><source src="http://cf.cdn.vid.ly/5l3j6a/webm.webm" type="video/webm"><source src="http://cf.cdn.vid.ly/5l3j6a/ogv.ogv" type="video/ogg"><a target='_blank' href='http://vid.ly/5l3j6a'><img   src='http://cf.cdn.vid.ly/5l3j6a/poster.jpg' width="500"></a></video></p>
<p>This means now that we need your support in trying out CSS 3D examples in Firefox and add other extensions than <code>-webkit-</code> to your CSS 3D products and demos. To show that this is possible, we took the well-known <a href="http://www.webkit.org/blog-files/3d-transforms/poster-circle.html">webkit-only &#8220;poster circle&#8221; demo</a> and made it work with Firefox nightly by adding the -moz- (and of course the other prefixes and one set of instructions without browser prefixes). Here is a slight excerpt:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">-webkit-transform-style<span style="color: #00AA00;">:</span> preserve-3d<span style="color: #00AA00;">;</span>
-moz-transform-style<span style="color: #00AA00;">:</span> preserve-3d<span style="color: #00AA00;">;</span>
-o-transform-style<span style="color: #00AA00;">:</span> preserve-3d<span style="color: #00AA00;">;</span>
-ms-transform-style<span style="color: #00AA00;">:</span> preserve-3d<span style="color: #00AA00;">;</span>
transform-style<span style="color: #00AA00;">:</span> preserve-3d<span style="color: #00AA00;">;</span></pre></div></div>

<p>You can see this in action in the screencast below alongside Chrome and you <a href="http://thewebrocks.com/demos/postercircle/">try the demo out yourself</a>. The slight jerkiness is actually my MacBook Air impersonating a starting jet every time I use ScreenFlow and not the browser.</p>
<p><video controls preload="none" style="width:100%;height:300px;" poster="http://cf.cdn.vid.ly/4m8d9f/poster.jpg"><source src="http://cf.cdn.vid.ly/4m8d9f/mp4.mp4" type="video/mp4"><source src="http://cf.cdn.vid.ly/4m8d9f/webm.webm" type="video/webm"><source src="http://cf.cdn.vid.ly/4m8d9f/ogv.ogv" type="video/ogg"><a target='_blank' href='http://vid.ly/4m8d9f'><img   src='http://cf.cdn.vid.ly/4m8d9f/poster.jpg' width="500"></a></video></p>
<p>To celebrate the release and to show how CSS 3D can be applied as subtle effect, have a <a href="http://thewebrocks.com/demos/browsermemory/">game of pairs using your favourite browsers (and a cat)</a> : </p>
<p><a href="http://thewebrocks.com/demos/browsermemory/"><img src="http://farm7.static.flickr.com/6112/6283741113_b3604d4ee5_o.jpg" alt="browser pairs"></a></p>
<p>Oleg Romashin also spent some time to <a href="http://romaxa.bolshe.net/css3d/">convert a few CSS 3D demos to work with Mozilla</a> and you can <a href="http://m8y.org/tmp/cubiq.org/dropbox/3dcity/index2.html">check the 3D city</a> for more &#8220;wow&#8221;.</p>
<p>If you are new to CSS 3D transformations <a href="http://24ways.org/2010/intro-to-css-3d-transforms">here&#8217;s a good beginner course</a> and <a href="http://www.westciv.com/tools/3Dtransforms/index.html">a tool to create them</a>. </p>
<p>The rotating HTML5 logo demo also shows how you can check if the currently used browser supports 3D transforms. Instead of repeating the animation frames for all the prefixes we test in JavaScript and create the CSS on the fly:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> checksupport<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> props <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'perspectiveProperty'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'WebkitPerspective'</span><span style="color: #339933;">,</span>
               <span style="color: #3366CC;">'MozPerspective'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'OPerspective'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'msPerspective'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
      i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span>
      support <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span>props<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>props<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #000066; font-weight: bold;">in</span> form.<span style="color: #660066;">style</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      support <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
      pfx <span style="color: #339933;">=</span> props<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Perspective'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      pfx <span style="color: #339933;">=</span> pfx.<span style="color: #660066;">toLowerCase</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    i<span style="color: #339933;">++;</span>
  <span style="color: #009900;">&#125;</span> 
  <span style="color: #000066; font-weight: bold;">return</span> support<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>checksupport<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> s <span style="color: #339933;">=</span> <span style="color: #3366CC;">''</span><span style="color: #339933;">;</span>
  styles <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'style'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  s <span style="color: #339933;">+=</span> <span style="color: #3366CC;">'#stage{-'</span><span style="color: #339933;">+</span> pfx <span style="color: #339933;">+</span><span style="color: #3366CC;">'-perspective: 300px;}'</span><span style="color: #339933;">+</span>
       <span style="color: #3366CC;">'#logo{-'</span><span style="color: #339933;">+</span> pfx <span style="color: #339933;">+</span><span style="color: #3366CC;">'-transform-style: preserve-3d;position:relative;}'</span><span style="color: #339933;">+</span>  
       <span style="color: #3366CC;">'#logo.spin{-'</span><span style="color: #339933;">+</span> pfx <span style="color: #339933;">+</span><span style="color: #3366CC;">'-animation: spin 3s infinite linear;}'</span><span style="color: #339933;">+</span>
       <span style="color: #3366CC;">'@-'</span><span style="color: #339933;">+</span> pfx <span style="color: #339933;">+</span><span style="color: #3366CC;">'-keyframes spin {'</span><span style="color: #339933;">+</span>  
       <span style="color: #3366CC;">'0% {'</span><span style="color: #339933;">+</span> 
       <span style="color: #3366CC;">'-'</span><span style="color: #339933;">+</span> pfx <span style="color: #339933;">+</span><span style="color: #3366CC;">'-transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);'</span><span style="color: #339933;">+</span>   
       <span style="color: #3366CC;">'}'</span><span style="color: #339933;">+</span>
       <span style="color: #3366CC;">'100% {'</span><span style="color: #339933;">+</span>   
       <span style="color: #3366CC;">'-'</span><span style="color: #339933;">+</span> pfx <span style="color: #339933;">+</span><span style="color: #3366CC;">'-transform: rotateX(0deg) rotateY(360deg)'</span><span style="color: #339933;">+</span>
       <span style="color: #3366CC;">' rotateZ(360deg);'</span><span style="color: #339933;">+</span> 
       <span style="color: #3366CC;">'}}'</span><span style="color: #339933;">;</span>
  styles.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> s<span style="color: #339933;">;</span>
  document.<span style="color: #660066;">querySelector</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'head'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>styles<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>For more information on creating your own pages that use 3D transformations, take a look at the <a href="http://dev.w3.org/csswg/css3-3d-transforms/">draft specification</a></p>
<p>As always, If you find any bugs, please report them at <a href="https://bugzilla.mozilla.org">bugzilla.mozilla.org</a>!</p>
<p>So please reward our hard work bringing the third dimension to Firefox&#8217;s CSS engine by supporting and testing. Cheers!</p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2011/10/css-3d-transformations-in-firefox-nightly/feed/</wfw:commentRss>
		<slash:comments>34</slash:comments>
<enclosure url="http://cf.cdn.vid.ly/5l3j6a/mp4.mp4" length="6843288" type="video/mp4" />
<enclosure url="http://cf.cdn.vid.ly/5l3j6a/webm.webm" length="6684672" type="video/webm" />
<enclosure url="http://cf.cdn.vid.ly/5l3j6a/ogv.ogv" length="6626659" type="video/ogg" />
<enclosure url="http://cf.cdn.vid.ly/4m8d9f/mp4.mp4" length="6138097" type="video/mp4" />
<enclosure url="http://cf.cdn.vid.ly/4m8d9f/webm.webm" length="6887958" type="video/webm" />
<enclosure url="http://cf.cdn.vid.ly/4m8d9f/ogv.ogv" length="13626193" type="video/ogg" />
		</item>
		<item>
		<title>Ben Adida on BrowserID and identity</title>
		<link>http://hacks.mozilla.org/2011/10/ben-adida-on-browserid-and-identity/</link>
		<comments>http://hacks.mozilla.org/2011/10/ben-adida-on-browserid-and-identity/#comments</comments>
		<pubDate>Thu, 20 Oct 2011 13:55:11 +0000</pubDate>
		<dc:creator>Tristan Nitot</dc:creator>
				<category><![CDATA[Feature]]></category>
		<category><![CDATA[Featured Article]]></category>
		<category><![CDATA[Identity]]></category>
		<category><![CDATA[Mission:Mozilla]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=9842</guid>
		<description><![CDATA[This is the second installment of Mission:Mozilla, a series of interviews that link Mozillians, the technology they produce and the Mozilla mission. Today Ben Adida is in the hot seat to discuss BrowserID, Mozilla&#8217;s identity initiative. Tristan Nitot &#8211; Hi Ben, can you briefly introduce yourself? Ben Adida &#8211; I&#8217;ve been hacking since high school [...]]]></description>
			<content:encoded><![CDATA[<p>This is the second installment of Mission:Mozilla, a series of interviews that link Mozillians, the technology they produce and the Mozilla mission. Today Ben Adida is in the hot seat to discuss <a href="https://browserid.org/">BrowserID</a>, Mozilla&#8217;s identity initiative. </p>
<p><a href="http://hacks.mozilla.org/2011/10/ben-adida-on-browserid-and-identity/ben-adida/" rel="attachment wp-att-9848"><img src="http://hacks.mozilla.org/wp-content/uploads/2011/10/IMG_0200-e1319118655736.jpg" alt="" title="Ben Adida" width="300" height="450" class="alignright size-full wp-image-9848" /></a></p>
<p><em>Tristan Nitot &#8211; Hi Ben, can you briefly introduce yourself?</em></p>
<p>Ben Adida &#8211; I&#8217;ve been hacking since high school and, since college, I&#8217;ve been fascinated with cryptography, security, and controlling my data. I built my first DB-backed web site before cookies. I ran my own IMAP mail server starting in 1997 because no one else was doing it the way I wanted it. I started an open-source web dev shop in 2000, went back to grad school in 2003 to work on secure voting, explored security and privacy of health data at Harvard Med for a few years, and joined Mozilla in March 2011. I&#8217;m now Tech Lead on Identity and User Data, and I&#8217;m having a blast.</p>
<p><em>TN &#8211; Oh my&#8230; running your own IMAP server in 1997? That&#8217;s the kind of thing that gives instant nerd credibility ;-)</em></p>
<p>BA &#8211; Oh yes, big nerd and proud of it! </em></p>
<p><em>TN &#8211; So you&#8217;re now with Mozilla, focusing on Identity and User data. Can you update us on what&#8217;s Mozilla is doing on these fronts?</em></p>
<p>BA &#8211; Everyone I talk to within Mozilla realizes that the Open Web depends on more than just the Firefox web browser. People are storing massive quantities of their personal data online, using dozens of services, and an open browser is not enough to ensure that they have true choice, true control, that they can shape the Web to their liking. So we need to be working towards providing user choice in web-based services, too. The first piece of the puzzle is a usable, federated, and distributed identity system. That&#8217;s what we&#8217;re doing with BrowserID.</p>
<p><em>TN &#8211; &#8220;federated, distributed&#8221;, with users having control&#8230; Sounds like the original pillars of the Web, right? I mean, as opposed to what we tend to see these days, with identity being concentrated into the hands of very large commercial organizations&#8230; How do you plan to achieve this?</em></p>
<p>BA &#8211; That&#8217;s right, distributed/federated *is* the way of the Web, but when you look at today&#8217;s identity solutions, most are incredibly centralized, and those that are more distributed in terms of protocol tend to become centralized in implementation because of the so-called NASCAR problem: you get to log in with Google or Yahoo, and if you&#8217;re *really* knowledgeable then maybe you can log in with your own Identity Provider. We think we can do better for users and developers in terms of ease of use and adoption.</p>
<p><em>TN &#8211; And what about privacy?</em></p>
<p>BA &#8211; We&#8217;ve specifically designed BrowserID to reduce the amount of private data that changes hands to the bare minimum required for authentication. For example, in every other web-based identity system today, the site you log into phones home to your identity provider. In the real world, the equivalent is: you check into a hotel, present your ID to confirm your name, and the receptionist calls the issuing government agency and says &#8220;Hi, this is the Hyatt San Francisco, Tristan is checking in just now, is that okay?&#8221; Why does the government agency or, in the case of a privately issued identifier, the commercial entity, need to know where and when you&#8217;re checking in? In the real world, the receptionist just checks the seal on the ID without phoning anyone. BrowserID recreates this more restrained, more privacy-protecting data flow for web logins.</p>
<p><em>TN &#8211; So how do you manage to get the best of both worlds: user experience and user control?</em></p>
<p>BA &#8211; First we&#8217;re making the browser an important part of the protocol. After all, the browser is the User&#8217;s Agent. Isn&#8217;t it a little bit silly on today&#8217;s Web that you typically have a tab open to your gmail, and then another site asks you to log in with Google or Yahoo? Why can&#8217;t the browser help coordinate those two tabs? You&#8217;re logged into gmail, of course you have a gmail email address you can use to authenticate! And in the enterprise setting, you&#8217;re logged into your company webmail, of course you can authenticate using that enterprise identity! The browser can help reduce user complexity significantly.</p>
<p><em>TN &#8211; But I could want to use another email address, than the one I use for my Webmail&#8230;</em></p>
<p>BA &#8211; Right, so we&#8217;re always going to give users a choice. Users can choose exactly which persona they want to present. And one major BrowserID design point is simply that users understand email addresses as personas. They typically have home and work email addresses, and they don&#8217;t use them the same way. If they have a moonlighting job, they often have a separate email address for that. So BrowserID is based on this concept users already understand: logging in is simply delivering an email address to a web site in a way that the web site can easily verify.</p>
<p><em>TN &#8211; Cool. Say I&#8217;m a Web developer that wants to use BrowserID on my site. How hard is that? How much do I have to relinquish control of my users to Mozilla?</em></p>
<p>BA &#8211; It takes about 5 lines of JavaScript and 10 lines of backend code to integrate BrowserID, and it works today. It&#8217;s by far the easiest of the available identity solutions. In the short term, it means you&#8217;re relying on Mozilla servers to provide the BrowserID interface and verify users&#8217; email addresses. That said, this is only temporary scaffolding for our distributed system. </p>
<p><em>TN &#8211; But as BrowserID becomes native in browsers and identity providers appear, this will change?</em></p>
<p>BA &#8211; We&#8217;ve taken great care to design the system so that, as browsers begin to support the BrowserID APIs natively, we can remove our scaffolding and leave standing a truly distributed protocol. Best of all, web sites don&#8217;t have to change a line of code for that to happen: as the identity providers and browsers start supporting BrowserID, our scaffolding automatically fades away. And let&#8217;s say you&#8217;re a web developer and you want to stop using BrowserID for whatever reason: just send your users an email with their new password, and you&#8217;re done. No other identity system minimizes lock-in this much, for both users and web developers.</p>
<p><em>TN &#8211; So minimizing lock-in is part of the BrowserID design goals?</em></p>
<p>BA &#8211; Absolutely! This is part of our mission and <a href="https://www.mozilla.org/about/manifesto.en.html">manifesto</a>. We don&#8217;t want to own users, we want to empower them. Mozilla is in a unique position to build this kind of identity system because, as we all like to say, Mozilla answers only to users, and we can leverage Firefox to deploy these pro-user designs.</p>
<p><em>TN &#8211; Fantastic! What would you recommend to Websites who want to do a test-run on their site? And for users who want to experience BrowserID right away?</em></p>
<p>BA &#8211; Web developers can check out our <a href="https://github.com/mozilla/browserid/wiki/How-to-Use-BrowserID-on-Your-Site">documentation</a>. Users can check out <a href="http://current.openphoto.me/">http://current.openphoto.me</a>, a very promising distributed photo storage system shepherded by <a href="http://webfwd.org/">WebFWD</a> that chose BrowserID. Just click the distinctive BrowserID login button to get a taste of the user experience.</p>
<p><em>TN &#8211; I&#8217;m sure our readers will try it right away! Thanks a lot Ben for your time. Long live BrowserID!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2011/10/ben-adida-on-browserid-and-identity/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Introducing Aurora 9</title>
		<link>http://hacks.mozilla.org/2011/09/introducing-aurora-9/</link>
		<comments>http://hacks.mozilla.org/2011/09/introducing-aurora-9/#comments</comments>
		<pubDate>Fri, 30 Sep 2011 22:22:45 +0000</pubDate>
		<dc:creator>Robert Nyman</dc:creator>
				<category><![CDATA[Aurora]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[Feature]]></category>
		<category><![CDATA[Featured Article]]></category>
		<category><![CDATA[Firefox 9]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[XMLHttpRequest]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=9688</guid>
		<description><![CDATA[We have just released Aurora 9 (download and test Aurora 9), which is planned to be the upcoming Firefox 9. In it, we have a number of new things that we hope will get you excited! JavaScript Type Inference We&#8217;ve improved JavaScript performance once again with type inference. We&#8217;ve made significant improvements on both the [...]]]></description>
			<content:encoded><![CDATA[<p>We have just released Aurora 9 (<a href="http://www.mozilla.org/en-US/firefox/channel/">download and test Aurora 9</a>), which is planned to be the upcoming Firefox 9. In it, we have a number of new things that we hope will get you excited!</p>
<p><span id="more-9688"></span></p>
<h2>JavaScript Type Inference</h2>
<p>We&#8217;ve improved JavaScript performance once again with type inference. We&#8217;ve made significant improvements on both the V8 and Kraken benchmarks, and you should see real-world improvements to JavaScript performance as well.</p>
<h2>JavaScript Interface for Do Not Track</h2>
<p>Firefox 4 introduced <a href="https://developer.mozilla.org/en/The_Do_Not_Track_Field_Guide/Introduction/How_Do_Not_Track_works">Do Not Track</a>, and now there is a way to detect a users&#8217;prefence through JavaScript as well:</p>
<p><iframe style="width: 100%; height: 100px;" src="http://jsfiddle.net/robnyman/cFqXk/1/embedded/" width="320" height="240"></iframe></p>
<h2>mouseenter and mouseleave events</h2>
<p>For some time now, <a href="http://www.quirksmode.org/dom/events/mouseover.html">web developers have been struggling</a> with handling <code>mouseover</code> and <code>mouseout</code> events on elements, since when child elements have gained focus, the event has bubbled up and triggered <code>mouseout</code> on the parent element &#8211; something you would in most cases not like to happen.</p>
<p>Therefore, we are now happy to introduce support for <code>mouseenter</code> and <code>mouseleave</code> events:</p>
<p><iframe style="width: 100%; height: 300px;" src="http://jsfiddle.net/robnyman/ZVTa2/12/embedded/" width="320" height="240"></iframe></p>
<h2>Camera UI for Mobile</h2>
<p>You can now use an input element to trigger a native app to take pictures. Please try the <a href="http://jsbin.com/iwerow/27/">Camera UI for Mobile demo</a>.</p>
<h2>Support for chunked XMLHttpRequest</h2>
<p>When doing XMLHttpRequest requests with large data sets, you can now <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=687087">get partial data</a> as it arrives instead of waiting for it all to show up. You can use this to build more responsive and more efficient web sites.</p>
<h2>Other changes</h2>
<p>We&#8217;ve also got support for a bunch of other changes as well.  These will be added to the <a href="https://developer.mozilla.org/en/Firefox_9_for_developers">Firefox 9 for Developers page over the next few weeks.</a></p>
<div class="changelog">
<h4>HTML</h4>
<ul>
<li>We now support <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=654352">document.caretPositionFromPoint</a>
<li>We now support <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=683852">Node.contains(node)</a>
<li>We now <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=685139">return true for node.contains(node)</a>, as other browsers do.  (The spec says we should return false but the spec is probably wrong given the behaviour of all browsers.)
<li>We now support <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=685798">Node.parentElement</a>
<li>We no longer <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=685518">taint the canvas data when drawing images where @crossorigin is set on them</a>
<li>We now only <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=682554">fire onreadystatechange on the document element</a>
<li>There is now <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=605365">UI for HTML5 Forms Validation in Fennec</a>
<li>We now fire <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=185236">load and error events on stylesheet link elements that are loaded dynamically</a>
<li>We now support <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=543789">DOM3 composition events</a>
</ul>
</div>
<div class="changelog">
<h4>Graphics</h4>
<ul>
<li>We now support <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=600556">Vista-style ICO files</a></li>
<li>We now <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=573583">decode images only when drawing them</a>, instead of ahead of time</li>
</ul>
</div>
<div class="changelog">
<h4>Layout</h4>
<ul>
<li>We now support the <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=446569">CSS3 columns shorthand where column-count and column-width can be combined</a>
<li>We now support <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=677582">CSS3 text-overflow: &lt;left&gt; &lt;right&gt;</a>
<li>We now support the font-stretch property (<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=3512">bug number 3512, filed in 1999!</a>)
<li>You can now use <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=688405">65534 rowspans instead of 8190</a>, to match IE.
</ul>
</div>
<div class="changelog">
<h4>Video</h4>
<ul>
<li>We now support <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=648595">temporal media URIs for HTML5 video</a>.</li>
</ul>
</div>
<div class="changelog">
<h4>Network</h4>
<ul>
<li>We&#8217;ve changed the way we handle <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=665706">semicolons during URL parsing</a></li>
<li>We no longer pop up a <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=423506">download dialog bog when a server returns no data</a> and instead show a corrupted content error, to match other browsers.</li>
<li>We&#8217;ve made some <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=686312">minor</a> <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=687243">protocol</a> fixes to WebSockets</li>
<li>If you include an <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=272541">empty disposition type it&#8217;s treated as an &#8220;attachment&#8221;</a></li>
<li>We don&#8217;t <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=255119">show redirect content after denying automatic redirect to javascript: URL</a></li>
</ul>
</div>
<div class="changelog">
<h4>Tools</h4>
<ul>
<li>We now <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=612658">cache data for the window.console API</a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2011/09/introducing-aurora-9/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>Lights, Camera, Action! July Dev Derby is all about HTML5 Video!</title>
		<link>http://hacks.mozilla.org/2011/07/lights-camera-action-july-dev-derby-is-all-about-html5-video/</link>
		<comments>http://hacks.mozilla.org/2011/07/lights-camera-action-july-dev-derby-is-all-about-html5-video/#comments</comments>
		<pubDate>Fri, 01 Jul 2011 21:16:04 +0000</pubDate>
		<dc:creator>Chris Heilmann</dc:creator>
				<category><![CDATA[Dev Derby]]></category>
		<category><![CDATA[Feature]]></category>
		<category><![CDATA[Featured Article]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[competition]]></category>
		<category><![CDATA[devderby]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=8608</guid>
		<description><![CDATA[Show off your coolest video hack in July&#8217;s Mozilla Dev Derby! Moving pictures have always fascinated people. From the first zoetropes to the multi million dollar blockbusters of today &#8211; seeing things move grabs our attention as humans much better than any clever copy or imagery could. Video was alien to the web for a [...]]]></description>
			<content:encoded><![CDATA[<p>Show off your coolest video hack in July&#8217;s <a href="https://developer.mozilla.org/en-US/demos/devderby">Mozilla Dev Derby</a>!</p>
<p>Moving pictures have always fascinated people. From the first <a href="http://www.youtube.com/watch?v=kN9DD8jtXAo">zoetropes</a> to the multi million dollar blockbusters of today &#8211; seeing things move grabs our attention as humans much better than any clever copy or imagery could. Video was alien to the web for a long time. Well, not alien, but we needed plugins to make them play. With newer browsers and HTML5, we now have the <code>&lt;video&gt;</code> element to natively embed video in a web page. This allows us to, amongst other things:</p>
<ul>
<li>Style video elements with CSS and SVG</li>
<li>Make the video interact with other elements of the document and vice versa</li>
<li>Use Canvas to grab frames from videos and manipulate them</li>
<li>Create accessible video as the controls can be used with a keyboard without us having to write that functionality</li>
</ul>
<p>Using this arsenal, you can do pretty cool things. You can:</p>
<ul>
<li><a href="http://hacks.mozilla.org/2011/01/zooming-and-rotating-for-video-in-html5-and-css3/">write a player that rotates and zooms video</a> (<a href="https://github.com/codepo8/rotatezoomHTML5video">source on GitHub</a>)</li>
<li>Build your own <a href="http://hacks.mozilla.org/2010/12/spirit-of-indiana-jones-syncing-html5-video-with-maps/">Indiana Jones style maps</a> (<a href="https://github.com/codepo8/HTML5---map-and-video-syncing">GitHub</a>)</li>
<li><a href="http://people.mozilla.com/~prouget/demos/round/index.xhtml">Put your colleagues in a washing machine</a></li>
<li><a href="http://people.mozilla.com/~prouget/demos/green/green.xhtml">Simulate a green screen</a></li>
<li><a href="http://people.mozilla.com/~prouget/demos/mashup/video.xhtml">Apply CSS3 and SVG filters and transitions to video</a></li>
<li><a href="http://people.mozilla.com/~prouget/demos/DynamicContentInjection/play.xhtml">Inject other content into videos</a></li>
<li><a href="http://html5doctor.com/video-canvas-magic/">Stretch a video over the whole screen</a></li>
<li><a href="http://www.youtube.com/watch?v=sSLcsHAuiF8">Use video in a 3D environment</a></li>
<li><a href="https://github.com/codepo8/videograbber">Allow users to take screengrabs of videos</a> (<a href="https://github.com/codepo8/videograbber">source on GitHub</a>)</ul>
<p> ..and many more things.</p>
<p>Now it is your turn to show us what you can do with HTML5 video! We don&#8217;t expect you to build another <a href="http://www.thewildernessdowntown.com/">Wilderness Downtown</a> or <a href="http://ro.me">3 Dreams of Black</a>, but we are very excited to offer you the chance to shine in July&#8217;s <a href="https://developer.mozilla.org/en-US/demos/devderby">Mozilla Dev Derby</a>.</p>
<p>Why not use CSS3 and Canvas to redesign the <a href="http://www.youtube.com/watch?v=8CtjhWhw2I8">Outer Limits intro</a>? Why not make the video do the things Diana Ross talks about in <a href="http://www.youtube.com/watch?v=4GtyMeEcPPE">Upside down</a>? Why not build a video cropping tool in Canvas? How about you have a crack at making closed captioning and subtitling work with HTML5 video? There are many ideas floating about &#8211; it just needs a bit of drive and a text editor to go for it. So, show us what you can do! </p>
<p>There are a lot of tools out there to make your life easier with HTML5 video. <a href="http://vid.ly">Vid.ly</a> makes it easy to convert videos, <a href="http://popcornjs.org/">Popcorn.js</a> is a library to sync page content and video and there are many <a href="http://html5doctor.com/tag/video/">tutorials on video</a> available.</p>
<p>To get you into the mood and see some examples in action, we are running an <a href="http://hacks.mozilla.org/2011/06/webinar-deconstructing-html5-video/">HTML5 video webinar</a> on the 14th of July and you can ask some questions you have upfront <a href="https://www.google.com/moderator/#16/e=9ae94">using Google Moderator</a>.</p>
<p>Bring the web screen alive, I dare you! I am off to watch <a href="http://www.imdb.com/title/tt0095765/">Cinema Paradiso</a> again.</p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2011/07/lights-camera-action-july-dev-derby-is-all-about-html5-video/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Firefox 4 Demos: Awesome CSS3 Planetarium</title>
		<link>http://hacks.mozilla.org/2011/03/css3-planetarium/</link>
		<comments>http://hacks.mozilla.org/2011/03/css3-planetarium/#comments</comments>
		<pubDate>Wed, 16 Mar 2011 16:55:09 +0000</pubDate>
		<dc:creator>Paul Rouget</dc:creator>
				<category><![CDATA[@font-face]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Demo]]></category>
		<category><![CDATA[Feature]]></category>
		<category><![CDATA[Featured Article]]></category>
		<category><![CDATA[Featured Demo]]></category>
		<category><![CDATA[Firefox 4]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=7585</guid>
		<description><![CDATA[O hai pixel lovers! Check out this gorgeous CSS3 demo: Planetarium, by the LittleWorkshop team (@glecollinet &#38; @whatthefranck). Screencast: Youtube link. Gorgeous Animations The principal feature show-cased in this demo is CSS3 Transitions. The animation between the welcome-screen and the planet-screen, and the animation between the different planets are powered by transitions. But there are [...]]]></description>
			<content:encoded><![CDATA[<p><em>O hai pixel lovers! Check out this gorgeous CSS3 demo: <a href="http://mozillademos.org/demos/planetarium/demo.html">Planetarium</a>, by the <a href="http://www.littleworkshop.fr/">LittleWorkshop</a> team (<a href="http://twitter.com/#!/glecollinet/">@glecollinet</a> &amp; <a href="http://twitter.com/#!/whatthefranck/">@whatthefranck</a>).</em></p>
<p><a href="http://mozillademos.org/demos/planetarium/demo.html"><img src="http://hacks.mozilla.org/wp-content/uploads/2011/03/screenshot1.jpg" alt="planetarium" title="planetarium" class="aligncenter"></a></p>
<p><strong>Screencast:</strong><br />
<iframe type="text/html" width="500" height="360" src="http://www.youtube.com/embed/fT6amnMTrVk" frameborder="0"></iframe><br />
<em><a href="http://www.youtube.com/watch?v=fT6amnMTrVk">Youtube link</a>.</em></p>
<h2>Gorgeous Animations</h2>
<p>The principal feature show-cased in this demo is <a href="https://developer.mozilla.org/en/CSS/CSS_transitions">CSS3 Transitions</a>. The animation between the welcome-screen and the planet-screen, and the animation between the different planets are powered by transitions. But there are many little effects in this demo. Take a look at the Twitter button, the ruler, the credit page or the back button. These effects are CSS3 Transitions too.</p>
<p><img src="http://hacks.mozilla.org/wp-content/uploads/2011/03/side.png" title="transition effect" width="250" style="float: right; margin: 5px;" /></p>
<p>Another interesting detail. Next to the planet, you have some different animations. The way the animations is played depends on if you&#8217;re coming from the left, the right or from the home screen.</p>
<p>Try it yourself: Click on the planet Earth, from the home screen. See the text &#8220;falling&#8221; from the top? Now, go to Mars, and come back to Earth. Now the text is &#8220;flying&#8221; from the right. Designers will love that :)</p>
<h2>Beautiful fonts</h2>
<p><a href="https://developer.mozilla.org/en/css/@font-face">@font-face</a> allows you to use your own font for creative design. Combined with <a href="https://developer.mozilla.org/fr/CSS/text-shadow">text-shadow</a> and <a href="https://developer.mozilla.org/en/CSS/-moz-font-feature-settings">font-feature-settings</a>, you can accurately forge and style your typographic content.<br />
<img src="http://hacks.mozilla.org/wp-content/uploads/2011/03/fontface1-500x222.png" alt="" title="fontface1" width="500" height="222" class="aligncenter size-large wp-image-7603" /></p>
<h2>Your turn!</h2>
<p>These are features you can use today.<br />
This demo works perfectly in Firefox 4, Safari and Chrome. Also, Transitions and font-face are easily degradable. Go. Check out <a href="https://github.com/littleworkshop/planetarium">the source code</a>, read <a href="https://developer.mozilla.org/en/CSS">the documention</a>, and if you&#8217;re proud of your code, feel free to <a href="https://developer.mozilla.org/demos/">submit a demo</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2011/03/css3-planetarium/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>Firefox 4 Beta 2 is here &#8211; Welcome CSS3 transitions</title>
		<link>http://hacks.mozilla.org/2010/07/firefox4-beta2/</link>
		<comments>http://hacks.mozilla.org/2010/07/firefox4-beta2/#comments</comments>
		<pubDate>Tue, 27 Jul 2010 19:34:41 +0000</pubDate>
		<dc:creator>Paul Rouget</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Demo]]></category>
		<category><![CDATA[Feature]]></category>
		<category><![CDATA[Featured Article]]></category>
		<category><![CDATA[Featured Demo]]></category>
		<category><![CDATA[Firefox 4]]></category>
		<category><![CDATA[Performance]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=5262</guid>
		<description><![CDATA[As we have explained before, Mozilla is now making more frequent updates to our beta program. So here it is, Firefox Beta 2 has just been released, 3 weeks after Beta 1. Firefox 4 Beta 1 already brought a large amount of new features (see the Beta 1 feature list). So what&#8217;s new for web [...]]]></description>
			<content:encoded><![CDATA[<p>As we have <a href="https://hacks.mozilla.org/2010/07/firefox-4-beta-1-is-here-whats-in-it-for-web-developers/">explained before</a>, Mozilla is now making more frequent updates to our beta program. So here it is, <a href="http://www.mozilla.com/en-US/firefox/beta/">Firefox Beta 2</a> has just been released, 3 weeks after Beta 1.</p>
<p>Firefox 4 Beta 1 already brought a large amount of new features (<a href="https://hacks.mozilla.org/2010/07/firefox-4-beta-1-is-here-whats-in-it-for-web-developers/">see the Beta 1 feature list</a>). So what&#8217;s new for web developers in this beta?</p>
<h2>Performance &amp; CSS3 Transitions</h2>
<p>The two major features for web developers with this release are <strong>Performance improvements and CSS3 Transitions on CSS3 Transforms</strong>.</p>
<p><iframe width="500" height="385" src="http://www.youtube.com/embed/gFmuNApHFec" frameborder="0"></iframe></p>
<p><em>This video is hosted by Youtube and uses the HTML5 video tag if you have enabled it (<a href="http://www.youtube.com/html5">see here</a>). Youtube video <a href="http://www.youtube.com/watch?v=gFmuNApHFec">here</a>.</em></p>
<p><strong>Performance: </strong>In this new Beta, Firefox comes with a new page building&nbsp;mechanism: <a href="http://weblogs.mozillazine.org/roc/archives/2010/07/retained_layers.html">Retained Layers</a>. This mechanism provides noticeable faster speed for web pages with dynamic content, and scrolling is much smoother. Also, we&#8217;re still experimenting with hardware acceleration: using the GPU to render and build some parts of the web page.</p>
<p><strong>CSS3 Transitions on transforms:</strong> The major change for web developers is probably CSS3 Transitions on CSS3 Transformations.</p>
<p>CSS3 Transitions provide a way to animate changes to CSS properties, instead of having the changes take effect instantly. <a href="https://developer.mozilla.org/en/CSS/CSS_transitions">See the documentation</a> for details.</p>
<p>This feature was available in Firefox 4 Beta 1, but in this new Beta, you can use Transitions on Transformation.</p>
<p>A CSS3 Transformation allows you to define a Transformation (scale, translate, skew) on any HTML element. And you can animate this transformation with the transitions.</p>
<style>
#victim {   padding: 10px;   width: 250px;   background-color: yellow;   color: black;   -moz-transition-duration: 1s;   -moz-transform: rotate(5deg);   -webkit-transition-duration: 1s;   -webkit-transform: rotate(5deg);   -o-transition-duration: 1s;   -o-transform: rotate(5deg);   transition-duration: 1s;   transform: rotate(5deg); } #victim:hover {   background-color: red;   color: white;   -moz-transform:  rotate(350deg) scale(1.4) rotate(-30deg);   -webkit-transform:  rotate(350deg) scale(1.4) rotate(-30deg);   -o-transform:  rotate(350deg) scale(1.4) rotate(-30deg);   transform:  rotate(350deg) scale(1.4) rotate(-30deg); }
</style>
<div id="victim">
See this box? Move your mouse over it, and its position <code>transform: rotate(5deg);</code> will transform <code>transform:  rotate(350deg) scale(1.4) rotate(-30deg);</code> through a smooth animation.
</div>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#victim</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">yellow</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">black</span><span style="color: #00AA00;">;</span>
&nbsp;
  transition-duration<span style="color: #00AA00;">:</span> 1s<span style="color: #00AA00;">;</span>
  transform<span style="color: #00AA00;">:</span> rotate<span style="color: #00AA00;">&#40;</span>10deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">/* Prefixes */</span>
&nbsp;
  -moz-transition-duration<span style="color: #00AA00;">:</span> 1s<span style="color: #00AA00;">;</span>
  -moz-transform<span style="color: #00AA00;">:</span> rotate<span style="color: #00AA00;">&#40;</span>5deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
&nbsp;
  -webkit-transition-duration<span style="color: #00AA00;">:</span> 1s<span style="color: #00AA00;">;</span>
  -webkit-transform<span style="color: #00AA00;">:</span> rotate<span style="color: #00AA00;">&#40;</span>10deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
&nbsp;
  -o-transition-duration<span style="color: #00AA00;">:</span> 1s<span style="color: #00AA00;">;</span>
  -o-transform<span style="color: #00AA00;">:</span> rotate<span style="color: #00AA00;">&#40;</span>10deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#victim</span><span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">red</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span>
&nbsp;
  transform<span style="color: #00AA00;">:</span>  rotate<span style="color: #00AA00;">&#40;</span>350deg<span style="color: #00AA00;">&#41;</span> scale<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1.4</span><span style="color: #00AA00;">&#41;</span> rotate<span style="color: #00AA00;">&#40;</span>-30deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">/* Prefixes */</span>
&nbsp;
  -moz-transform<span style="color: #00AA00;">:</span>  rotate<span style="color: #00AA00;">&#40;</span>350deg<span style="color: #00AA00;">&#41;</span> scale<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1.4</span><span style="color: #00AA00;">&#41;</span> rotate<span style="color: #00AA00;">&#40;</span>-30deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  -webkit-transform<span style="color: #00AA00;">:</span>  rotate<span style="color: #00AA00;">&#40;</span>350deg<span style="color: #00AA00;">&#41;</span> scale<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1.4</span><span style="color: #00AA00;">&#41;</span> rotate<span style="color: #00AA00;">&#40;</span>-30deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  -o-transform<span style="color: #00AA00;">:</span>  rotate<span style="color: #00AA00;">&#40;</span>350deg<span style="color: #00AA00;">&#41;</span> scale<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1.4</span><span style="color: #00AA00;">&#41;</span> rotate<span style="color: #00AA00;">&#40;</span>-30deg<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>CSS 3 Transitions are supported by Webkit-based browsers (Safari and Chrome), Opera and now Firefox as well. Degradation (if not supported) is graceful (no animation, but the style is still applied). Therefore, you can start using it right away.</p>
<h2>Demos</h2>
<p>I&#8217;ve written a couple of demos to show both CSS3 Transitions on Transforms and hardware acceleration (See the video above for screencasts).</p>
<div style="border-bottom: 1px solid grey; border-top: 1px solid grey; padding: 10px; margin-bottom: 10px;"><a href="http://demos.hacks.mozilla.org/openweb/WARMCSS/"><img style="float: right;" src="http://demos.hacks.mozilla.org/openweb/WARMCSS/poster.png" alt="" /></a>This demo shows 5 videos. The videos are Black&amp;White in the thumbnails (<a href="https://developer.mozilla.org/en/applying_svg_effects_to_html_content">using a SVG Filter</a>) and colorful when real size (click on them). The &#8220;whirly&#8221; effect is done with CSS Transitions. Move you mouse over the video, you&#8217;ll see a question mark (?) button. Click on it to have the details about the video and to see another SVG Filter applied (<a href="http://www.w3.org/TR/SVG11/filters.html#feGaussianBlurElement">feGaussianBlur</a>).</div>
<div style="border-bottom: 1px solid grey; padding: 10px; margin-bottom: 10px;"><a href="http://demos.hacks.mozilla.org/openweb/LONDONPROJECT/"><img style="float: left; margin-right: 5px;" src="http://demos.hacks.mozilla.org/openweb/LONDONPROJECT/poster.png" alt="" /></a>This page shows 2 videos. The top left video is a round video (<a href="https://developer.mozilla.org/En/Applying_SVG_effects_to_HTML_content">thanks to SVG clip-path</a>) with SVG controls. The main video is clickable (magnifies the video). The text on top of the video is clickable as well, to send it to the background using CSS Transitions.</div>
<div style="border-bottom: 1px solid grey;"><a href="http://demos.hacks.mozilla.org/openweb/CSSMAKESUSICK/"><img style="float: right;" src="http://demos.hacks.mozilla.org/openweb/CSSMAKESUSICK/poster.png" alt="" /></a>This page is a simple list of images, video and canvas elements. Clicking on an element will apply a CSS Transform to the page itself with a transition. White elements are clickable (play video or bring a WebGL object). I encourage you to use a hardware accelerated and a <a href="http://blog.vlad1.com/2009/09/18/webgl-in-firefox-nightly-builds/">WebGL </a>capable browser. For Firefox on Windows, <a href="http://www.basschouten.com/blog1.php/2010/03/02/presenting-direct2d-hardware-acceleratio">you should enable Direct2D</a>.</div>
<p><strong>Credits</strong></p>
<p><strong>Creative Commons videos:</strong></p>
<ul>
<li><a href="http://www.flickr.com/photos/ianbroyles/4498340824/">Ian Broyles</a></li>
<li><a href="http://www.flickr.com/photos/transcendent/4024024153/">Spoony Mushroom</a></li>
<li>Mark Sebastian: <a href="http://www.flickr.com/photos/markjsebastian/3727252404/">[1]</a> <a href="http://www.flickr.com/photos/markjsebastian/3528096655/">[2]</a></li>
<li><a href="http://www.flickr.com/photos/swanky-hsiao/4036499457/">Swanky</a></li>
<li><a href="http://spiralproductions.com/">Spiral Production</a></li>
</ul>
<p><strong>The multicolor cloud effect (MIT License)</strong></p>
<ul>
<li><a href=" http://www.professorcloud.com/mainsite/canvas-nebula.htm">Professor Cloud</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2010/07/firefox4-beta2/feed/</wfw:commentRss>
		<slash:comments>59</slash:comments>
		</item>
		<item>
		<title>Firefox 4: -moz-any() selector grouping</title>
		<link>http://hacks.mozilla.org/2010/05/moz-any-selector-grouping/</link>
		<comments>http://hacks.mozilla.org/2010/05/moz-any-selector-grouping/#comments</comments>
		<pubDate>Tue, 18 May 2010 13:08:08 +0000</pubDate>
		<dc:creator>Paul Rouget</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Feature]]></category>
		<category><![CDATA[Firefox]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=4432</guid>
		<description><![CDATA[This is a re-post from David Baron&#8217;s blog. This feature has landed in Mozilla Central (trunk) and only available with a Firefox Nightly Build for the time being. Last night I landed support for :-moz-any() selector grouping. This allows providing alternatives between combinators, rather than having to repeat the entire selector for once piece that&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p><em>This is a re-post from <a href="http://dbaron.org/log/20100424-any">David Baron&#8217;s blog</a>. This feature has landed in Mozilla Central (trunk) and only available with a <a href="http://nightly.mozilla.org/">Firefox Nightly Build</a> for the time being.</em></p>
<p>Last night I landed support for <code>:-moz-any()</code> selector grouping.  This allows providing alternatives between combinators, rather than having to repeat the entire selector for once piece that&#8217;s different.  For example, it allowed replacing this rule in our user-agent style sheet:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* 3 deep (or more) unordered lists use a square */</span>
ol ol ul<span style="color: #00AA00;">,</span>     ol ul ul<span style="color: #00AA00;">,</span>     ol menu ul<span style="color: #00AA00;">,</span>     ol dir ul<span style="color: #00AA00;">,</span>
ol ol menu<span style="color: #00AA00;">,</span>   ol ul menu<span style="color: #00AA00;">,</span>   ol menu menu<span style="color: #00AA00;">,</span>   ol dir menu<span style="color: #00AA00;">,</span>
ol ol dir<span style="color: #00AA00;">,</span>    ol ul dir<span style="color: #00AA00;">,</span>    ol menu dir<span style="color: #00AA00;">,</span>    ol dir dir<span style="color: #00AA00;">,</span>
ul ol ul<span style="color: #00AA00;">,</span>     ul ul ul<span style="color: #00AA00;">,</span>     ul menu ul<span style="color: #00AA00;">,</span>     ul dir ul<span style="color: #00AA00;">,</span>
ul ol menu<span style="color: #00AA00;">,</span>   ul ul menu<span style="color: #00AA00;">,</span>   ul menu menu<span style="color: #00AA00;">,</span>   ul dir menu<span style="color: #00AA00;">,</span>
ul ol dir<span style="color: #00AA00;">,</span>    ul ul dir<span style="color: #00AA00;">,</span>    ul menu dir<span style="color: #00AA00;">,</span>    ul dir dir<span style="color: #00AA00;">,</span>
menu ol ul<span style="color: #00AA00;">,</span>   menu ul ul<span style="color: #00AA00;">,</span>   menu menu ul<span style="color: #00AA00;">,</span>   menu dir ul<span style="color: #00AA00;">,</span>
menu ol menu<span style="color: #00AA00;">,</span> menu ul menu<span style="color: #00AA00;">,</span> menu menu menu<span style="color: #00AA00;">,</span> menu dir menu<span style="color: #00AA00;">,</span>
menu ol dir<span style="color: #00AA00;">,</span>  menu ul dir<span style="color: #00AA00;">,</span>  menu menu dir<span style="color: #00AA00;">,</span>  menu dir dir<span style="color: #00AA00;">,</span>
dir ol ul<span style="color: #00AA00;">,</span>    dir ul ul<span style="color: #00AA00;">,</span>    dir menu ul<span style="color: #00AA00;">,</span>    dir dir ul<span style="color: #00AA00;">,</span>
dir ol menu<span style="color: #00AA00;">,</span>  dir ul menu<span style="color: #00AA00;">,</span>  dir menu menu<span style="color: #00AA00;">,</span>  dir dir menu<span style="color: #00AA00;">,</span>
dir ol dir<span style="color: #00AA00;">,</span>   dir ul dir<span style="color: #00AA00;">,</span>   dir menu dir<span style="color: #00AA00;">,</span>   dir dir dir <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">list-style-type</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">square</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>with this one:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* 3 deep (or more) unordered lists use a square */</span>
<span style="color: #3333ff;">:-moz-</span>any<span style="color: #00AA00;">&#40;</span>ol<span style="color: #00AA00;">,</span> ul<span style="color: #00AA00;">,</span> menu<span style="color: #00AA00;">,</span> dir<span style="color: #00AA00;">&#41;</span> <span style="color: #3333ff;">:-moz-</span>any<span style="color: #00AA00;">&#40;</span>ol<span style="color: #00AA00;">,</span> ul<span style="color: #00AA00;">,</span> menu<span style="color: #00AA00;">,</span> dir<span style="color: #00AA00;">&#41;</span> ul<span style="color: #00AA00;">,</span>
<span style="color: #3333ff;">:-moz-</span>any<span style="color: #00AA00;">&#40;</span>ol<span style="color: #00AA00;">,</span> ul<span style="color: #00AA00;">,</span> menu<span style="color: #00AA00;">,</span> dir<span style="color: #00AA00;">&#41;</span> <span style="color: #3333ff;">:-moz-</span>any<span style="color: #00AA00;">&#40;</span>ol<span style="color: #00AA00;">,</span> ul<span style="color: #00AA00;">,</span> menu<span style="color: #00AA00;">,</span> dir<span style="color: #00AA00;">&#41;</span> menu<span style="color: #00AA00;">,</span>
<span style="color: #3333ff;">:-moz-</span>any<span style="color: #00AA00;">&#40;</span>ol<span style="color: #00AA00;">,</span> ul<span style="color: #00AA00;">,</span> menu<span style="color: #00AA00;">,</span> dir<span style="color: #00AA00;">&#41;</span> <span style="color: #3333ff;">:-moz-</span>any<span style="color: #00AA00;">&#40;</span>ol<span style="color: #00AA00;">,</span> ul<span style="color: #00AA00;">,</span> menu<span style="color: #00AA00;">,</span> dir<span style="color: #00AA00;">&#41;</span> dir <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">list-style-type</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">square</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>In theory, I could even have used:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* 3 deep (or more) unordered lists use a square */</span>
<span style="color: #3333ff;">:-moz-</span>any<span style="color: #00AA00;">&#40;</span>ol<span style="color: #00AA00;">,</span> ul<span style="color: #00AA00;">,</span> menu<span style="color: #00AA00;">,</span> dir<span style="color: #00AA00;">&#41;</span> <span style="color: #3333ff;">:-moz-</span>any<span style="color: #00AA00;">&#40;</span>ol<span style="color: #00AA00;">,</span> ul<span style="color: #00AA00;">,</span> menu<span style="color: #00AA00;">,</span> dir<span style="color: #00AA00;">&#41;</span> <span style="color: #3333ff;">:-moz-</span>any<span style="color: #00AA00;">&#40;</span>ul<span style="color: #00AA00;">,</span> menu<span style="color: #00AA00;">,</span> dir<span style="color: #00AA00;">&#41;</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">list-style-type</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">square</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>but this would have been slower since it no longer falls into the <a href="https://developer.mozilla.org/en/Writing_Efficient_CSS">tag bucket</a>.  (If <code>:-moz-any()</code> turns out to be popular, we could add extra code so it&#8217;s just as fast, but I haven&#8217;t done so yet.)</p>
<p><code>:-moz-any()</code> is allowed to contain selectors with multiple simple selectors (using the css3-selectors definition of simple selectors, not the CSS 2.1 definition), but it is not allowed to contain combinators or pseudo-<em>elements</em>.  So you can write <code>:-moz-any(p.warning.new, p.error, div#topnotice)</code> or <code>:-moz-any(:link, :visited).external:-moz-any(:active, :focus)</code>, but you can&#8217;t put &#8220;<code>div p</code>&#8221; or &#8220;<code>div &gt; p</code> or &#8220;<code>:first-letter</code>&#8221; inside <code>:-moz-any()</code>.</p>
<p>This has a -moz- prefix for two reasons.  First, it&#8217;s just a proposal, and hasn&#8217;t made its way into any specification.  And second, it isn&#8217;t quite ready for prime-time, though, since it doesn&#8217;t yet <a ref="https://bugzilla.mozilla.org/show_bug.cgi?id=561154">handle specificity correctly</a>.</p>
<p><strong>Note</strong>: This will be extremely valuable in an HTML5 context when it comes to sections and headings. Since <code>section</code>, <code>article</code>, <code>aside</code>, and <code>nav</code> can be nested, doing something like styling all <code>h1</code> elements at different depths could be extremely complex.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* Level 0 */</span>
h1 <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">30px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #808080; font-style: italic;">/* Level 1 */</span>
section h1<span style="color: #00AA00;">,</span> article h1<span style="color: #00AA00;">,</span> aside h1<span style="color: #00AA00;">,</span> nav h1 <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">25px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #808080; font-style: italic;">/* Level 2 */</span>
section section h1<span style="color: #00AA00;">,</span> section article h1<span style="color: #00AA00;">,</span> section aside h1<span style="color: #00AA00;">,</span> section nav h1<span style="color: #00AA00;">,</span>
article section h1<span style="color: #00AA00;">,</span> article article h1<span style="color: #00AA00;">,</span> article aside h1<span style="color: #00AA00;">,</span> article nav h1<span style="color: #00AA00;">,</span>
aside section h1<span style="color: #00AA00;">,</span> aside article h1<span style="color: #00AA00;">,</span> aside aside h1<span style="color: #00AA00;">,</span> aside nav h1<span style="color: #00AA00;">,</span>
nav section h1<span style="color: #00AA00;">,</span> nav article h1<span style="color: #00AA00;">,</span> nav aside h1<span style="color: #00AA00;">,</span> nav nav h1<span style="color: #00AA00;">,</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #808080; font-style: italic;">/* Level 3 */</span>
<span style="color: #808080; font-style: italic;">/* ... don't even think about it*/</span></pre></div></div>

<p>With -moz-any():</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* Level 0 */</span>
h1 <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">30px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #808080; font-style: italic;">/* Level 1 */</span>
-moz-any<span style="color: #00AA00;">&#40;</span>section<span style="color: #00AA00;">,</span> article<span style="color: #00AA00;">,</span> aside<span style="color: #00AA00;">,</span> nav<span style="color: #00AA00;">&#41;</span> h1 <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">25px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #808080; font-style: italic;">/* Level 2 */</span>
-moz-any<span style="color: #00AA00;">&#40;</span>section<span style="color: #00AA00;">,</span> article<span style="color: #00AA00;">,</span> aside<span style="color: #00AA00;">,</span> nav<span style="color: #00AA00;">&#41;</span>
-moz-any<span style="color: #00AA00;">&#40;</span>section<span style="color: #00AA00;">,</span> article<span style="color: #00AA00;">,</span> aside<span style="color: #00AA00;">,</span> nav<span style="color: #00AA00;">&#41;</span> h1 <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #808080; font-style: italic;">/* Level 3 */</span>
-moz-any<span style="color: #00AA00;">&#40;</span>section<span style="color: #00AA00;">,</span> article<span style="color: #00AA00;">,</span> aside<span style="color: #00AA00;">,</span> nav<span style="color: #00AA00;">&#41;</span>
-moz-any<span style="color: #00AA00;">&#40;</span>section<span style="color: #00AA00;">,</span> article<span style="color: #00AA00;">,</span> aside<span style="color: #00AA00;">,</span> nav<span style="color: #00AA00;">&#41;</span>
-moz-any<span style="color: #00AA00;">&#40;</span>section<span style="color: #00AA00;">,</span> article<span style="color: #00AA00;">,</span> aside<span style="color: #00AA00;">,</span> nav<span style="color: #00AA00;">&#41;</span> h1 <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">15px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2010/05/moz-any-selector-grouping/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<item>
		<title>WebSockets in Firefox</title>
		<link>http://hacks.mozilla.org/2010/04/websockets-in-firefox/</link>
		<comments>http://hacks.mozilla.org/2010/04/websockets-in-firefox/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 17:11:19 +0000</pubDate>
		<dc:creator>Christopher Blizzard</dc:creator>
				<category><![CDATA[Feature]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Standards]]></category>
		<category><![CDATA[WebSocket]]></category>
		<category><![CDATA[XMLHttpRequest]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=4491</guid>
		<description><![CDATA[Here&#8217;s the pitch for WebSockets: a low-complexity, low-latency, bi-directional communication system that has a pretty simple API for web developers. Let&#8217;s break that down, and then talk about if and when we&#8217;re going to include it in Firefox: Low-complexity The WebSocket protocol, which is started via an HTTP-like handshake, has a relatively simple model for [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s the pitch for <a href="http://en.wikipedia.org/wiki/Web_Sockets">WebSockets</a>: a low-complexity, low-latency, bi-directional communication system that has a <a href="http://dev.w3.org/html5/websockets/#websocket">pretty simple API</a> for web developers.  Let&#8217;s break that down, and then talk about if and when we&#8217;re going to include it in Firefox:</p>
<p><strong>Low-complexity</strong></p>
<p>The WebSocket protocol, which is started via an HTTP-like handshake, has a relatively simple model for sending text packets back and forth.  The complexity of the protocol is quite low.  There&#8217;s no multiplexing, no support for binary data, and once the data connection is set up, the actual transport is quite cheap.</p>
<p>Note that there are people who feel &#8211; possibly correctly &#8211; that support for multiplexing and binary data should be added.  That would obviously increase the complexity but in some cases might be worth the cost.  But more on that later.</p>
<p><strong>Bi-directional Communication</strong></p>
<p>One of the key aspects of WebSocket is its support for simple bi-directional communication.  Servers can easily send updates to clients and clients can send updates to servers.  Many of the <a href="http://en.wikipedia.org/wiki/Comet_%28programming%29">comet-style</a> applications that people have built will be much simpler and faster with this model because the protocol and API support it directly.</p>
<p>While allowing for bi-directional communication it also is bound by the HTTP same-origin model.  That is, it&#8217;s doesn&#8217;t give the browser the ability to connect to any site on any port it wants to.</p>
<p>So WebSocket is really TCP with the HTTP security model.</p>
<p><strong>Low-latency</strong></p>
<p>This is actually the primary value in WebSockets.  The key thing is that the cost of sending a small amount of data is also very small.  It&#8217;s possible to do bi-directional communication today with comet-style applications, but small amounts of data often require a huge amount of overhead to do so.</p>
<p>A second-hand story to give you a sense of scale: Google Wave, which tries to do real-time communication with keystrokes has a several-kilobyte overhead for just about every keystroke because of the TCP startup, teardown and HTTP message headers involved with what should be only a few bytes sent over the wire.</p>
<p>I haven&#8217;t tried, but I&#8217;m going to guess that if you built <a href="http://code.google.com/p/quake2-gwt-port/">Quake</a> on top of HTTP comet that the interactive experience would be poor.  So this is where WebSockets really shine.</p>
<p><strong>Simple API</strong></p>
<p>The <a href="http://dev.w3.org/html5/websockets/#the-websocket-interface">actual API</a> that a developer sees for WebSocket is relatively simple.  You can send messages, you can get messages, you get events when sockets open, close or there&#8217;s an error.  Additional complexity, which I&#8217;m sure others will develop, will happen in JavaScript and backend libraries.</p>
<p>(While this might seem like punting on the issue of complexity, this is actually the model for success we&#8217;ve seen for other browser standards: build something relatively simple that others can experiment with.  When we understand what&#8217;s slow or what&#8217;s preventing progress, iterate and improve.)</p>
<p><strong>When will it be in Firefox?</strong></p>
<p>We really really want to support WebSockets in the next version of Firefox.  And a lot of other people want us to include support too.</p>
<p><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=472529">The first set of test patches</a>, written by the wonderful Wellington Fernando de Macedo (one of our most excellent contributors!) was first submitted in April of 2009.  Since then we&#8217;ve been iterating both on the patches themselves and following the spec as it&#8217;s changed.</p>
<p>Unfortunately, the spec itself is still under revision.  WebSockets did ship in <a href="http://blog.chromium.org/2009/12/web-sockets-now-available-in-google.html">Chrome</a> with version 4 and I&#8217;m told by Chrome developers that it&#8217;s going to be included in Chrome 5, without changes.  Unfortunately, the <a href="http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-75">version that Google included in Chrome</a> doesn&#8217;t reflect the <a href="http://www.whatwg.org/specs/web-socket-protocol/">current draft</a>.  The handshake for how to start a WebSocket connection has changed, largely to improve security on servers.  There&#8217;s also a lot of ongoing discussion on the role of <a href="http://www.ietf.org/mail-archive/web/hybi/current/msg01810.html">integrated compression</a>, direct support for binary data (instead of encoding binary data as strings), whether or not the protocol should support multiplexing and a number of other issues.</p>
<p>Since WebSocket isn&#8217;t used widely yet, and that Chrome has an uptake rate that&#8217;s similar to Firefox, the hope is that once a more recent draft makes it through the process that both Chrome and Firefox can include a more recent version at around the same time.</p>
<p>So in short: we want to ship it because the promise of WebSockets is great, but we&#8217;ll have to see if it&#8217;s stable and safe enough to do so.  Code isn&#8217;t the issue &#8211; we&#8217;ve had that for a while.  It&#8217;s whether or not there&#8217;s consensus on if the protocol is &#8220;done enough&#8221; to ship it to a few hundred million people.</p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2010/04/websockets-in-firefox/feed/</wfw:commentRss>
		<slash:comments>40</slash:comments>
		</item>
		<item>
		<title>a quick note on JavaScript engine components</title>
		<link>http://hacks.mozilla.org/2010/03/a-quick-note-on-javascript-engine-components/</link>
		<comments>http://hacks.mozilla.org/2010/03/a-quick-note-on-javascript-engine-components/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 21:23:00 +0000</pubDate>
		<dc:creator>Christopher Blizzard</dc:creator>
				<category><![CDATA[Feature]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[JägerMonkey]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=4143</guid>
		<description><![CDATA[There have been a bunch of posts about the JägerMonkey (JM) post that we made the other day, some of which get things subtly wrong about the pieces of technology that are being used as part of Mozilla&#8217;s JM work. So here&#8217;s the super-quick overview of what we&#8217;re using, what the various parts do and [...]]]></description>
			<content:encoded><![CDATA[<p>There have been a bunch of posts about the <a href="http://hacks.mozilla.org/2010/03/improving-javascript-performance-with-jagermonkey/">JägerMonkey (JM) post</a> that we made the other day, some of which get things subtly wrong about the pieces of technology that are being used as part of Mozilla&#8217;s JM work.  So here&#8217;s the super-quick overview of what we&#8217;re using, what the various parts do and where they came from:</p>
<p>1. <strong>SpiderMonkey.</strong>This is Mozilla&#8217;s core JavaScript Interpreter.  This engine takes raw JavaScript and turns it into an intermediate bytecode.  That bytecode is then interpreted.  SpiderMonkey was responsible for all JavaScript handling in Firefox 3 and earlier.  We continue to make improvements to this engine, as it&#8217;s still the basis for a lot of work that we did in Firefox 3.5, 3.6 and later releases as well.</p>
<p>2. <strong>Tracing.</strong> Tracing was added before Firefox 3.5 and was responsible for much of the big jump that we made in performance.  (Although some of that was because we also improved the underlying SpiderMonkey engine as well.)</p>
<p>This is what we do to trace:</p>
<ol>
<li>Monitor interpreted JavaScript code during execution looking for code paths that are used more than once.
<li>When we find a piece of code that&#8217;s used more than once, optimize that code.
<li>Take that optimized representation and assemble it to machine code and execute it.
</ol>
<p>What we&#8217;ve found since Firefox 3.5 is that when we&#8217;re in full tracing mode, we&#8217;re really really fast.  We&#8217;re slow when we have to &#8220;fall back&#8221; to SpiderMonkey and interpret + record.</p>
<p>One difficult part of tracing is generating code that runs fast.  This is done by a piece of code called <strong>Nanojit</strong>.  Nanojit is a piece of code that was originally part of the <strong>Tamarin</strong> project.  Mozilla isn&#8217;t using most of Tamarin for two reasons: 1. we&#8217;re not shipping ECMAScript 4 and 2. the interpreted part of Tamarin was much slower than SpiderMonkey.  For Firefox 3.5 we took the best part &#8211; Nanojit &#8211; and bolted it to the back of SpiderMonkey instead.</p>
<p>Nanojit does two things: it takes a high-level representation of JavaScript and does optimization.  It also includes an assembler to take that optimized representation and generate native code for machine-level execution.</p>
<p>Mozilla and Adobe continue to collaborate on Nanojit.  Adobe uses Nanojit as part of their ActionScript VM.</p>
<p>3. <strong>Nitro Assembler.</strong> This is a piece of code that we&#8217;re taking from Apple&#8217;s version of webkit that generates native code for execution.  The Nitro Assembler is very different than Nanojit.  While Nanojit takes a high-level representation, does optimization and then generates code all the Nitro Assembler does is generate code.  So it&#8217;s complex, low-level code, but it doesn&#8217;t do the same set of things that Nanojit does.</p>
<p>We&#8217;re using the Nitro assembler (along with a lot of other new code) to basically build what everyone else has &#8211; compiled JavaScript &#8211; and then we&#8217;re going to do what we did with Firefox 3.5 &#8211; bolt tracing onto the back of that.  So we&#8217;ll hopefully have the best of all worlds: SpiderMonkey generating native code to execute like the other VMs with the ability to go onto trace for tight inner loops for even more performance.</p>
<p>I hope this helps to explain what bits of technology we&#8217;re using and how they fit into the overall picture of Firefox&#8217;s JS performance.</p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2010/03/a-quick-note-on-javascript-engine-components/feed/</wfw:commentRss>
		<slash:comments>33</slash:comments>
		</item>
		<item>
		<title>Mozilla developer preview (Gecko 1.9.3a2) now available</title>
		<link>http://hacks.mozilla.org/2010/03/mozilla-developer-preview-gecko-1-9-3a2-now-available/</link>
		<comments>http://hacks.mozilla.org/2010/03/mozilla-developer-preview-gecko-1-9-3a2-now-available/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 20:28:57 +0000</pubDate>
		<dc:creator>Christopher Blizzard</dc:creator>
				<category><![CDATA[Feature]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Performance]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=4126</guid>
		<description><![CDATA[We&#8217;ve posted a new release of our Mozilla developer preview series as a way to test new features that we&#8217;re putting into the Mozilla platform. These features may or may not make it into a future Firefox release, either for desktops or for mobile phones. But that&#8217;s why we do these releases &#8211; to get [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve posted a new release of our Mozilla developer preview series as a way to test new features that we&#8217;re putting into the Mozilla platform.  These features may or may not make it into a future Firefox release, either for desktops or for mobile phones.  But that&#8217;s why we do these releases &#8211; to get testing and feedback early so we know how to treat them.</p>
<p>Note that this release does not contain two things that have gotten press recently: <a href="http://www.basschouten.com/blog1.php/2009/11/22/direct2d-hardware-rendering-a-browser">D2D</a> or the new <a href="http://hacks.mozilla.org/2010/03/improving-javascript-performance-with-jagermonkey/">JavaScript VM</a> work we&#8217;ve been doing.</p>
<p>Since this is a weblog focused on web developers, I think that it&#8217;s important to talk about what&#8217;s new for all of you.  So we&#8217;ll jump right into that:</p>
<h3>Out of Process Plugins</h3>
<p>We did an <a href="http://hacks.mozilla.org/2010/02/mozilla-developer-preview-gecko-1-9-3a1-available-for-download/">a1 release</a> about three weeks ago in order to get testing on some of the new web developer features (which we&#8217;ll list here again.)  The biggest change between that release and this one is the inclusion of out of process plugins for Windows and Linux.  (Mac is a little bit more work and we&#8217;re working on it as fast as our little fingers will type.)</p>
<p>There are a lot of plugins out there on the web, and they exist to varying degrees of quality.  So we&#8217;re pushing plugins out of process so that when <a href="http://www.flickr.com/photos/christopherblizzard/4397728218/">one of them crashes</a> it doesn&#8217;t take the entire browser with it.  (It also has lots of other nice side effects &#8211; we can better control memory usage, CPU usage and it also helps with general UI lag.)</p>
<p>If you want to know more about it, have a look at <a href="http://benjamin.smedbergs.us/blog/2010-03-03/firefox-safe-from-plugin-crashes/">this post by Ben Smedberg</a> who goes over how it works, what prefs you can set and how you can help test it.  It would help us a lot of you did.</p>
<p>(If you really want to get on the testing train we strongly suggest you start running our <a href="http://nightly.mozilla.org">nightly builds</a> which are the ultimate in bleeding edge but are generally stable enough for daily use.)</p>
<p>Anyway, on to the feature list and performance improvements taken from the <a href="https://developer.mozilla.org/devnews/index.php/2010/03/03/mozilla-developer-preview-now-available-with-out-of-process-plugins/">release announcement</a>:</p>
<h3>Web Developer Features</h3>
<ul>
<li>Support for <a href="https://developer.mozilla.org/en/Introducing_Content_Security_Policy">Content Security Policy</a>.  This is largely complete, minus the ability to disable <code>eval()</code>.
</li>
<li>The placeholder attribute for &lt;input/&gt; and &lt;textarea&gt; is now supported.
</li>
<li>Support for SMIL Animation in SVG. Support for animating some SVG attributes is still under development and the <code>animateMotion</code> element isn&#8217;t supported yet.
</li>
<li>Support for CSS Transitions. This support is not quite complete: support for animation of transforms and gradients has not yet been implemented.
</li>
<li>Support for WebGL, which is disabled by default but can be enabled by changing a preference. See <a href="http://hacks.mozilla.org/2009/09/webgl-for-firefox/">this blog post</a> and <a href="http://hacks.mozilla.org/2009/12/webgl-draft-released-today/">this blog post</a> for more details.
</li>
<li>Support for the <code>getClientRects</code> and <code>getBoundingClientRect</code> methods on Range  objects. See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=396392">bug 396392</a> for details.</li>
<li>Support for the <code>setCapture</code> and <code>releaseCapture</code> methods on DOM elements. See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=503943">bug 503943</a> for details.</li>
<li>Support for the HTML5 <a href="https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history#Adding_and_modifying_history_entries"><code>History.pushState()</code> and <code>History.replaceState()</code> methods and the <code>popstate</code> event</a>. See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=500328">bug 500328</a> for details.</li>
<li>Support for the <code><a href="https://developer.mozilla.org/en/CSS/background-image">-moz-image-rect()</a></code> value for background-image. See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=113577">bug 113577</a> for more details.
</li>
</ul>
<p>For the full list of new web developer features please visit our page on <a href="https://developer.mozilla.org/en/Upcoming_Firefox_features_for_developers">Upcoming Features for Web Developers</a>.</p>
<h3>Performance Improvements</h3>
<ul>
<li>We&#8217;ve removed link history lookup from the main thread and made it asynchronous.  This results in <a href="https://wiki.mozilla.org/Firefox/Goals/2010Q1/IO_Reduction">less I/O during page loads</a> and improves overall browser responsiveness.</li>
<li>Loading the <a href="http://www.whatwg.org/specs/web-apps/current-work/">HTML5 spec</a> no longer causes very long browser pauses.
</li>
<li>A large number of layout performance improvements have been made, including work around DOM access times, color management performance, text area improvements and many other hot spots in the layout engine.</li>
<li>The JavaScript engine has many improvements: String handling is improved, faster closures, some support for recursion in TraceMonkey to name a few.</li>
<li>Improvements to the performance of repainting HTML in <code>&lt;foreignObject&gt;</code>.
</li>
<li>Strings are not copied between the main DOM code and <a href="https://developer.mozilla.org/En/Using_web_workers">web workers</a>, improving performance for threaded JavaScript which moves large pieces of data between threads.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2010/03/mozilla-developer-preview-gecko-1-9-3a2-now-available/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>multiple file input in Firefox 3.6</title>
		<link>http://hacks.mozilla.org/2009/12/multiple-file-input-in-firefox-3-6/</link>
		<comments>http://hacks.mozilla.org/2009/12/multiple-file-input-in-firefox-3-6/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 21:20:46 +0000</pubDate>
		<dc:creator>Paul Rouget</dc:creator>
				<category><![CDATA[Device APIs]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[Feature]]></category>
		<category><![CDATA[Featured Article]]></category>
		<category><![CDATA[FileAPI]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Firefox 3.6]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=2905</guid>
		<description><![CDATA[Firefox 3.6 supports multiple file input. This new capability allows you to get several files as input at once, using standard technologies. This is a big improvement, since you used to be constrained to one file at a time, or needed to use a third party (proprietary) application. This will be particularly useful, for example, [...]]]></description>
			<content:encoded><![CDATA[<p>Firefox 3.6 supports <a href="https://developer.mozilla.org/en/DOM/Input.multiple">multiple file input</a>. This new capability allows you to get several files as input at once, using standard technologies. This is a big improvement, since you used to be constrained to one file at a time, or needed to use a third party (proprietary) application. This will be particularly useful, for example, for photo uploads.</p>
<h3>The input tag</h3>
<p>To let your user select a local file, use the input tag on your Web page. This will show the file picker to the user:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;file&quot;</span><span style="color: #66cc66;">/</span>&gt;</span></pre></div></div>

<p>In Firefox 3.6, the input tag has been expanded to support multiple files:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;file&quot;</span> <span style="color: #000066;">multiple</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">/</span>&gt;</span></pre></div></div>

<p>The user will still see the same file picker, but will be able to select more than one file. </p>
<h3>The form tag</h3>
<p>You  can still use the classic <code>form</code> mechanism:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> <span style="color: #000066;">method</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;post&quot;</span> <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;upload.php&quot;</span> <span style="color: #000066;">enctype</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;multipart/form-data&quot;</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'uploads[]'</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;file&quot;</span> <span style="color: #000066;">multiple</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">/</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Send&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span></pre></div></div>

<p>If the server side code is in PHP, don&#8217;t forget to make sure that the value of the <code>name</code> attribute has brackets. The brackets are not from the HTML specification, but are required to manipulate the result of the request as an array (see <a href="http://www.php.net/manual/en/features.file-upload.multiple.php">PHP documentation</a>). </p>
<p>Here&#8217;s an example, which goes through the file list and prints each file name:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'uploads'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$filename</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;li&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$filename</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/li&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h3>Using File API</h3>
<p>Firefox 3.6 also supports <a href="http://hacks.mozilla.org/2009/12/w3c-fileapi-in-firefox-3-6/">FileAPI</a>. This allows you to do extra processing on the client slide before sending the files to the server. You can access the selected files with the <code>files</code> property of the input DOM element and then manipulate the files using the FileAPI. </p>
<p>For example, here&#8217;s how to get the name of each file selected by the user. This is done on the client side, unlike the previous PHP example.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">  <span style="color: #003366; font-weight: bold;">var</span> input <span style="color: #339933;">=</span> document.<span style="color: #660066;">querySelector</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;input[type='file']&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #006600; font-style: italic;">// You've selected input.files.length files</span>
  <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> input.<span style="color: #660066;">files</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #006600; font-style: italic;">// input.files[i] is a file object</span>
    <span style="color: #003366; font-weight: bold;">var</span> li <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    li.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> input.<span style="color: #660066;">files</span><span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #000066;">name</span><span style="color: #339933;">;</span>
    ul.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>li<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

<h3>Demo</h3>
<p>See this mechanism in action in our <a href="http://demos.hacks.mozilla.org/openweb/multipleFiles/">multiple file input demo</a>. You&#8217;ll need <a href="http://www.mozilla.com/en-US/firefox/all-beta.html">Firefox 3.6</a> (beta).</p>
<h3>Documentation</h3>
<p>To learn more about multiple file input, check out the <a href="https://developer.mozilla.org/en/DOM/Input.multiple">documentation on MDC</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2009/12/multiple-file-input-in-firefox-3-6/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>W3C FileAPI in Firefox 3.6</title>
		<link>http://hacks.mozilla.org/2009/12/w3c-fileapi-in-firefox-3-6/</link>
		<comments>http://hacks.mozilla.org/2009/12/w3c-fileapi-in-firefox-3-6/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 22:52:55 +0000</pubDate>
		<dc:creator>Arun Ranganathan</dc:creator>
				<category><![CDATA[Drag and Drop]]></category>
		<category><![CDATA[Feature]]></category>
		<category><![CDATA[Featured Article]]></category>
		<category><![CDATA[FileAPI]]></category>
		<category><![CDATA[Firefox 3.6]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=2781</guid>
		<description><![CDATA[Often, web applications will prompt the user to select a file, typically to upload to a server. Unless the web application makes use of a plugin, file selection occurs through an HTML input element, of the sort &#60;input type="file"/&#62;. Firefox 3.6 now supports much of the W3C File API, which specifies the ability to asynchronously [...]]]></description>
			<content:encoded><![CDATA[<p>Often, web applications will prompt the user to select a file, typically to upload to a server.  Unless the web application makes use of a plugin, file selection occurs through an HTML input element, of the sort <code>&lt;input type="file"/&gt;</code>.  Firefox 3.6 now supports much of the <a href="http://www.w3.org/TR/FileAPI/">W3C File API</a>, which specifies the ability to <em>asynchronously read</em> the selected file into memory, and perform operations on the file data within the web application (for example, to display a thumbnail preview of an image, before it is uploaded, or to look for ID3 tags within an MP3 file, or to look for EXIF data in JPEG files, all on the client side).  This is a new API, and replaces the file API that was introduced in Firefox 3.</p>
<p>It is important to note that even before the advent of the <a href="http://www.w3.org/TR/FileAPI/">W3C File API</a> draft (which only became a Working Draft in November 2009), Firefox 3 and later provide the ability to <a href="https://developer.mozilla.org/en/nsIDOMFile">read files into memory <em>synchronously</em></a> but that capability should be considered <em>deprecated</em> in favor of the new implementation in Firefox 3.6 of <a href="https://developer.mozilla.org/en/Using_files_from_web_applications">the asynchronous File API</a>.  The deprecated API allowed you synchronously access a file:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// After obtaining a handle to a file</span>
<span style="color: #006600; font-style: italic;">// access the file data</span>
<span style="color: #003366; font-weight: bold;">var</span> dataURL <span style="color: #339933;">=</span> file.<span style="color: #660066;">getAsDataURL</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
img.<span style="color: #660066;">src</span> <span style="color: #339933;">=</span> dataURL<span style="color: #339933;">;</span></pre></div></div>

<p>While Firefox 3.6 will continue to support code usage of the sort above, it should be considered <em>deprecated</em> since it reads files <em>synchronously</em> on the main thread.  For large files, this could result in blocking on the result of the read, which isn&#8217;t desirable.  Moreover, the file object itself provides a method to read from it, rather than having a separate reader object.  These considerations informed the technical direction of the <a href="https://developer.mozilla.org/en/Using_files_from_web_applications">new File API in Firefox 3.6</a> (and the direction of the <a href="http://www.w3.org/TR/FileAPI/">specification</a>).  The rest of this article is about the newly introduced File API.</p>
<p><strong>Accessing file selections</strong></p>
<p>Firefox 3.6 supports <em>multiple file selections</em> on an input element, and returns all the files selected using the <a href="https://developer.mozilla.org/en/DOM/FileList">FileList</a> interface.  Previous versions of Firefox only supported one selection of a file using the input element.  Additionally, the <a href="https://developer.mozilla.org/en/DOM/FileList">FileList</a> interface is also exposed to the <a href="https://developer.mozilla.org/En/DragDrop/Drag_and_Drop">HTML5 Drag and Drop API</a> as a property of the <a href="https://developer.mozilla.org/En/DragDrop/DataTransfer">DataTransfer</a> interface.  Users can drag and drop multiple files to a drop target within a web page as well.</p>
<p>The following HTML spawns the standard file picker, with which you can select multiple files:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;inputFiles&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;file&quot;</span> <span style="color: #000066;">multiple</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></pre></div></div>

<p>Note that if you don&#8217;t use the <code>multiple</code> attribute, you only enable single file selection.</p>
<p>You can work with all the selected files obtained either through the file picker (using the <code>input</code> element) or through the <a href="https://developer.mozilla.org/En/DragDrop/DataTransfer">DataTransfer</a> object by iterating through the FileList:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> files <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;inputFiles&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">files</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// or, for a drag event e:</span>
<span style="color: #006600; font-style: italic;">// var dt = e.dataTransfer; var files = dt.files</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> files.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> file <span style="color: #339933;">=</span> files<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  handleFile<span style="color: #009900;">&#40;</span>file<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><strong>Properties of files</strong></p>
<p>Once you obtain a reference to an individually selected file from a <a href="https://developer.mozilla.org/en/DOM/FileList">FileList</a>, you get a <a href="https://developer.mozilla.org/en/DOM/File">File</a> object, which has <code>name</code>, <code>type</code>, and <code>size</code> properties.  Continuing with the code snippet above:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> handleFile<span style="color: #009900;">&#40;</span>file<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #006600; font-style: italic;">// RegExp for JPEG mime type</span>
    <span style="color: #003366; font-weight: bold;">var</span> imageType <span style="color: #339933;">=</span> <span style="color: #009966; font-style: italic;">/image\/jpeg/</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// Check if match</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>file.<span style="color: #660066;">type</span>.<span style="color: #660066;">match</span><span style="color: #009900;">&#40;</span>imageType<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
   <span style="color: #006600; font-style: italic;">// Check if the picture exceeds set limit</span>
   <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>file.<span style="color: #660066;">size</span> <span style="color: #339933;">&gt;</span> maxSize<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Choose a smaller photo!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
  <span style="color: #006600; font-style: italic;">// Add file name to page</span>
  <span style="color: #003366; font-weight: bold;">var</span> picData <span style="color: #339933;">=</span> document.<span style="color: #660066;">createTextNode</span><span style="color: #009900;">&#40;</span>file.<span style="color: #000066;">name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  dataGrid.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>picData<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The <code>size</code> attribute is the file&#8217;s size, in bytes.  The <code>name</code> attribute is the file&#8217;s name, without path information.  The <code>type</code> attribute is an ASCII-encoded string in lower case representing the media type of the file, expressed as an <a href="http://www.ietf.org/rfc/rfc2046.txt">RFC2046 MIME type</a>.  The <code>type</code> attribute in particular is useful in sniffing file type, as in the example above, where the script determines if the file in question is a JPEG file.  If Firefox 3.6 cannot determine the file&#8217;s <code>type</code>, it will return the empty string.</p>
<p><strong>Reading Files</strong></p>
<p>Firefox 3.6 and beyond support the <a href="https://developer.mozilla.org/en/DOM/FileReader">FileReader</a> object to read file data asynchronously into memory, using event callbacks to mark progress.  The object is instantiated in the standard way:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> binaryReader <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> FileReader<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Event handler attributes are used to work with the <code>result</code> of the file read operation.  For very large files, it is possible to watch for <em>progress events</em> as the file is being read into memory (using the <code>onprogress</code> event handler attribute to set the event handler function).  This is useful in scenarios where the drives in question may not be local to the hardware, or if the file in question is particularly big.</p>
<p>The <a href="https://developer.mozilla.org/en/DOM/FileReader">FileReader</a> object supports three methods to read files into memory.  Each allows programmatic access to the files data in a different format, though in practice only one read method should be called on a given <a href="https://developer.mozilla.org/en/DOM/FileReader">FileReader</a> object:</p>
<ul>
<li><code>filereader.readAsBinaryString(file);</code> will asynchronously return a binary string with each byte represented by an integer in the range [0..255].  This is useful for binary manipulations of a file&#8217;s data, for example to look for <a href="http://en.wikipedia.org/wiki/ID3">ID3 tags in an MP3 file</a>, or to look for <a href="http://en.wikipedia.org/wiki/Exchangeable_image_file_format">EXIF data</a> in a JPEG image.</li>
<li><code>filereader.readAsText(file, encoding);</code> will asynchronously return a string in the format solicited by the encoding parameter (for example <code>encoding = "UTF-8"</code>).  This is useful for working with a text file, for example to parse an XML file.</li>
<li><code>filereader.readAsDataURL(file);</code> will asynchronously return a <a href="https://developer.mozilla.org/en/data_URIs">Data URL</a>.  Firefox 3.6 allows large URLs, and so this feature is particularly useful when a URL could help display media content in a web page, for example for image data, video data, or audio data.</li>
</ul>
<p>An example helps tie this all together:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>files.<span style="color: #660066;">length</span> <span style="color: #339933;">&gt;</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>handleFile<span style="color: #009900;">&#40;</span>files<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        invalid.<span style="color: #660066;">style</span>.<span style="color: #660066;">visibility</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;visible&quot;</span><span style="color: #339933;">;</span>
        invalid.<span style="color: #660066;">msg</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;Select a JPEG Image&quot;</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> binaryReader <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> FileReader<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
binaryReader.<span style="color: #000066;">onload</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
   <span style="color: #003366; font-weight: bold;">var</span> exif <span style="color: #339933;">=</span> findEXIFInJPG<span style="color: #009900;">&#40;</span>binaryReader.<span style="color: #660066;">result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>exif<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #006600; font-style: italic;">// ...set up conditions for lack of data</span>
   <span style="color: #009900;">&#125;</span>
   <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #006600; font-style: italic;">// ...write out exif data</span>
   <span style="color: #009900;">&#125;</span>
&nbsp;
binaryReader.<span style="color: #660066;">onprogress</span> <span style="color: #339933;">=</span> updateProgress<span style="color: #339933;">;</span>
binaryReader.<span style="color: #000066;">onerror</span> <span style="color: #339933;">=</span> errorHandler<span style="color: #339933;">;</span>
&nbsp;
binaryReader.<span style="color: #660066;">readAsBinaryString</span><span style="color: #009900;">&#40;</span>file<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> updateProgress<span style="color: #009900;">&#40;</span>evt<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
   <span style="color: #006600; font-style: italic;">// use lengthComputable, loaded, and total on ProgressEvent</span>
   <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>evt.<span style="color: #660066;">lengthComputable</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #003366; font-weight: bold;">var</span> loaded <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>evt.<span style="color: #660066;">loaded</span> <span style="color: #339933;">/</span> evt.<span style="color: #660066;">total</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>loaded <span style="color: #339933;">&lt;</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #006600; font-style: italic;">// update progress meter</span>
            progMeter.<span style="color: #660066;">style</span>.<span style="color: #660066;">width</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>loaded <span style="color: #339933;">*</span> <span style="color: #CC0000;">200</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;px&quot;</span><span style="color: #339933;">;</span>
          <span style="color: #009900;">&#125;</span>
   <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> errorHandler<span style="color: #009900;">&#40;</span>evt<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>evt.<span style="color: #660066;">target</span>.<span style="color: #660066;">error</span>.<span style="color: #660066;">code</span> <span style="color: #339933;">==</span> evt.<span style="color: #660066;">target</span>.<span style="color: #660066;">error</span>.<span style="color: #660066;">NOT_FOUND_ERR</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;File Not Found!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>In order to work with binary data, the use of the <a href="https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Objects/String/CharCodeAt">charCodeAt</a> function exposed on strings will be particularly useful.  For instance, an utility of the sort:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> getByteAt<span style="color: #009900;">&#40;</span>file<span style="color: #339933;">,</span> idx<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">return</span> file.<span style="color: #660066;">charCodeAt</span><span style="color: #009900;">&#40;</span>idx<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>allows extraction of the Unicode value of the character at the given index.</p>
<p>An example of similar code in action in Firefox 3.6, including use of the <code>readAsDataURL</code> method to render an image, as well as binary analysis of a JPEG for EXIF detection (using the <code>readAsBinaryString</code> method), can be found in <a href="http://hacks.mozilla.org/2009/12/firefox-36-fileapi-demo-reading-exif-data-from-a-local-jpeg-file/">Paul Rouget&#8217;s great demo of the File API.</a>.</p>
<p><strong>A word on the specification</strong></p>
<p>The existence of a W3C public working draft of <a href="http://www.w3.org/TR/FileAPI/">the File API</a> holds the promise of other browsers implementing it shortly.  Firefox 3.6&#8242;s implementation is fairly complete, but is missing some of the technology mentioned in the specification.  Notably, the <code>urn</code> feature on the <a href="https://developer.mozilla.org/en/DOM/File">File</a> object isn&#8217;t yet implemented, and neither is the ability to extract byte-ranges of files using the <code>slice</code> method.  A synchronous way to read files isn&#8217;t yet implemented as part of <a href="https://developer.mozilla.org/En/DOM/Worker">Worker Threads</a>.  These features will come in future versions of Firefox.</p>
<p><strong>References</strong></p>
<ul>
<li><a href="http://www.w3.org/TR/FileAPI/">The W3C File API Specification</a></li>
<li><a href="https://developer.mozilla.org/en/Using_files_from_web_applications">MDC: Using files within web applications</a></li>
<li><a href="https://developer.mozilla.org/en/DOM/FileList">MDC: FileList</a></li>
<li><a href="https://developer.mozilla.org/en/DOM/File">MDC: File</a></li>
<li><a href="https://developer.mozilla.org/en/DOM/FileReader">MDC: FileReader</a></li>
<li><a href="https://developer.mozilla.org/En/DragDrop/Drag_and_Drop">MDC: Drag and Drop</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2009/12/w3c-fileapi-in-firefox-3-6/feed/</wfw:commentRss>
		<slash:comments>37</slash:comments>
		</item>
		<item>
		<title>pointer-events for HTML in Firefox 3.6</title>
		<link>http://hacks.mozilla.org/2009/12/pointer-events-for-html-in-firefox-3-6/</link>
		<comments>http://hacks.mozilla.org/2009/12/pointer-events-for-html-in-firefox-3-6/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 15:59:32 +0000</pubDate>
		<dc:creator>Christopher Blizzard</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Demo]]></category>
		<category><![CDATA[Feature]]></category>
		<category><![CDATA[Featured Demo]]></category>
		<category><![CDATA[Firefox 3.6]]></category>
		<category><![CDATA[Standards]]></category>
		<category><![CDATA[SVG]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=2647</guid>
		<description><![CDATA[The pointer-events CSS property has long been available as part of SVG as a way to control if a mouse event should be sent to the element directly underneath the mouse or passed through to an element underneath it. In Firefox 3.6 we&#8217;ve extended the property to allow it to apply to normal HTML content [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="https://developer.mozilla.org/en/CSS/pointer-events"><code>pointer-events</code></a> CSS property has long been available as part of SVG as a way to control if a mouse event should be sent to the element directly underneath the mouse or passed through to an element underneath it.  In Firefox 3.6 we&#8217;ve extended the property to allow it to apply to normal HTML content as well.</p>
<p>For SVG you can set the <code>pointer-events</code> property to one of several values, but for HTML you can only set it to one of two values: <code>auto</code> or <code>none</code>.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.foo</span> <span style="color: #00AA00;">&#123;</span>
  pointer-events<span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>When <code>pointer-events</code> is set to <code>none</code>, pointer events are passed through the target element and are instead sent to the element that is underneath it.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.foo</span> <span style="color: #00AA00;">&#123;</span>
  pointer-events<span style="color: #00AA00;">:</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>When <code>pointer-events</code> is set to <code>auto</code>, pointer events are handled normally.  That is, the element blocks the events from being passed down to a lower element.</p>
<p><a href="http://demos.hacks.mozilla.org/openweb/pointer-events/">Here&#8217;s a real world example from Paul Rouget</a>.  You will need a <a href="http://www.mozilla.com/en-US/firefox/all-beta.html">Firefox 3.6 beta</a> to see it in action.</p>
<p>Click the <code>pointer-events: none</code> checkbox under the image to see it change.</p>
<p>He&#8217;s replicated the tag list that&#8217;s on the front page of <a href="http://twitter.com">twitter.com</a>.  (Note: you have to not be logged in to see the tag list.)  If you go and look at it on twitter you&#8217;ll notice that it fades off on the right hand side.  This is done with a transparent, faded image that sits on top of the underlying box.  The tags underneath are clickable links but the image blocks events from being sent to the ones underneath the fade.</p>
<div><a href="http://demos.hacks.mozilla.org/openweb/pointer-events/"><img src="http://hacks.mozilla.org/wp-content/uploads/2009/11/faded-twitter.png" alt="" /></a></div>
<p>What Paul has done is show how you can use the <code>pointer-events</code> property to allow you to click on the underlying links even with a fade on top of it.</p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2009/12/pointer-events-for-html-in-firefox-3-6/feed/</wfw:commentRss>
		<slash:comments>31</slash:comments>
		</item>
		<item>
		<title>css gradients in Firefox 3.6</title>
		<link>http://hacks.mozilla.org/2009/11/css-gradients-firefox-36/</link>
		<comments>http://hacks.mozilla.org/2009/11/css-gradients-firefox-36/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 18:15:25 +0000</pubDate>
		<dc:creator>Alix Franquet</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Feature]]></category>
		<category><![CDATA[Featured Article]]></category>
		<category><![CDATA[Firefox 3.6]]></category>
		<category><![CDATA[Standards]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=2365</guid>
		<description><![CDATA[  ]]></description>
			<content:encoded><![CDATA[<p>Firefox 3.6 includes many <a href="https://developer.mozilla.org/en/Firefox_3.6_for_developers#CSS">CSS improvements</a>. In this post we&#8217;re going to show you how to use CSS gradients.</p>
<p>If you are running the latest <a href="http://www.mozilla.com/firefox/all-rc.html">beta of Firefox 3.6</a>, you should check out our <a href="http://demos.hacks.mozilla.org/openweb/cssBackground/gradients/">interactive demo</a> and take a look at the corresponding code. Use the radio buttons to switch different style options on or off.</p>
<p><strong>Backgrounds with CSS Gradients</strong></p>
<p>Using CSS gradients in a background allows you to display smooth transitions between two or more specified colors without having to use images. This in turn reduces download time and bandwidth use, looks better while zooming, and lets you create a more flexible layout.</p>
<p>Firefox 3.6 supports two kinds of CSS gradients: linear (<a href="https://developer.mozilla.org/en/CSS/-moz-linear-gradient">-moz-linear-gradient</a>) and radial (<a href="https://developer.mozilla.org/en/CSS/-moz-radial-gradient">-moz-radial-gradient</a>).</p>
<p><strong>Linear Gradients</strong></p>
<p>To create a <a href="https://developer.mozilla.org/en/CSS/-moz-linear-gradient">linear gradient</a>, you&#8217;ll need to set a starting point and a direction (or angle) for the gradient  and to define the color stops.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"> -moz-linear-gradient<span style="color: #00AA00;">&#40;</span> <span style="color: #00AA00;">&#91;</span>&lt;point<span style="color: #00AA00;">&gt;</span> || &lt;angle<span style="color: #00AA00;">&gt;,</span><span style="color: #00AA00;">&#93;</span>? &lt;stop<span style="color: #00AA00;">&gt;,</span> &lt;stop<span style="color: #00AA00;">&gt;</span> <span style="color: #00AA00;">&#91;</span><span style="color: #00AA00;">,</span> &lt;stop<span style="color: #00AA00;">&gt;</span><span style="color: #00AA00;">&#93;</span><span style="color: #00AA00;">*</span> <span style="color: #00AA00;">&#41;</span></pre></div></div>

<p><strong>Starting Point.</strong> The starting point works just like <a href="http://www.w3.org/TR/css3-background/#the-background-position">background position</a>. You can set the horizontal and the vertical positions as a percentage, in pixels, or using left/center/right for horizontal, and top/center/bottom for vertical. Positions start from the top left corner. If you don&#8217;t specify the horizontal or the vertical position, it will default to center.</p>
<p>For example, here&#8217;s a linear gradient that starts at the center (horizontal) and top (vertical), and goes from blue to white:</p>
<p><img class="aligncenter size-full wp-image-2436" title="basic_linear_bluetop" src="http://hacks.mozilla.org/wp-content/uploads/2009/11/basic_linear_bluetop.png" alt="basic_linear_bluetop" width="116" height="116" /></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">  <span style="color: #6666ff;">.linear_gradient_square</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#333</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -moz-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">blue</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>One that starts left (horizontal) and center (vertical):</p>
<p><img class="aligncenter size-full wp-image-2439" title="basic_linear_blueleft" src="http://hacks.mozilla.org/wp-content/uploads/2009/11/basic_linear_blueleft.png" alt="basic_linear_blueleft" width="111" height="111" /></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -moz-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">blue</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span></pre></div></div>

<p>And a gradient starting left (horizontal) and top (vertical):</p>
<p><img class="aligncenter size-full wp-image-2443" title="basic_linear_bluetopleft" src="http://hacks.mozilla.org/wp-content/uploads/2009/11/basic_linear_bluetopleft.png" alt="basic_linear_bluetopleft" width="109" height="110" /></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -moz-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">blue</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span></pre></div></div>

<p><strong>Angle</strong>. As you can see above, if you don&#8217;t specify an angle, it is defined automatically based on the start position. If you would like more control over the direction of the gradient, you can set the <a href="http://www.w3.org/TR/css3-values/#angles">angle</a> as well.</p>
<p>For example, the following gradients have the same starting point of left center, but the one on the right hand-side also has an angle of 20 degrees.</p>
<p><img class="aligncenter size-full wp-image-2501" title="linear_gradient_angle" src="http://hacks.mozilla.org/wp-content/uploads/2009/11/linear_gradient_angle.png" alt="linear_gradient_angle" width="231" height="119" /></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -moz-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">left</span> 20deg<span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">black</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span></pre></div></div>

<p>When specifying the angle, remember that is it the angle between a horizontal line and the gradient line, going counter-clockwise. So using 0deg will generate a left to right horizontal gradient, while 90deg will create a vertical gradient from the bottom to the top.</p>
<p><img class="aligncenter size-full wp-image-2455" title="linear_redangles" src="http://hacks.mozilla.org/wp-content/uploads/2009/11/linear_redangles.png" alt="linear_redangles" width="487" height="124" /></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -moz-linear-gradient<span style="color: #00AA00;">&#40;</span>&lt;angle<span style="color: #00AA00;">&gt;,</span> <span style="color: #993333;">red</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span></pre></div></div>

<p><strong>Color Stops.</strong> In addition to start position and angle, you should specify color stops. Color stops are points along the gradient line that will have the specified color at the specified location (set as a percentage or length). The number of color stops is unlimited. If you use a percentage for the location, 0% represents the starting point, and 100% is the ending point, but values above and below those can be used to achieve the desired effect.</p>
<p>Here&#8217;s a simple example with three color stops. Because no point is specified for the first and last colors, they will default to 0% and 100%.</p>
<p><img class="aligncenter size-full wp-image-2473" title="linear_colorstops" src="http://hacks.mozilla.org/wp-content/uploads/2009/11/linear_colorstops1.png" alt="linear_colorstops" width="108" height="112" /></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -moz-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">blue</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">white</span> <span style="color: #933;">80%</span><span style="color: #00AA00;">,</span> orange<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span></pre></div></div>

<p>Colors will be evenly spaced if no position is specified.</p>
<p><img class="aligncenter size-full wp-image-2470" title="linear_rainbow" src="http://hacks.mozilla.org/wp-content/uploads/2009/11/linear_rainbow.png" alt="linear_rainbow" width="113" height="116" /></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -moz-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">red</span><span style="color: #00AA00;">,</span> orange<span style="color: #00AA00;">,</span> <span style="color: #993333;">yellow</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">green</span><span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">blue</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span></pre></div></div>

<p><strong>Transparency.</strong> Gradients also support transparency. This can be useful, for example, when stacking multiple backgrounds. Here&#8217;s a combination of two backgrounds: one image and one linear gradient from white to transparent white.</p>
<p><img class="aligncenter size-full wp-image-2479" title="linear_multibg_transparent" src="http://hacks.mozilla.org/wp-content/uploads/2009/11/linear_multibg_transparent.png" alt="linear_multibg_transparent" width="643" height="119" /></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.multibackground_transparent</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -moz-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">,</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">255</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">255</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">255</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">255</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">1</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">http://demos.hacks.mozilla.org/openweb/resources/images/patterns/flowers-pattern.jpg</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p><strong>Radial Gradients</strong></p>
<p>The syntax for radial gradients is very similar to that of linear gradients:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"> -moz-radial-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #00AA00;">&#91;</span>&lt;bg-position<span style="color: #00AA00;">&gt;</span> || &lt;angle<span style="color: #00AA00;">&gt;,</span><span style="color: #00AA00;">&#93;</span>? <span style="color: #00AA00;">&#91;</span>&lt;shape<span style="color: #00AA00;">&gt;</span> || &lt;size<span style="color: #00AA00;">&gt;,</span><span style="color: #00AA00;">&#93;</span>? &lt;color-stop<span style="color: #00AA00;">&gt;,</span> &lt;color-stop<span style="color: #00AA00;">&gt;</span><span style="color: #00AA00;">&#91;</span><span style="color: #00AA00;">,</span> &lt;color-stop<span style="color: #00AA00;">&gt;</span><span style="color: #00AA00;">&#93;</span><span style="color: #00AA00;">*</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span></pre></div></div>

<p>In addition to the start position, the direction, and the colors, which you have already seen in linear gradients, radial gradients allow you to specify the gradient&#8217;s shape (circle or ellipse) and size (closest-side, closest-corner, farthest-side, farthest-corner, contain or cover).</p>
<p><strong>Color stops.</strong> Just like with linear gradients, you should define color stops along the gradient line. The following circles have the same color stops, but the gradient on the left defaults to evenly spaced colors, while the one on the right has a specific position for each color.</p>
<p><img src="http://hacks.mozilla.org/wp-content/uploads/2009/11/radial_gradient_stop.png" alt="radial_gradient_stop" title="radial_gradient_stop" width="243" height="115" class="aligncenter size-full wp-image-2609" /></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"> <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -moz-radial-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #993333;">red</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">yellow</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#1E90FF</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
 <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -moz-radial-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #993333;">red</span> <span style="color: #933;">5%</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">yellow</span> <span style="color: #933;">25%</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#1E90FF</span> <span style="color: #933;">50%</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span></pre></div></div>

<p><strong>Shape.</strong> Here you can see the difference between the two possible shapes, a circle (on the left) and an ellipse (on the right), both with a bottom left starting point:</p>
<p><img class="aligncenter size-full wp-image-2488" title="radial_circle_ellipse" src="http://hacks.mozilla.org/wp-content/uploads/2009/11/radial_circle_ellipse.png" alt="radial_circle_ellipse" width="544" height="116" /></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"> <span style="color: #6666ff;">.radial_gradient_circle</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -moz-radial-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">bottom</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">circle</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">red</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">yellow</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#1E90FF</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
 <span style="color: #6666ff;">.radial_gradient_ellipse</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -moz-radial-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">bottom</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">,</span> ellipse<span style="color: #00AA00;">,</span> <span style="color: #993333;">red</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">yellow</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#1E90FF</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p><strong>Size.</strong> The different options for size (closest-side, closest-corner, farthest-side, farthest-corner, contain or cover) refer to the point used to define the size of the circle or ellipse. </p>
<p>Example: closest-side vs. farthest corner for an ellipse.<br />
The following two ellipses have different sizes. The one on the left is set by the distance from the start point (center) to the closest-side, while the one on the right is determined by the distance from the start point to the farthest corner.</p>
<p><img src="http://hacks.mozilla.org/wp-content/uploads/2009/11/radial_ellipse_size.png" alt="radial_ellipse_size" title="radial_ellipse_size" width="500" class="aligncenter size-full wp-image-2612" /></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -moz-radial-gradient<span style="color: #00AA00;">&#40;</span>ellipse closest-side<span style="color: #00AA00;">,</span> <span style="color: #993333;">red</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">yellow</span> <span style="color: #933;">10%</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#1E90FF</span> <span style="color: #933;">50%</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -moz-radial-gradient<span style="color: #00AA00;">&#40;</span>ellipse farthest-corner<span style="color: #00AA00;">,</span> <span style="color: #993333;">red</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">yellow</span> <span style="color: #933;">10%</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#1E90FF</span> <span style="color: #933;">50%</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span></pre></div></div>

<p>Example: closest-side vs. farthest-side for a circle.<br />
The size of the circle on the left is determined by the distance between the start point (the center) and the closest side, while the one on the right is the distance between the start point and the farthest side.</p>
<p><img src="http://hacks.mozilla.org/wp-content/uploads/2009/11/radial_circle_size.png" alt="radial_circle_size" title="radial_circle_size" width="541" height="114" class="aligncenter size-full wp-image-2613" /></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"> <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -moz-radial-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #993333;">circle</span> closest-side<span style="color: #00AA00;">,</span> <span style="color: #993333;">red</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">yellow</span> <span style="color: #933;">10%</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#1E90FF</span> <span style="color: #933;">50%</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
 <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -moz-radial-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #993333;">circle</span> farthest-side<span style="color: #00AA00;">,</span> <span style="color: #993333;">red</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">yellow</span> <span style="color: #933;">10%</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#1E90FF</span> <span style="color: #933;">50%</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span></pre></div></div>

<p>Example: contained circle.<br />
Here you can see the default circle on the left, and the version of the same gradient but contained on the right.</p>
<p><img class="aligncenter size-full wp-image-2495" title="radial_contain" src="http://hacks.mozilla.org/wp-content/uploads/2009/11/radial_contain.png" alt="radial_contain" width="241" height="116" /></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"> <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -moz-radial-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #993333;">red</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">yellow</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#1E90FF</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
 <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -moz-radial-gradient<span style="color: #00AA00;">&#40;</span>contain<span style="color: #00AA00;">,</span> <span style="color: #993333;">red</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">yellow</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#1E90FF</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span></pre></div></div>

<p><strong>Repeating Gradients</strong></p>
<p>If you would like to repeat a gradient, you should use <a href="https://developer.mozilla.org/en/CSS/-moz-repeating-linear-gradient">-moz-repeating-linear-gradient</a> and <a href="https://developer.mozilla.org/en/CSS/-moz-repeating-radial-gradient">-moz-repeating-radial-gradient</a>. </p>
<p>In the examples below, four color stops are specified in each case, and are repeated indefinitely.</p>
<p><img src="http://hacks.mozilla.org/wp-content/uploads/2009/11/repeating_gradients.png" alt="repeating_gradients" title="repeating_gradients" width="257" height="117" class="aligncenter size-full wp-image-2600" /></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"> <span style="color: #6666ff;">.repeating_radial_gradient_example</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -moz-repeating-radial-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">black</span><span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">black</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">white</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">white</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
 <span style="color: #6666ff;">.repeating_linear_gradient_example</span> <span style="color: #00AA00;">&#123;</span>
     <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -moz-repeating-linear-gradient<span style="color: #00AA00;">&#40;</span><span style="color: #000000; font-weight: bold;">top</span> <span style="color: #000000; font-weight: bold;">left</span> -45deg<span style="color: #00AA00;">,</span> <span style="color: #993333;">red</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">red</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">white</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">white</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p><strong>Demo</strong></p>
<p>Check out our <a href="http://demos.hacks.mozilla.org/openweb/cssBackground/gradients/">interactive demo of linear and radial gradients</a> for more examples.</p>
<p>Note that the gradient syntax has changed between Firefox 3.6 beta 1 and beta 2, so if you used gradients with beta 1, you may need to update your code.</p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2009/11/css-gradients-firefox-36/feed/</wfw:commentRss>
		<slash:comments>53</slash:comments>
		</item>
		<item>
		<title>font_dragr: a drag and drop preview tool for fonts</title>
		<link>http://hacks.mozilla.org/2009/10/font_dragr-a-drag-and-drop-preview-tool-for-fonts/</link>
		<comments>http://hacks.mozilla.org/2009/10/font_dragr-a-drag-and-drop-preview-tool-for-fonts/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 17:00:22 +0000</pubDate>
		<dc:creator>Christopher Blizzard</dc:creator>
				<category><![CDATA[@font-face]]></category>
		<category><![CDATA[Demo]]></category>
		<category><![CDATA[Drag and Drop]]></category>
		<category><![CDATA[Feature]]></category>
		<category><![CDATA[Firefox 3.6]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=2086</guid>
		<description><![CDATA[This demo is from our good friend Ryan Seddon who came up with a demo that seems deeply appropriate for this week, given our focus on the future of fonts on the web. If you&#8217;ve ever been editing a page and wanted to know what a particular font looked like without having to upload files [...]]]></description>
			<content:encoded><![CDATA[<p>This demo is from our good friend <a href="http://twitter.com/thecssninja">Ryan Seddon</a> who came up with a demo that seems deeply appropriate for this week, given our focus on the <a href="http://hacks.mozilla.org/2009/10/font-control-for-designers/ ">future</a> of <a href="http://hacks.mozilla.org/2009/10/woff/">fonts on the web</a>.</p>
<p>If you&#8217;ve ever been editing a page and wanted to know what a particular font looked like without having to upload files to a web server and update CSS (so tedious, that!) then this demo is for you.</p>
<p>He&#8217;s come up with a demo that shows what&#8217;s possible when you&#8217;ve got downloadable fonts, drag and drop and editable content.  (If you want to know more about drag and drop we suggest you read his excellent overview of using <a href="http://www.thecssninja.com/javascript/drag-and-drop-upload">drag and drop to do file uploading</a>.)</p>
<p>From <a href="http://www.thecssninja.com/javascript/font-dragr">Ryan&#8217;s description</a>:</p>
<blockquote><p><a href="http://labs.thecssninja.com/font_dragr/">Font dragr</a> is an experimental web app that uses HTML5 &amp; CSS3 to create a useful standalone web based application for testing custom fonts, once you visit it for the first time you don’t need to be online to use it after the initial visit. It allows you, in Firefox 3.6+, to drag and drop font files from your file system into the drop area. The browser will then create a data URL encoded copy to use in the page and render the content in the dropped font.</p></blockquote>
<p>You can either <a href="http://www.thecssninja.com/javascript/font-dragr">read the full description</a>, which contains a lot of useful technical information about how the demo works, or you can <a href="http://labs.thecssninja.com/font_dragr/">view the demo</a> below.  Either way, it&#8217;s nice to see the excellent HTML5 support in Firefox 3.6 coming together with everything else we&#8217;ve added to bring a lot of new capabilities to web developers and users.</p>
<p>Thanks, Ryan!</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="500" height="300" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="flashvars" value="i=20449" /><param name="allowFullScreen" value="true" /><param name="src" value="http://screenr.com/Content/assets/screenr_0817090731.swf" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="500" height="300" src="http://screenr.com/Content/assets/screenr_0817090731.swf" allowfullscreen="true" flashvars="i=20449"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2009/10/font_dragr-a-drag-and-drop-preview-tool-for-fonts/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>a multi-touch drawing demo for Firefox 3.7</title>
		<link>http://hacks.mozilla.org/2009/10/multi-touch/</link>
		<comments>http://hacks.mozilla.org/2009/10/multi-touch/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 22:21:59 +0000</pubDate>
		<dc:creator>Christopher Blizzard</dc:creator>
				<category><![CDATA[Demo]]></category>
		<category><![CDATA[Feature]]></category>
		<category><![CDATA[Featured Demo]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Multi-touch]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=1891</guid>
		<description><![CDATA[Firefox Multitouch at MozChile &#8211; Drawing Canvas Experiment from Marcio Galli on Vimeo. A couple of months ago we featured a video that had some examples of multi-touch working in Firefox. At a recent event in South America, Marcio Galli put together a quick and fun drawing program based on the multi-touch code that we&#8217;ll [...]]]></description>
			<content:encoded><![CDATA[<p><video controls="true"><source src="http://videos.mozilla.org/serv/blizzard/multitouch-draw/multitouch-drawing-small.ogv" type="video/ogg"/><source src="http://videos.mozilla.org/serv/blizzard/multitouch-draw/multitouch-drawing-small.mp4" type="video/mp4"/><object width="500" height="280"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=7026562&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=7026562&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="500" height="280"></embed></object>
<p><a href="http://vimeo.com/7026562">Firefox Multitouch at MozChile &#8211; Drawing Canvas Experiment</a> from <a href="http://vimeo.com/taboca">Marcio Galli</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p></video></p>
<p>A couple of months ago we featured a video that had some examples of <a href="http://hacks.mozilla.org/2009/08/multi-touch-firefox/">multi-touch working in Firefox.</a>  At a recent event in South America, <a href="http://blog.taboca.com/handsfree-drawing-demo-for-firefox-multitouch">Marcio Galli put together a quick and fun drawing program</a> based on the multi-touch code that we&#8217;ll have in a later release of Firefox.  What&#8217;s really great is that he was able to put this together in just a couple of hours based on the web platform.</p>
<p>There are three main components to the touch support in Firefox:</p>
<p>1. Touch-based scrolling and panning for the browser.  This allows you, as a user, to scroll web pages, select text, open menus, select buttons, etc.  This is part of Firefox 3.6.</p>
<p>2. Implement a new CSS selector that will tell you if you&#8217;re on a touch-enabled device.  This is <code><a href="https://developer.mozilla.org/en/CSS/:-moz-system-metric%28touch-enabled%29">-moz-system-metric(touch-enabled)</a></code>.  You can use this in your CSS to adjust the size of UI elements to fit people&#8217;s fingers.  This is part of Firefox 3.6.</p>
<p>3. Exposing multi-touch data to web pages.  This takes the form of DOM events much like mouse events you can catch today.  This isn&#8217;t part of Firefox 3.6, but is likely to be part of Firefox 3.7.</p>
<p>Although not all of this will be in our next release we thought it would be fun for people to see what will be possible with the release after 3.6.</p>
<p>Note: You can find the sample code on <a href="http://www.mgalli.com/development/drawing/">Marcio&#8217;s page for the demo</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2009/10/multi-touch/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
<enclosure url="http://videos.mozilla.org/serv/blizzard/multitouch-draw/multitouch-drawing-small.ogv" length="12759187" type="video/ogg" />
		</item>
		<item>
		<title>new device API for Firefox 3.6: orientation</title>
		<link>http://hacks.mozilla.org/2009/10/orientation-for-firefox/</link>
		<comments>http://hacks.mozilla.org/2009/10/orientation-for-firefox/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 23:17:48 +0000</pubDate>
		<dc:creator>Christopher Blizzard</dc:creator>
				<category><![CDATA[Demo]]></category>
		<category><![CDATA[Device APIs]]></category>
		<category><![CDATA[Feature]]></category>
		<category><![CDATA[Featured Demo]]></category>
		<category><![CDATA[Firefox 3.6]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=1860</guid>
		<description><![CDATA[One new feature that we&#8217;re including as part of Firefox 3.6 is support for web pages to access machine orientation information if it&#8217;s available. As you can see from the demo above you can use it to figure out if the machine is moving and what direction it&#8217;s facing. Using the API is very simple. [...]]]></description>
			<content:encoded><![CDATA[<p><video width="500" controls><source type="video/ogg" src="http://videos.mozilla.org/serv/blizzard/orientation-demo/mozOrientation.ogv"/><source type="video/mp4" src="http://videos.mozilla.org/serv/blizzard/orientation-demo/mozOrientation.mp4"/><embed src="http://blip.tv/play/AYGm2xMC" type="application/x-shockwave-flash" width="480" height="390" allowscriptaccess="always" allowfullscreen="true"></embed></video></p>
<p>One new feature that we&#8217;re including as part of Firefox 3.6 is support for web pages to access machine orientation information if it&#8217;s available.  As you can see from the demo above you can use it to figure out if the machine is moving and what direction it&#8217;s facing.</p>
<p>Using the API is very simple.  All you have to do is add a simple event listener:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">window.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;MozOrientation&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        <span style="color: #009966; font-style: italic;">/* 3 values: e.x, e.y, e.z */</span>
                        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Originally built as something that we would include for our upcoming mobile browser release, we&#8217;ve made it available on desktop systems as well.  Many modern Macbooks and Thinkpads contain devices and drivers that expose this information.  We&#8217;ve added support for Linux, Macs and some Thinkpads where drivers and devices are available.  (Note, on some Macbooks detect the orientation information backwards &#8211; we&#8217;re working on that.)</p>
<p>You can find more information on <a href="http://dougt.org/wordpress/2009/08/orientation/">two</a> <a href="http://dougt.org/wordpress/2009/08/orientation-update/">posts</a> by Doug Turner and an update on <a href="http://www.bitstampede.com/2009/10/01/device-orientation-documentation/">documentation for orientation</a> from Eric Shepherd.</p>
<p><a href="http://blog.mozbox.org/post/2009/10/12/Some-new-demos">Paul Rouget</a> has this and some other demos up in one of his posts.</p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2009/10/orientation-for-firefox/feed/</wfw:commentRss>
		<slash:comments>61</slash:comments>
<enclosure url="http://videos.mozilla.org/serv/blizzard/orientation-demo/mozOrientation.ogv" length="11252636" type="video/ogg" />
		</item>
		<item>
		<title>mitigating attacks with content security policy</title>
		<link>http://hacks.mozilla.org/2009/10/content-security-policy/</link>
		<comments>http://hacks.mozilla.org/2009/10/content-security-policy/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 21:08:56 +0000</pubDate>
		<dc:creator>Christopher Blizzard</dc:creator>
				<category><![CDATA[Demo]]></category>
		<category><![CDATA[Feature]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Standards]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=1796</guid>
		<description><![CDATA[Firefox support for Content Security Policy (CSP) has been in the news and is now available in test builds for web developers to try. Support for CSP isn&#8217;t slated for Firefox 3.6 but is likely to be included in the release after 3.6, mostly likely called 3.7. This post is targeted at web developers and [...]]]></description>
			<content:encoded><![CDATA[<p>Firefox support for <a href="http://people.mozilla.org/~bsterne/content-security-policy/index.html">Content Security Policy (CSP)</a> has been <a href="http://blog.mozilla.com/news/2009/10/05/mozillas-content-security-policy-in-the-news/">in the news</a> and is <a href="https://build.mozilla.org/tryserver-builds/bsterne@mozilla.com-1254264686/">now available in test builds</a> for web developers to try.  Support for CSP isn&#8217;t slated for Firefox 3.6 but is likely to be included in the release after 3.6, mostly likely called 3.7.</p>
<p>This post is targeted at web developers and gives a quick overview of the three kinds of attacks that CSP helps to mitigate and also gives some quick examples so developers can get a sense of how it will work for them.</p>
<p>In case you don&#8217;t know what our Content Security Policy code is &#8211; and based on anecdotal evidence a lot of people don&#8217;t &#8211; it&#8217;s a set of easy to use tools that allow a web site owner to tell the browser where it should or should not load resources from.  In particular it aims to prevent three different classes of common attacks we see on the web today: <a href="http://www.owasp.org/index.php/Cross_Site_Scripting">cross-site scripting</a>, <a href="http://ha.ckers.org/blog/20080915/clickjacking/">clickjacking</a> and packet sniffing attacks.</p>
<p><strong>Cross-site scripting attacks</strong> are largely the result of a mistake made on backend web servers where someone fails to escape data that&#8217;s submitted by users.  When that happens it&#8217;s possible to inject a tag to load JavaScript code from another web site.  That code could be harmless but it could also contain something dangerous, like malware.  What CSP does is make it possible for a web site author, via HTTP headers, to specify what types of scripts can be loaded and from where.  For developers who are setting a policy, it adds a layer of protection where even if they make a mistake it is likely to be mitigated by this additional layer of policy.</p>
<p><strong>Clickjacking attacks</strong> are where someone embeds a page into a transparent iframe and &#8220;steals&#8221; user clicks to activate something dangerous.  One particular attack allows a browser to be <a href="http://jeremiahgrossman.blogspot.com/2008/10/clickjacking-web-pages-can-see-and-hear.html">turned into a remote surveillance device</a>.  CSP includes the ability for a page to tell the browser that it never wants to be ever included in an iframe.</p>
<p>And last is the ability for a web site to tell the browser that it <strong>never wants resources from that page to be loaded over unencrypted HTTP</strong>.  Banking and other commerce sites will find this particularly useful.</p>
<p>CSP is very powerful and flexible, allowing you to specify whether or not you want to load different kinds of media, different kinds of script methods, css, can be used to set up loading only from specific other hosts and a large number of other things.  It&#8217;s meant to be very easy to set up for simple cases but will scale up to pretty complex infrastructure where different resources might be spread out over a large number of machines.</p>
<p>Here are four examples that show common use cases.  Each of these examples is a header that&#8217;s delivered as a header over HTTP and it affects how the page is rendered.</p>
<p>A site wants all of its content to come from its own domain:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">X-Content-Security-Policy: allow 'self'</pre></div></div>

<p>Example 2: An auction site wants to be able to load images from anywhere, plugin content from a list of trusted media providers and a CDN network and scripts only from its server hosting sanitized JavaScript:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">X-Content-Security-Policy: allow 'self'; img-src *; \
                           object-src media1.com media2.com *.cdn.com; \
                           script-src trustedscripts.example.com</pre></div></div>

<p>Example 3: Server administrators want to deny all third-party scripts for the site, and a given project group also wants to disallow media from other sites (header provided by sysadmins and header provided by project group are both present):</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">X-Content-Security-Policy: allow *; script-src 'self'
X-Content-Security-Policy: allow *; script-src 'self'; media-src 'self';</pre></div></div>

<p>Example 4: An online payments site wants to ensure that all of the content in its page is loaded over SSL to prevent attackers from eavesdropping on requests for insecure content:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">X-Content-Security-Policy: allow https://*:443</pre></div></div>

<p>The implementation isn&#8217;t quite complete yet, but it&#8217;s pretty close.  There&#8217;s more information on the <a href="http://people.mozilla.org/~bsterne/content-security-policy/demo.cgi">demo page</a> for CSP, read the <a href="http://people.mozilla.org/~bsterne/content-security-policy/index.html">overview</a> or read the <a href="https://wiki.mozilla.org/Security/CSP/Spec">spec itself.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2009/10/content-security-policy/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Firefox 3.6 Alpha 1 &#8211; web developer changes</title>
		<link>http://hacks.mozilla.org/2009/08/firefox-36a1-for-developers/</link>
		<comments>http://hacks.mozilla.org/2009/08/firefox-36a1-for-developers/#comments</comments>
		<pubDate>Sat, 08 Aug 2009 02:40:53 +0000</pubDate>
		<dc:creator>Christopher Blizzard</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Feature]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Firefox 3.6]]></category>
		<category><![CDATA[Standards]]></category>
		<category><![CDATA[TraceMonkey]]></category>

		<guid isPermaLink="false">http://hacks.mozilla.org/?p=1546</guid>
		<description><![CDATA[As covered on the Mozilla Developer Center, Firefox 3.6 Alpha 1 is now available for download. And we&#8217;ve been busy since Firefox 3.5. Web developers will be interested in a number of features that are new in Firefox 3.6 Alpha 1: The TraceMonkey JavaScript engine has continued to get faster. We&#8217;ve made a huge number [...]]]></description>
			<content:encoded><![CDATA[<p>As covered on the <a href="http://developer.mozilla.org/devnews/">Mozilla Developer Center</a>, <a href="https://developer.mozilla.org/devnews/index.php/2009/08/07/firefox-3-6-alpha-1-now-available-for-download/">Firefox 3.6 Alpha 1 is now available for download</a>.  And we&#8217;ve <a href="https://bugzilla.mozilla.org/buglist.cgi?query_format=advanced&#038;product=Core&#038;product=Firefox&#038;product=NSPR&#038;product=NSS&#038;product=Toolkit&#038;keywords_type=nowords&#038;keywords=fixed1.9.1%2C+verified1.9.1&#038;resolution=FIXED&#038;chfieldfrom=2008-12-01&#038;chfieldto=Now&#038;chfield=resolution&#038;chfieldvalue=FIXED">been busy since Firefox 3.5</a>. </p>
<p>Web developers will be interested in a number of features that are new in Firefox 3.6 Alpha 1:</p>
<ul>
<li>The <a href="http://hacks.mozilla.org/2009/07/tracemonkey-overview/">TraceMonkey JavaScript</a> engine has continued to get faster.
<li>We&#8217;ve made a huge number of improvements to overall DOM and element layout performance.  In some cases we&#8217;re much, much faster.  We&#8217;ll cover details on those in a later post.
<li>The <a href="http://groups.google.com/group/mozilla.dev.platform/browse_thread/thread/e2b791ffc84ee3f4/60c2134a18c2f81a">compositor</a> landing has made it possible to fix a large number of interactions between web content, CSS and plugins.  We&#8217;ll be talking about this in a later post as well.
<li>We now support the <a href="https://developer.mozilla.org/en/CSS/-moz-background-size">-moz-background-size</a> CSS property which lets you set the size of background images.
<li>We now support <a href="https://developer.mozilla.org/en/CSS/Gradients">CSS Gradients</a>.
<li>We now support multiple background images.
<li>We now support the <code>rem</code> unit as a <a href="http://www.w3.org/TR/css3-values/#lengths">CSS unit</a>.
<li><a href="https://developer.mozilla.org/en/CSS/image-rendering">image-rendering</a> is supported for images, background images, videos and canvases.
<li>We now send a <code>reorder</code> event to embedded frames and iframes when their document is loaded.
<li>We&#8217;ve removed the <code>getBoxObjectFor()</code> method.  It was non-standard and exposed all kinds of non-standard stuff to the web.
<li>We now send a <code>hashchange</code> event to a page whenever the URI part after the <code>#</code> changes.
<li>We now have Geolocation <code>address</code> support for user-readable position information.
<li>We now support the <code>complete</code> attribute on <code>document.readystate</code>.
</ul>
<p>You can keep track of this list and other features for XUL and add-ons developers on the <a href="https://developer.mozilla.org/en/Firefox_3.6_for_developers">Firefox 3.6 for developers</a> page on <a href="http://developer.mozilla.org">developer.mozilla.org</a></p>
<p>Unlike the year that passed between Firefox 3 and Firefox 3.5, we expect that this 3.6 release will be released in a small number of months.  Our main focus for the 3.6 release will be end-user perceived performance, TraceMonkey and DOM performance and new web developer features.</p>
<p>Enjoy and test away!</p>
]]></content:encoded>
			<wfw:commentRss>http://hacks.mozilla.org/2009/08/firefox-36a1-for-developers/feed/</wfw:commentRss>
		<slash:comments>53</slash:comments>
		</item>
	</channel>
</rss>

