<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Ajaxian » Front Page</title>
	
	<link>http://ajaxian.com</link>
	<description>Cleaning up the web with Ajax</description>
	<lastBuildDate>Thu, 02 Sep 2010 10:30:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<feedburner:info uri="ajaxian" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://ajaxian.com/index.xml" /><feedburner:browserFriendly>This is an XML content feed. It is intended to be viewed in a newsreader or syndicated to another site, subject to copyright and fair use.</feedburner:browserFriendly><item>
		<title>A Drumbeat for the Open Web</title>
		<link>http://feedproxy.google.com/~r/ajaxian/~3/6ZpRgYms0rQ/a-drumbeat-for-the-open-web</link>
		<comments>http://ajaxian.com/archives/a-drumbeat-for-the-open-web#comments</comments>
		<pubDate>Thu, 02 Sep 2010 10:30:40 +0000</pubDate>
		<dc:creator>Brad Neuberg</dc:creator>
				<category><![CDATA[Front Page]]></category>
		<category><![CDATA[Mozilla]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=10141</guid>
		<description><![CDATA[
I stumbled on the Mozilla Foundation&#8217;s Drumbeat project recently:
Drumbeat gathers smart, creative people like you around big ideas, practical projects and local events that improve the open web.
It&#8217;s very well done combination of projects + community.
There&#8217;s a whole slew of cool projects already one here. A small sample:





]]></description>
			<content:encoded><![CDATA[<p><a href="http://ajaxian.com/wp-content/images/drumbeat_logo.png"><img class="aligncenter size-full wp-image-10142" title="drumbeat_logo" src="http://ajaxian.com/wp-content/images/drumbeat_logo.png" alt="" width="384" height="105" /></a></p>
<p>I stumbled on the Mozilla Foundation&#8217;s <a href="http://www.drumbeat.org">Drumbeat</a> project recently:</p>
<blockquote><p>Drumbeat gathers smart, creative people like you around big ideas, practical projects and local events that improve the open web.</p></blockquote>
<p>It&#8217;s very well done combination of projects + community.</p>
<div id="attachment_10143" class="wp-caption aligncenter" style="width: 410px"><a href="http://ajaxian.com/wp-content/images/4550572473_2ae27b4fea.jpg"><img class="size-full wp-image-10143 " title="4550572473_2ae27b4fea" src="http://ajaxian.com/wp-content/images/4550572473_2ae27b4fea.jpg" alt="" width="400" height="266" /></a><p class="wp-caption-text">Drumbeat Toronto Meetup</p></div>
<p><span style="font-size: 13.1944px;">There&#8217;s a whole slew of cool projects already one here. A small sample:</span></p>
<p><a href="http://www.drumbeat.org/universal-subtitles"><img class="aligncenter size-full wp-image-10144" title="drumbeat1" src="http://ajaxian.com/wp-content/images/drumbeat1.png" alt="" width="226" height="200" /></a><br />
<a href="http://www.drumbeat.org/webmademovies"><img class="aligncenter size-full wp-image-10145" title="drumbeat2" src="http://ajaxian.com/wp-content/images/drumbeat2.png" alt="" width="226" height="200" /></a><br />
<a href="http://www.drumbeat.org/p2pu-webcraft"><img class="aligncenter size-full wp-image-10146" title="drumbeat3" src="http://ajaxian.com/wp-content/images/drumbeat3.png" alt="" width="226" height="200" /></a><br />
<a href="http://www.drumbeat.org/project/open-video-60-seconds"><img class="aligncenter size-full wp-image-10147" title="drumbeat4" src="http://ajaxian.com/wp-content/images/drumbeat4.png" alt="" width="226" height="200" /></a><br />
<a href="http://www.drumbeat.org/project/map-web"><img class="aligncenter size-full wp-image-10148" title="drumbeat5" src="http://ajaxian.com/wp-content/images/drumbeat5.png" alt="" width="226" height="200" /></a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ajaxian?a=6ZpRgYms0rQ:D2wJF1uVLVA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=6ZpRgYms0rQ:D2wJF1uVLVA:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=6ZpRgYms0rQ:D2wJF1uVLVA:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ajaxian?i=6ZpRgYms0rQ:D2wJF1uVLVA:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/a-drumbeat-for-the-open-web/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://ajaxian.com/archives/a-drumbeat-for-the-open-web</feedburner:origLink></item>
		<item>
		<title>Extending HTML5</title>
		<link>http://feedproxy.google.com/~r/ajaxian/~3/ehbCSXgVcqY/extending-html5</link>
		<comments>http://ajaxian.com/archives/extending-html5#comments</comments>
		<pubDate>Wed, 01 Sep 2010 10:30:57 +0000</pubDate>
		<dc:creator>Brad Neuberg</dc:creator>
				<category><![CDATA[Front Page]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=10128</guid>
		<description><![CDATA[
Google Rich Snippet
Oli Studholme has an excellent new article on HTML5 Doctor on the different ways HTML5 can be extended with things like microformats, the link tag, and more. Why would you want to do this?
While HTML5 has a bunch of semantic elements, including new ones like &#60;article&#62; and &#60;nav&#62;, sometimes there just isn’t an element with the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://ajaxian.com/wp-content/images/google-rich-snippet2.png"><img class="size-full wp-image-10129 " style="border: 1px solid black;" title="google-rich-snippet2" src="http://ajaxian.com/wp-content/images/google-rich-snippet2.png" alt="" width="380" height="132" /></a><br />
<em>Google Rich Snippet</em><br />
<a title="Posts by Oli Studholme" href="http://html5doctor.com/author/olib/">Oli Studholme</a> has an <a href="http://html5doctor.com/microformats/">excellent new article</a> on <a href="http://html5doctor.com">HTML5 Doctor</a> on the different ways HTML5 can be extended with things like microformats, the link tag, and more. Why would you want to do this?</p>
<blockquote><p>While <abbr>HTML</abbr>5 has a bunch of semantic elements, including new ones like <a title="The article element | HTML5 Doctor" href="http://html5doctor.com/the-article-element/"><code>&lt;article&gt;</code></a> and <a title="Semantic navigation with the nav element | HTML5 Doctor" href="http://html5doctor.com/nav-element/"><code>&lt;nav&gt;</code></a>, sometimes there just isn’t an element with the right meaning. What we want are ways to extend what we’ve got, to add <em>extra semantics</em> that are <em>machine-readable</em> — data that a browser, script, or robot can use.</p></blockquote>
<p>First, he starts with the options HTML4 gave us and what options we now have with HTML5:</p>
<blockquote><p>There were five fundamental ways we could extend <abbr>HTML</abbr> 4:</p>
<ul>
<li><code>&lt;meta&gt;</code> element</li>
<li><code>class</code> attribute</li>
<li><code>rel</code> attribute</li>
<li><code>rev</code> attribute</li>
<li><code>profile</code> attribute</li>
</ul>
<p>In <abbr>HTML</abbr>5, <code>rev</code> has fallen by the wayside, becoming obsolete since hardly anyone used it correctly, and because it can be replaced by <code>rel</code>. <code>profile</code> is also obsolete, and there is no support for namespaces in <abbr>HTML</abbr>5. However,<code>&lt;meta&gt;</code>, <code>class</code>, and <code>rel</code> <em>are</em> all in <abbr>HTML</abbr>5. In fact, <code>&lt;meta&gt;</code> now has <a title="4 The elements of HTML — HTML5 (Edition for Web Authors)" href="http://dev.w3.org/html5/spec-author-view/semantics.html#standard-metadata-names">spec-defined <code>name</code>s</a> and a way to <a title="MetaExtensions - WHATWG Wiki" href="http://wiki.whatwg.org/wiki/MetaExtensions">submit new<code>name</code> values</a>, and <code>rel</code> has <a title="4.12 Links — HTML5 (Edition for Web Authors)" href="http://dev.w3.org/html5/spec-author-view/links.html#linkTypes">several new link types</a> defined in the <abbr>HTML</abbr>5 specification and <a title="RelExtensions - WHATWG Wiki" href="http://wiki.whatwg.org/wiki/RelExtensions">a way to submit more</a> too.</p>
<p>Even better, <a title="3.2.5 Content models — HTML5 (Edition for Web Authors)" href="http://dev.w3.org/html5/spec-author-view/content-models.html#annotations-for-assistive-technology-products-aria"><abbr>WAI</abbr>-<abbr>ARIA</abbr>’s <code>role</code> and <code>aria-*</code> attributes are allowed in <abbr>HTML</abbr>5</a>, and <abbr>HTML</abbr>5 validators can check <abbr>HTML</abbr>5+ <abbr>ARIA</abbr>. Other new methods of extending <abbr>HTML</abbr>5 include <strong>custom data attributes</strong> (<code>data-*</code>), <strong>microdata</strong>, and <strong><abbr>RDFa</abbr></strong>. Guest doctor <a title="Chris Bewick's web design and development blog" href="http://chrisbewick.com/">Chris Bewick</a> introduced us to <abbr>HTML</abbr>5’s <a title="HTML5 Custom Data Attributes (data-*) | HTML5 Doctor" href="http://html5doctor.com/html5-custom-data-attributes/">new <code>data-*</code> attribute system</a>, which is perfect for adding private custom data for JavaScript, and we’ll no doubt meet microdata and <abbr>RDFa</abbr> sooner or later.</p></blockquote>
<blockquote><p>Finally there are <strong>microformats</strong>. As Dr. Bruce touched on microformats in his article on <a title="The time element (and microformats) | HTML5 Doctor" href="http://html5doctor.com/the-time-element/">the <code>&lt;time&gt;</code> element</a>, let’s delve a little deeper into what microformats are and how to use them in HTML5.</p></blockquote>
<p>Oli then does a great deep dive of microformats, going over the different ones defined by the community to date (there are 33 microformat specifications!) and covering some of the common patterns that you can use if you need to roll your own microformat. If you&#8217;ve been wondering how to use things like hCard, hCalendar, XHTML Friends Network (XFN), etc. in your own systems then definitely give this article a gander.</p>
<p>[<a href="http://johnfallsopp.com/">via John Allsop</a>]</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ajaxian?a=ehbCSXgVcqY:V_I_rf1YSa8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=ehbCSXgVcqY:V_I_rf1YSa8:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=ehbCSXgVcqY:V_I_rf1YSa8:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ajaxian?i=ehbCSXgVcqY:V_I_rf1YSa8:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/extending-html5/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://ajaxian.com/archives/extending-html5</feedburner:origLink></item>
		<item>
		<title>Raphaël 1.5 Released</title>
		<link>http://feedproxy.google.com/~r/ajaxian/~3/OGU5JN9e1sQ/raphael-1-5-released</link>
		<comments>http://ajaxian.com/archives/raphael-1-5-released#comments</comments>
		<pubDate>Tue, 31 Aug 2010 10:30:55 +0000</pubDate>
		<dc:creator>Brad Neuberg</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[Framework]]></category>
		<category><![CDATA[Front Page]]></category>
		<category><![CDATA[SVG]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=10119</guid>
		<description><![CDATA[
Dmitry Baranovskiy and team have released another version of Raphaël, an excellent drawing and animation library backed by SVG (VML on Internet Explorer). New features in Raphaël 1.5 include custom attributes and keyframes. Keyframes can be defined similar to CSS3 Animations:
PLAIN TEXT
JAVASCRIPT:


el.animate&#40;&#123;
&#160; &#160; "20%": &#123;cy: 200, easing: "&#62;"&#125;,
&#160; &#160; "40%": &#123;cy: 100&#125;,
&#160; &#160; "60%": &#123;cy: [...]]]></description>
			<content:encoded><![CDATA[<p><center><a href="http://raphaeljs.com/"><img src="http://ajaxian.com/wp-content/images/raphael_logo.png" alt="" title="raphael_logo" width="131" height="116" class="aligncenter size-full wp-image-10120" /></a></center><br />
<a href="http://dmitry.baranovskiy.com/post/raphael-1.5">Dmitry Baranovskiy and team have released</a> another version of <a href="http://raphaeljs.com/">Raphaël</a>, an excellent drawing and animation library backed by SVG (VML on Internet Explorer). New features in Raphaël 1.5 include custom attributes and keyframes. Keyframes can be defined similar to CSS3 Animations:</p>
<div class="igBar"><a href="javascript:showCodeTxt('javascript-2');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color:#000000; font-weight:bold;">JAVASCRIPT:</span>
<div id="javascript-2">
<div class="javascript">
el.<span style="color: #006600;">animate</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #3366CC;">"20%"</span>: <span style="color:#006600; font-weight:bold;">&#123;</span>cy: <span style="color:#800000;">200</span>, easing: <span style="color: #3366CC;">"&gt;"</span><span style="color:#006600; font-weight:bold;">&#125;</span>,<br />
&nbsp; &nbsp; <span style="color: #3366CC;">"40%"</span>: <span style="color:#006600; font-weight:bold;">&#123;</span>cy: <span style="color:#800000;">100</span><span style="color:#006600; font-weight:bold;">&#125;</span>,<br />
&nbsp; &nbsp; <span style="color: #3366CC;">"60%"</span>: <span style="color:#006600; font-weight:bold;">&#123;</span>cy: <span style="color:#800000;">200</span><span style="color:#006600; font-weight:bold;">&#125;</span>,<br />
&nbsp; &nbsp; <span style="color: #3366CC;">"80%"</span>: <span style="color:#006600; font-weight:bold;">&#123;</span>cy: <span style="color:#800000;">300</span>, callback: <span style="color: #003366; font-weight: bold;">function</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#125;</span>,<br />
&nbsp; &nbsp; <span style="color: #3366CC;">"100%"</span>: <span style="color:#006600; font-weight:bold;">&#123;</span>cy: <span style="color:#800000;">200</span><span style="color:#006600; font-weight:bold;">&#125;</span><br />
<span style="color:#006600; font-weight:bold;">&#125;</span>, <span style="color:#800000;">5000</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp;</div>
</div>
</div>
<p><a href="http://raphaeljs.com/bounce.html">Check out a demo</a> of the new keyframe animation.</p>
<p><object type="text/html" data="http://raphaeljs.com/bounce.html" style="width: 500px; height: 400px; overflow: hidden;"></object></p>
<p>Custom attributes is also a new feature that makes it easier to do things like animating a portion of an attribute segment (<a href="http://raphaeljs.com/growing-pie.html">demo</a>).</p>
<p><object type="text/html" data="http://raphaeljs.com/growing-pie.html" style="width: 500px; height: 400px; overflow: hidden;"></object></p>
<p>Full release notes:</p>
<ul>
<li>fixed IE8 issue with the HTML element named Raphael
</li>
<li>fixed precision for arcs in IE
</li>
<li>added caching to getPointAtSegmentLength function
</li>
<li>added ability to do more than one animation of an element at the same time
</li>
<li>added "cubic-bezier()" as an easing method
</li>
<li>added new syntax for animation (keyframes)
</li>
<li>hsl2rgb now accept h as degree (0..360), s and b as % (0..100)
</li>
<li>show="new" instead of target="blank" for SVG
</li>
<li>added angle method
</li>
<li>added snapTo method
</li>
<li>cached popup || activeX for IE
</li>
<li>fixed insertAfter
</li>
<li>fixed timeouts for animation
</li>
<li>added customAttributes
</li>
</ul>
<p>BTW I just noticed that Dmitry is now at <a href="http://sencha.com/">Sencha</a>; they're assembling quite the team! Congrats Dmitry!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ajaxian?a=OGU5JN9e1sQ:MYbPNKoFZiA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=OGU5JN9e1sQ:MYbPNKoFZiA:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=OGU5JN9e1sQ:MYbPNKoFZiA:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ajaxian?i=OGU5JN9e1sQ:MYbPNKoFZiA:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/raphael-1-5-released/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://ajaxian.com/archives/raphael-1-5-released</feedburner:origLink></item>
		<item>
		<title>New SVG Web Release: Owlephant</title>
		<link>http://feedproxy.google.com/~r/ajaxian/~3/6b08negBu1U/10195</link>
		<comments>http://ajaxian.com/archives/10195#comments</comments>
		<pubDate>Mon, 30 Aug 2010 23:05:00 +0000</pubDate>
		<dc:creator>Brad Neuberg</dc:creator>
				<category><![CDATA[Front Page]]></category>
		<category><![CDATA[SVG]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=10195</guid>
		<description><![CDATA[The SVG Web team has announced a new release. SVG Web is a drop in JavaScript library that makes it easy to display SVG graphics on Internet Explorer 6, 7, and 8 using Flash.
The new SVG Web release, like all of their releases, is named after especially silly D&#38;D monsters. The new release is code [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://code.google.com/p/svgweb">SVG Web</a> team has announced a new release. SVG Web is a drop in JavaScript library that makes it easy to display SVG graphics on Internet Explorer 6, 7, and 8 using Flash.</p>
<p>The new SVG Web release, like all of their releases, is named after <a href="http://www.headinjurytheater.com/article73.htm">especially silly D&amp;D monsters</a>. The new release is code named Owlephant:</p>
<p><a href="http://codinginparadise.org/images/owlephant.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img style="display: block; margin: 0px auto 10px; text-align: center; cursor: hand; width: 300px; height: 364px;" src="http://codinginparadise.org/images/owlephant.jpg" border="0" alt="" /></a> You've heard of Elephants, you've heard of Owls… put them together and you get the fearsome Owlephant. If you encounter one, be sure it will be the last thing you ever, um, encounter. Hoot…. stomp!</p>
<p>With this release SVG Web now scores 55.45% on the <a href="http://www.codedread.com/svg-support.php">SVG compatibility charts</a>, almost at the same level as IE 9 (58%).</p>
<p>Major aspects of this new release includes overhauls and fixes for gradients, clipping, events, text placement, and more. It also includes a huge step forward in SMIL animation support, including being able to animate path segments and interpolate their values, scripting SMIL with JavaScript, and more.</p>
<p>This release has been built by the community, with major contributions from Bruce Duncan from <a href="http://visualmining.com/">VisualMining.com</a>; Ken Stacey from <a href="http://svgmaker.com/">SVGMaker.com</a>; and the always awesome (and project co-leader) Rick Masters. Thanks to the many people like Michael Neutze, Bruce Rindahl, and more for their bug testing and evangelism!</p>
<p>Everything fixed in this release:</p>
<ul>
<li><a class="closed_ref" title="Radial gradient different between Flash and Native renders" href="http://www.blogger.com/p/svgweb/issues/detail?id=471"> Issue 471 </a>: Radial gradient different between Flash and Native renders</li>
<li><a class="closed_ref" title="gradients with bounding box cooordinates are positioned wrongly on circles" href="http://www.blogger.com/p/svgweb/issues/detail?id=349"> Issue 349 </a>: gradients with bounding box cooordinates are positioned wrongly on circles</li>
<li><a class="closed_ref" title="'this' not getting set correctly in SVG element event callback" href="http://www.blogger.com/p/svgweb/issues/detail?id=475"> Issue 475 </a>: 'this' not getting set correctly in SVG element event callback</li>
<li><a class="closed_ref" title="The change in the size of the ClipPath area is not reflected by Flash Renderer. " href="http://www.blogger.com/p/svgweb/issues/detail?id=477"> Issue 477 </a>: The change in the size of the ClipPath area is not reflected by Flash Renderer.</li>
<li><a class="closed_ref" title="Changing gradient stop does not trigger redraw of referencing elements" href="http://www.blogger.com/p/svgweb/issues/detail?id=483"> Issue 483 </a>: Changing gradient stop does not trigger redraw of referencing elements</li>
<li><a class="closed_ref" title="Dynamic clip-path attribute changes are not reflected." href="http://www.blogger.com/p/svgweb/issues/detail?id=484"> Issue 484 </a>: Dynamic clip-path attribute changes are not reflected.</li>
<li><a class="closed_ref" title="&lt;set&gt; Element Problems and numerous SMIL issues" href="http://www.blogger.com/p/svgweb/issues/detail?id=476"> Issue 476 </a>: <tt>set</tt> Element Problems and numerous SMIL issues</li>
<li><a class="closed_ref" title="Support beginElement() for animation elements" href="http://www.blogger.com/p/svgweb/issues/detail?id=489"> Issue 489 </a>: Support beginElement() for animation elements</li>
<li><a class="closed_ref" title="SVGTextNode.onDrawGlyph not removing glyph clones" href="http://www.blogger.com/p/svgweb/issues/detail?id=494"> Issue 494 </a>: SVGTextNode.onDrawGlyph not removing glyph clones</li>
<li><a class="closed_ref" title="Support units-per-em on SVG fonts" href="http://www.blogger.com/p/svgweb/issues/detail?id=495"> Issue 495 </a>: Support units-per-em on SVG fonts</li>
<li><a class="closed_ref" title="'button' property missing in mouse event object" href="http://www.blogger.com/p/svgweb/issues/detail?id=492"> Issue 492 </a>: 'button' property missing in mouse event object</li>
<li><a class="closed_ref" title="get svg.js even more compressed with Google's closure compiler" href="http://www.blogger.com/p/svgweb/issues/detail?id=472"> Issue 472 </a>: get svg.js even more compressed with Google's closure compiler (30K reduction)</li>
<li><a class="closed_ref" title="Object loaded svg with scripts not firing window load or SVGLoad event" href="http://www.blogger.com/p/svgweb/issues/detail?id=499"> Issue 499 </a>: Object loaded svg with scripts not firing window load or SVGLoad event</li>
<li><a class="closed_ref" title="Updating styles via Javascript does not visibly update child nodes in IE/Flash" href="http://www.blogger.com/p/svgweb/issues/detail?id=488"> Issue 488 </a>: Updating styles via Javascript does not visibly update child nodes in IE/Flash</li>
<li><a class="closed_ref" title="Support exponent values in path values" href="http://www.blogger.com/p/svgweb/issues/detail?id=496"> Issue 496 </a>: Support exponents in path values</li>
<li><a class="closed_ref" title="Radial Gradient userSpaceOnUse Matrix calculated incorrectly" href="http://www.blogger.com/p/svgweb/issues/detail?id=502"> Issue 502 </a>: Radial Gradient userSpaceOnUse Matrix calculated incorrectly</li>
<li><a class="closed_ref" title="Radial Gradient focalLen not used for stroke" href="http://www.blogger.com/p/svgweb/issues/detail?id=503"> Issue 503 </a>: Radial Gradient focalLen not used for stroke</li>
<li><a class="closed_ref" title="Radial Gradient userSpaceOnUse Matrix calculated incorrectly for SVGCircle and SVGEllipse nodes" href="http://www.blogger.com/p/svgweb/issues/detail?id=504"> Issue 504 </a>: Radial Gradient userSpaceOnUse Matrix calculated incorrectly for SVGCircle and SVGEllipse nodes</li>
<li><a class="closed_ref" title="bad 'target' when click on text node" href="http://www.blogger.com/p/svgweb/issues/detail?id=497"> Issue 497 </a>: bad 'target' when click on text node</li>
<li><a class="closed_ref" title="Event handler fires only after second mouse click." href="http://www.blogger.com/p/svgweb/issues/detail?id=342"> Issue 342 </a>: Event handler fires only after second mouse click.</li>
<li><a class="closed_ref" title="Namespaced elements not allowed until svg element added to page" href="http://www.blogger.com/p/svgweb/issues/detail?id=507"> Issue 507 </a>: Namespaced elements not allowed until svg element added to page</li>
<li><a title="Rotated text not rendering for native fonts" href="http://www.blogger.com/p/svgweb/issues/detail?id=158">Issue 158</a>: Rotated text not rendering for native fonts (Mostly Fixed)</li>
<li><a class="closed_ref" title="Namespace exception loading video example in IE8" href="http://www.blogger.com/p/svgweb/issues/detail?id=467"> Issue 467 </a>: Namespace exception loading video example in IE8</li>
<li><a class="closed_ref" title="Font Family not used when surrounded by single quotes in Flash 10.1" href="http://www.blogger.com/p/svgweb/issues/detail?id=510"> Issue 510 </a>: Font Family not used when surrounded by single quotes in Flash 10.1</li>
<li><a class="closed_ref" title="SVG default fill-rule  'nonzero' not supported by flash 9" href="http://www.blogger.com/p/svgweb/issues/detail?id=57"> Issue 57 </a>: SVG default fill-rule 'nonzero' not supported by flash 9</li>
<li><a class="closed_ref" title="Nested &lt;svg&gt; elements don't show up in the DOM correctly" href="http://www.blogger.com/p/svgweb/issues/detail?id=123"> Issue 123 </a>: Nested <tt>svg</tt> elements don't show up in the DOM correctly</li>
<li><a title="Create unit tests around dynamically creating SMIL elements and attributes" href="http://www.blogger.com/p/svgweb/issues/detail?id=145">Issue 145</a>: dynamically creating SMIL elements and attributes</li>
<li><a class="closed_ref" title="Show SVG Web Release Name and Revision in Right Click Menu" href="http://www.blogger.com/p/svgweb/issues/detail?id=356"> Issue 356 </a>: Show SVG Web Release Name and Revision in Right Click Menu</li>
<li><a class="closed_ref" title="getElementsByTagNameNS returning text nodes" href="http://www.blogger.com/p/svgweb/issues/detail?id=513"> Issue 513 </a>: getElementsByTagNameNS returning text nodes</li>
<li><a class="closed_ref" title="Call handleEvent on EventListener objects passed to addEventListener" href="http://www.blogger.com/p/svgweb/issues/detail?id=515"> Issue 515 </a>: Call handleEvent on EventListener objects passed to addEventListener</li>
<li><a class="closed_ref" title="Elements with fill set to 'none' should produce mouse events but do not" href="http://www.blogger.com/p/svgweb/issues/detail?id=517"> Issue 517 </a>: Elements with fill set to 'none' should produce mouse events but do not</li>
<li><a class="closed_ref" title="Avoid redraw on change to pointer-events attribute" href="http://www.blogger.com/p/svgweb/issues/detail?id=518"> Issue 518 </a>: Avoid redraw on change to pointer-events attribute</li>
<li><a class="closed_ref" title="Event listener from object element may be applied to svg element erroneously" href="http://www.blogger.com/p/svgweb/issues/detail?id=523"> Issue 523 </a>: Event listener from object element may be applied to svg element erroneously</li>
<li><a class="closed_ref" title="Need way to create element with self declared namespace" href="http://www.blogger.com/p/svgweb/issues/detail?id=522"> Issue 522 </a>: Need way to create element with self declared namespace</li>
<li><a class="closed_ref" title="Image element not respecting display='none'" href="http://www.blogger.com/p/svgweb/issues/detail?id=525"> Issue 525 </a>: Image element not respecting display='none'</li>
<li><a class="closed_ref" title="Jquery $(window).scroll event will not fire after including the latest SVG Web release into the project" href="http://www.blogger.com/p/svgweb/issues/detail?id=524"> Issue 524 </a>: Jquery $(window).scroll event will not fire</li>
<li><a class="closed_ref" title="Excessive messages for detached event listeners" href="http://www.blogger.com/p/svgweb/issues/detail?id=527"> Issue 527 </a>: Excessive messages for detached event listeners</li>
<li><a class="closed_ref" title="Exception if remove event listener from detached element, then add to document" href="http://www.blogger.com/p/svgweb/issues/detail?id=528"> Issue 528 </a>: Exception if remove event listener from detached element, then add to document</li>
<li><a class="closed_ref" title="Support for animating path &quot;d&quot; attribute" href="http://www.blogger.com/p/svgweb/issues/detail?id=321"> Issue 321 </a>: Support for animating path 'd' attribute (and interpolate between values)</li>
<li><a class="closed_ref" title="clip-path not used when part of style attribute value" href="http://www.blogger.com/p/svgweb/issues/detail?id=514"> Issue 514 </a>: clip-path not used when part of style attribute value</li>
<li><a class="closed_ref" title="Object using clip path cannot have its opacity animated" href="http://www.blogger.com/p/svgweb/issues/detail?id=526"> Issue 526 </a>: Object using clip path cannot have its opacity animated</li>
<li><a class="closed_ref" title="Nested svg disappears when animated" href="http://www.blogger.com/p/svgweb/issues/detail?id=535"> Issue 535 </a>: Nested svg disappears when animated</li>
<li><a class="closed_ref" title="Problems tracking whether elements attached to document or not" href="http://www.blogger.com/p/svgweb/issues/detail?id=536"> Issue 536 </a>: Problems tracking whether elements attached to document or not</li>
<li><a class="closed_ref" title="Animation added in onload listener does not initialize" href="http://www.blogger.com/p/svgweb/issues/detail?id=537"> Issue 537 </a>: Animation added in onload listener does not initialize</li>
<li><a class="closed_ref" title="Node removed while invalid causes endless frame listening" href="http://www.blogger.com/p/svgweb/issues/detail?id=538"> Issue 538 </a>: Node removed while invalid causes endless frame listening</li>
<li><a class="closed_ref" title="Animation with invalid or forward href causes exception" href="http://www.blogger.com/p/svgweb/issues/detail?id=539"> Issue 539 </a>: Animation with invalid or forward href causes exception</li>
<li><a class="closed_ref" title="script stack space quota is exhausted by large svg file" href="http://www.blogger.com/p/svgweb/issues/detail?id=540"> Issue 540 </a>: script stack space quota is exhausted by large svg file</li>
<li><a class="closed_ref" title="Keyboard events are not supported properly" href="http://www.blogger.com/p/svgweb/issues/detail?id=511"> Issue 511 </a>: Keyboard events are not supported properly</li>
</ul>
<p><a href="http://code.google.com/p/svgweb/downloads/list">Download the release now</a> and <a href="http://codinginparadise.org/projects/svgweb/docs/QuickStart.html">get started</a>!</p>
<p>Please note that there are some breaking changes in this release that will affect code that uses older versions of SVG Web; more details <a href="http://codinginparadise.org/projects/svgweb/docs/UserManual.html#breaking_changes">here</a>. Also note that SVG Web does not yet support the native SVG functionality in IE 9 preview releases.</p>
<p>[Disclosure: I'm a member of the SVG Web team]</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ajaxian?a=6b08negBu1U:EFxLTn3AhnY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=6b08negBu1U:EFxLTn3AhnY:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=6b08negBu1U:EFxLTn3AhnY:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ajaxian?i=6b08negBu1U:EFxLTn3AhnY:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/10195/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://ajaxian.com/archives/10195</feedburner:origLink></item>
		<item>
		<title>Design 3D Models in a Browser</title>
		<link>http://feedproxy.google.com/~r/ajaxian/~3/jjEEq2s9e2Y/design-3d-models-in-a-browser</link>
		<comments>http://ajaxian.com/archives/design-3d-models-in-a-browser#comments</comments>
		<pubDate>Mon, 30 Aug 2010 11:00:37 +0000</pubDate>
		<dc:creator>Brad Neuberg</dc:creator>
				<category><![CDATA[3D]]></category>
		<category><![CDATA[Canvas]]></category>
		<category><![CDATA[Front Page]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=10090</guid>
		<description><![CDATA[Perfect for a Monday is a cool 3D model editor built using the Canvas tag and created by Jayesh Salvi:


]]></description>
			<content:encoded><![CDATA[<p>Perfect for a Monday is a <a href="http://www.3dtin.com/">cool 3D model editor built using the Canvas tag</a> and created by <a href="http://www.altcanvas.com/about.html">Jayesh Salvi</a>:</p>
<p style="text-align: center;"><a href="http://ajaxian.com/wp-content/images/3dtin.png"><img class="aligncenter size-full wp-image-10091" title="3dtin" src="http://ajaxian.com/wp-content/images/3dtin.png" alt="" width="407" height="178" /></a></p>
<p><a href="http://ajaxian.com/wp-content/images/3dtin.png"></a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ajaxian?a=jjEEq2s9e2Y:kUM5g-iPq0Y:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=jjEEq2s9e2Y:kUM5g-iPq0Y:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=jjEEq2s9e2Y:kUM5g-iPq0Y:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ajaxian?i=jjEEq2s9e2Y:kUM5g-iPq0Y:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/design-3d-models-in-a-browser/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://ajaxian.com/archives/design-3d-models-in-a-browser</feedburner:origLink></item>
		<item>
		<title>View Source Tutorial: Content Site Using HTML5 Canvas + CSS3</title>
		<link>http://feedproxy.google.com/~r/ajaxian/~3/JMa7jAZn5kM/view-source-tutorial-content-site-using-html5-canvas-css3</link>
		<comments>http://ajaxian.com/archives/view-source-tutorial-content-site-using-html5-canvas-css3#comments</comments>
		<pubDate>Mon, 30 Aug 2010 10:00:56 +0000</pubDate>
		<dc:creator>Brad Neuberg</dc:creator>
				<category><![CDATA[Canvas]]></category>
		<category><![CDATA[Front Page]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[View Source]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=10022</guid>
		<description />
			<content:encoded><![CDATA[<p ">Via <a href="http://twitter.com/phil_franks">Phil Franks</a> comes an interesting HTML5/CSS3 site for <a href="http://www.therestudio.com/">There Studio</a>, which is a kind of coworking space in London:<br />
<a href="http://ajaxian.com/wp-content/images/therestudio1.png"><img class="aligncenter size-full wp-image-10023" title="therestudio1" src="http://ajaxian.com/wp-content/images/therestudio1.png" alt="" width="505" height="241" /></a></p>
<p>The site itself has a number of circles with information bouncing on the screen that respond to mouse clicks and moves.</p>
<p>Let's crack the site open using View Source and see how they are doing things. First, they have a repeated background with a little plus symbol with the following style rule on the &lt;body&gt; tag:</p>
<div class="igBar"><a href="javascript:showCodeTxt('css-12');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color:#000000; font-weight:bold;">CSS:</span>
<div id="css-12">
<div class="css">
<span style="color: #000000; font-weight: bold;">background</span>: #ddd <span style="color: #993333;">url</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">'../images/bg.gif'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#800000;">50</span>% <span style="color:#800000;">0</span> <span style="color: #993333;">repeat</span> <span style="color: #993333;">fixed</span>;<br />
&nbsp;</div>
</div>
</div>
<p>The textual content in each of the circles is clean semantic HTML that is search engine friendly:</p>
<div class="igBar"><a href="javascript:showCodeTxt('html-13');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color:#000000; font-weight:bold;">HTML:</span>
<div id="html-13">
<div class="html"><span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"section who first"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span> <br />
&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/h3.html"><span style="color: #000000; font-weight: bold;">&lt;h3&gt;</span></a></span>Who<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/h3&gt;</span></span> <br />
&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/p.html"><span style="color: #000000; font-weight: bold;">&lt;p&gt;</span></a></span>Creatives, makers, thinkers <span style="color: #009900;"><a href="http://december.com/html/4/element/span.html"><span style="color: #000000; font-weight: bold;">&lt;span</span></a> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"ampersand"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #ddbb00;">&amp;amp;</span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/span&gt;</span></span> doers<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p&gt;</span></span> <br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div>
</div>
</div>
<p>To turn that into this:<br />
<center><a href="http://ajaxian.com/wp-content/images/therestudio2.png"><img src="http://ajaxian.com/wp-content/images/therestudio2.png" alt="" title="therestudio2" width="209" height="213" class="aligncenter size-full wp-image-10026" /></a></center></p>
<p>The &lt;h3&gt; is first transformed into having an underline with the padding and margin being on the bottom:</p>
<div class="igBar"><a href="javascript:showCodeTxt('css-14');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color:#000000; font-weight:bold;">CSS:</span>
<div id="css-14">
<div class="css">
h3 <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">border-bottom</span>: 1px <span style="color: #993333;">solid</span> #ccc;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">display</span>: <span style="color: #993333;">block</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">font-size</span>: 25px;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">font-weight</span>: <span style="color: #993333;">normal</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding</span>: <span style="color:#800000;">0</span> <span style="color:#800000;">0</span> 10px;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">margin</span>: <span style="color:#800000;">0</span> <span style="color:#800000;">0</span> 8px;<br />
<span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp;</div>
</div>
</div>
<p><a href="http://www.therestudio.com/media/js/main.js">JavaScript creates the circle</a>. The script tags themselves are at the end of the HTML page at the bottom of the &lt;body&gt; tag, a good performance practice in general.</p>
<p>The heart of drawing each circle is in the createBall and createContentBall methods. If a ball will have HTML content, then the createContentBall method is used, otherwise the createBall method is used. Let's look at the createContentBall method; we'll break it down:</p>
<div class="igBar"><a href="javascript:showCodeTxt('javascript-15');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color:#000000; font-weight:bold;">JAVASCRIPT:</span>
<div id="javascript-15">
<div class="javascript">
<span style="color: #003366; font-weight: bold;">function</span> createContentBall<span style="color:#006600; font-weight:bold;">&#40;</span>className,size,color,html<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; <span style="color: #003366; font-weight: bold;">var</span> element = document.<span style="color: #006600;">createElement</span><span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color: #3366CC;">'div'</span> <span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; element.<span style="color: #006600;">className</span> = className;<br />
&nbsp; element.<span style="color: #006600;">width</span> = element.<span style="color: #006600;">height</span> = size;<br />
&nbsp; element.<span style="color: #006600;">style</span>.<span style="color: #006600;">position</span> = <span style="color: #3366CC;">'absolute'</span>;<br />
&nbsp; element.<span style="color: #006600;">style</span>.<span style="color: #006600;">left</span> = -size + <span style="color: #3366CC;">'px'</span>;<br />
&nbsp; element.<span style="color: #006600;">style</span>.<span style="color: #006600;">top</span> = -size + <span style="color: #3366CC;">'px'</span>;<br />
&nbsp; element.<span style="color: #006600;">style</span>.<span style="color: #006600;">cursor</span> = <span style="color: #3366CC;">"default"</span>;<br />
&nbsp; canvas.<span style="color: #006600;">appendChild</span><span style="color:#006600; font-weight:bold;">&#40;</span>element<span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; elements.<span style="color: #006600;">push</span><span style="color:#006600; font-weight:bold;">&#40;</span> element <span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; <span style="color: #003366; font-weight: bold;">var</span> circle = document.<span style="color: #006600;">createElement</span><span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color: #3366CC;">'canvas'</span> <span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; circle.<span style="color: #006600;">width</span> = size;<br />
&nbsp; circle.<span style="color: #006600;">height</span> = size;<br />
&nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>className !==<span style="color: #3366CC;">'image'</span> &amp;&amp; className !==<span style="color: #3366CC;">'image first'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> graphics = circle.<span style="color: #006600;">getContext</span><span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color: #3366CC;">'2d'</span> <span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; graphics.<span style="color: #006600;">fillStyle</span> = color;<br />
&nbsp; &nbsp; graphics.<span style="color: #006600;">beginPath</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; graphics.<span style="color: #006600;">arc</span><span style="color:#006600; font-weight:bold;">&#40;</span> size * .<span style="color:#800000;">5</span>, size * .<span style="color:#800000;">5</span>, size * .<span style="color:#800000;">5</span>, <span style="color:#800000;">0</span>, PI2, <span style="color: #003366; font-weight: bold;">true</span> <span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; graphics.<span style="color: #006600;">closePath</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; graphics.<span style="color: #006600;">fill</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; element.<span style="color: #006600;">appendChild</span><span style="color:#006600; font-weight:bold;">&#40;</span> circle <span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; content = document.<span style="color: #006600;">createElement</span><span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color: #3366CC;">'div'</span> <span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; content.<span style="color: #006600;">className</span> = <span style="color: #3366CC;">"content"</span>;<br />
&nbsp; content.<span style="color: #006600;">onSelectStart</span> = <span style="color: #003366; font-weight: bold;">null</span>;<br />
&nbsp; content.<span style="color: #006600;">innerHTML</span> = html;<br />
&nbsp; element.<span style="color: #006600;">appendChild</span><span style="color:#006600; font-weight:bold;">&#40;</span>content<span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>className !==<span style="color: #3366CC;">'image'</span> &amp;&amp; className !==<span style="color: #3366CC;">'image first'</span> <span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; content.<span style="color: #006600;">style</span>.<span style="color: #006600;">width</span> = <span style="color:#006600; font-weight:bold;">&#40;</span>size - contentPadding*<span style="color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span> + <span style="color: #3366CC;">'px'</span>;<br />
&nbsp; &nbsp; content.<span style="color: #006600;">style</span>.<span style="color: #006600;">left</span> = <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span>size - content.<span style="color: #006600;">clientWidth</span><span style="color:#006600; font-weight:bold;">&#41;</span> / <span style="color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> +<span style="color: #3366CC;">'px'</span>;<br />
&nbsp; &nbsp; content.<span style="color: #006600;">style</span>.<span style="color: #006600;">top</span> = <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span>size - content.<span style="color: #006600;">clientHeight</span><span style="color:#006600; font-weight:bold;">&#41;</span> / <span style="color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span> +<span style="color: #3366CC;">'px'</span>;<br />
&nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; <span style="color: #003366; font-weight: bold;">var</span> b2body = <span style="color: #003366; font-weight: bold;">new</span> b2BodyDef<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; <span style="color: #003366; font-weight: bold;">var</span> circle = <span style="color: #003366; font-weight: bold;">new</span> b2CircleDef<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; circle.<span style="color: #006600;">radius</span> = size / <span style="color:#800000;">2</span>;<br />
&nbsp; circle.<span style="color: #006600;">density</span> = ballDensity;<br />
&nbsp; circle.<span style="color: #006600;">friction</span> = ballFriction;<br />
&nbsp; circle.<span style="color: #006600;">restitution</span> = ballRestitution;<br />
&nbsp; b2body.<span style="color: #006600;">AddShape</span><span style="color:#006600; font-weight:bold;">&#40;</span>circle<span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; b2body.<span style="color: #006600;">userData</span> = <span style="color:#006600; font-weight:bold;">&#123;</span>element: element<span style="color:#006600; font-weight:bold;">&#125;</span>;<br />
&nbsp; b2body.<span style="color: #006600;">position</span>.<span style="color: #006600;">Set</span><span style="color:#006600; font-weight:bold;">&#40;</span> Math.<span style="color: #006600;">random</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> * stage<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#93;</span>, Math.<span style="color: #006600;">random</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> * <span style="color:#006600; font-weight:bold;">&#40;</span>stage<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#800000;">3</span><span style="color:#006600; font-weight:bold;">&#93;</span>-size<span style="color:#006600; font-weight:bold;">&#41;</span> + size/<span style="color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; b2body.<span style="color: #006600;">linearVelocity</span>.<span style="color: #006600;">Set</span><span style="color:#006600; font-weight:bold;">&#40;</span> Math.<span style="color: #006600;">random</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> * <span style="color:#800000;">200</span>, Math.<span style="color: #006600;">random</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> * <span style="color:#800000;">200</span> <span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; bodies.<span style="color: #006600;">push</span><span style="color:#006600; font-weight:bold;">&#40;</span> world.<span style="color: #006600;">CreateBody</span><span style="color:#006600; font-weight:bold;">&#40;</span>b2body<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
<span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp;</div>
</div>
</div>
<p>First, we create an absolutely positioned DIV that will house our Canvas tag:</p>
<div class="igBar"><a href="javascript:showCodeTxt('javascript-16');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color:#000000; font-weight:bold;">JAVASCRIPT:</span>
<div id="javascript-16">
<div class="javascript">
<span style="color: #003366; font-weight: bold;">var</span> element = document.<span style="color: #006600;">createElement</span><span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color: #3366CC;">'div'</span> <span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
element.<span style="color: #006600;">className</span> = className;<br />
element.<span style="color: #006600;">width</span> = element.<span style="color: #006600;">height</span> = size;<br />
element.<span style="color: #006600;">style</span>.<span style="color: #006600;">position</span> = <span style="color: #3366CC;">'absolute'</span>;<br />
element.<span style="color: #006600;">style</span>.<span style="color: #006600;">left</span> = -size + <span style="color: #3366CC;">'px'</span>;<br />
element.<span style="color: #006600;">style</span>.<span style="color: #006600;">top</span> = -size + <span style="color: #3366CC;">'px'</span>;<br />
element.<span style="color: #006600;">style</span>.<span style="color: #006600;">cursor</span> = <span style="color: #3366CC;">"default"</span>;<br />
canvas.<span style="color: #006600;">appendChild</span><span style="color:#006600; font-weight:bold;">&#40;</span>element<span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
elements.<span style="color: #006600;">push</span><span style="color:#006600; font-weight:bold;">&#40;</span> element <span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp;</div>
</div>
</div>
<p>Then we draw the actual circle itself using the Canvas tag and append it to our container DIV (Note that an SVG circle created programmatically could have also been used here):</p>
<div class="igBar"><a href="javascript:showCodeTxt('javascript-17');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color:#000000; font-weight:bold;">JAVASCRIPT:</span>
<div id="javascript-17">
<div class="javascript">
<span style="color: #003366; font-weight: bold;">var</span> circle = document.<span style="color: #006600;">createElement</span><span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color: #3366CC;">'canvas'</span> <span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
circle.<span style="color: #006600;">width</span> = size;<br />
circle.<span style="color: #006600;">height</span> = size;<br />
<span style="color: #000066; font-weight: bold;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>className !==<span style="color: #3366CC;">'image'</span> &amp;&amp; className !==<span style="color: #3366CC;">'image first'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp;<span style="color: #003366; font-weight: bold;">var</span> graphics = circle.<span style="color: #006600;">getContext</span><span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color: #3366CC;">'2d'</span> <span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp;graphics.<span style="color: #006600;">fillStyle</span> = color;<br />
&nbsp; &nbsp;graphics.<span style="color: #006600;">beginPath</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp;graphics.<span style="color: #006600;">arc</span><span style="color:#006600; font-weight:bold;">&#40;</span> size * .<span style="color:#800000;">5</span>, size * .<span style="color:#800000;">5</span>, size * .<span style="color:#800000;">5</span>, <span style="color:#800000;">0</span>, PI2, <span style="color: #003366; font-weight: bold;">true</span> <span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp;graphics.<span style="color: #006600;">closePath</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp;graphics.<span style="color: #006600;">fill</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
<span style="color:#006600; font-weight:bold;">&#125;</span><br />
element.<span style="color: #006600;">appendChild</span><span style="color:#006600; font-weight:bold;">&#40;</span> circle <span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp;</div>
</div>
</div>
<p>Then we create another DIV to house the HTML content itself:</p>
<div class="igBar"><a href="javascript:showCodeTxt('javascript-18');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color:#000000; font-weight:bold;">JAVASCRIPT:</span>
<div id="javascript-18">
<div class="javascript">
content = document.<span style="color: #006600;">createElement</span><span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color: #3366CC;">'div'</span> <span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
content.<span style="color: #006600;">className</span> = <span style="color: #3366CC;">"content"</span>;<br />
content.<span style="color: #006600;">onSelectStart</span> = <span style="color: #003366; font-weight: bold;">null</span>;<br />
content.<span style="color: #006600;">innerHTML</span> = html;<br />
element.<span style="color: #006600;">appendChild</span><span style="color:#006600; font-weight:bold;">&#40;</span>content<span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
<span style="color: #000066; font-weight: bold;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>className !==<span style="color: #3366CC;">'image'</span> &amp;&amp; className !==<span style="color: #3366CC;">'image first'</span> <span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp;content.<span style="color: #006600;">style</span>.<span style="color: #006600;">width</span> = <span style="color:#006600; font-weight:bold;">&#40;</span>size - contentPadding*<span style="color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span> + <span style="color: #3366CC;">'px'</span>;<br />
&nbsp; &nbsp;content.<span style="color: #006600;">style</span>.<span style="color: #006600;">left</span> = <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span>size - content.<span style="color: #006600;">clientWidth</span><span style="color:#006600; font-weight:bold;">&#41;</span> / <span style="color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> +<span style="color: #3366CC;">'px'</span>;<br />
&nbsp; &nbsp;content.<span style="color: #006600;">style</span>.<span style="color: #006600;">top</span> = <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span>size - content.<span style="color: #006600;">clientHeight</span><span style="color:#006600; font-weight:bold;">&#41;</span> / <span style="color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span> +<span style="color: #3366CC;">'px'</span>;<br />
<span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp;</div>
</div>
</div>
<p>Notice that we are setting content.onSelectStart to null above; this is so that when you run the mouse button over the text it doesn't select (An alternative way to do this is to use the <a href="http://hacks.mozilla.org/2009/12/pointer-events-for-html-in-firefox-3-6/">HTML pointer-events CSS property</a>).</p>
<p>Next comes code to deal with the physics of the circles, which uses <a href="http://box2d-js.sourceforge.net/">Box2D.js</a>, a JavaScript physics engine ported from Flash:</p>
<div class="igBar"><a href="javascript:showCodeTxt('javascript-19');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color:#000000; font-weight:bold;">JAVASCRIPT:</span>
<div id="javascript-19">
<div class="javascript">
<span style="color: #003366; font-weight: bold;">var</span> b2body = <span style="color: #003366; font-weight: bold;">new</span> b2BodyDef<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
<span style="color: #003366; font-weight: bold;">var</span> circle = <span style="color: #003366; font-weight: bold;">new</span> b2CircleDef<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
circle.<span style="color: #006600;">radius</span> = size / <span style="color:#800000;">2</span>;<br />
circle.<span style="color: #006600;">density</span> = ballDensity;<br />
circle.<span style="color: #006600;">friction</span> = ballFriction;<br />
circle.<span style="color: #006600;">restitution</span> = ballRestitution;<br />
b2body.<span style="color: #006600;">AddShape</span><span style="color:#006600; font-weight:bold;">&#40;</span>circle<span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
b2body.<span style="color: #006600;">userData</span> = <span style="color:#006600; font-weight:bold;">&#123;</span>element: element<span style="color:#006600; font-weight:bold;">&#125;</span>;<br />
b2body.<span style="color: #006600;">position</span>.<span style="color: #006600;">Set</span><span style="color:#006600; font-weight:bold;">&#40;</span> Math.<span style="color: #006600;">random</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> * stage<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#93;</span>, Math.<span style="color: #006600;">random</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> * <span style="color:#006600; font-weight:bold;">&#40;</span>stage<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#800000;">3</span><span style="color:#006600; font-weight:bold;">&#93;</span>-size<span style="color:#006600; font-weight:bold;">&#41;</span> + size/<span style="color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
b2body.<span style="color: #006600;">linearVelocity</span>.<span style="color: #006600;">Set</span><span style="color:#006600; font-weight:bold;">&#40;</span> Math.<span style="color: #006600;">random</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> * <span style="color:#800000;">200</span>, Math.<span style="color: #006600;">random</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> * <span style="color:#800000;">200</span> <span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
bodies.<span style="color: #006600;">push</span><span style="color:#006600; font-weight:bold;">&#40;</span> world.<span style="color: #006600;">CreateBody</span><span style="color:#006600; font-weight:bold;">&#40;</span>b2body<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp;</div>
</div>
</div>
<p>Basically, we define a circle, give it a radius, density, friction, and restitution, and then add it to our collection of shapes with a position and linear velocity. Box2D will then handle the physics and we can just take the values back out to draw things on the screen with a setInterval, which happens in the loop method:</p>
<div class="igBar"><a href="javascript:showCodeTxt('javascript-20');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color:#000000; font-weight:bold;">JAVASCRIPT:</span>
<div id="javascript-20">
<div class="javascript">
<span style="color: #003366; font-weight: bold;">function</span> loop<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; delta<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span> += <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;">0</span> - delta<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> * .<span style="color:#800000;">5</span>;<br />
&nbsp; delta<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span> += <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;">0</span> - delta<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> * .<span style="color:#800000;">5</span>;<br />
&nbsp; world.<span style="color: #006600;">m_gravity</span>.<span style="color: #006600;">x</span> = <span style="color:#800000;">0</span> <span style="color: #009900; font-style: italic;">// -(0 + delta[0]);</span><br />
&nbsp; world.<span style="color: #006600;">m_gravity</span>.<span style="color: #006600;">y</span> = -<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;">100</span> + delta<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; mouseDrag<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; world.<span style="color: #006600;">Step</span><span style="color:#006600; font-weight:bold;">&#40;</span>timeStep, iterations<span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; <span style="color: #000066; font-weight: bold;">for</span> <span style="color:#006600; font-weight:bold;">&#40;</span>i = <span style="color:#800000;">0</span>; i &lt;bodies.<span style="color: #006600;">length</span>; i++<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> body = bodies<span style="color:#006600; font-weight:bold;">&#91;</span>i<span style="color:#006600; font-weight:bold;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> element = elements<span style="color:#006600; font-weight:bold;">&#91;</span>i<span style="color:#006600; font-weight:bold;">&#93;</span>;<br />
&nbsp; &nbsp; element.<span style="color: #006600;">style</span>.<span style="color: #006600;">left</span> = <span style="color:#006600; font-weight:bold;">&#40;</span>body.<span style="color: #006600;">m_position0</span>.<span style="color: #006600;">x</span> - <span style="color:#006600; font-weight:bold;">&#40;</span>element.<span style="color: #006600;">width</span>&gt;&gt; <span style="color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> + <span style="color: #3366CC;">'px'</span>;<br />
&nbsp; &nbsp; element.<span style="color: #006600;">style</span>.<span style="color: #006600;">top</span> = <span style="color:#006600; font-weight:bold;">&#40;</span>body.<span style="color: #006600;">m_position0</span>.<span style="color: #006600;">y</span> - <span style="color:#006600; font-weight:bold;">&#40;</span>element.<span style="color: #006600;">height</span>&gt;&gt; <span style="color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> + <span style="color: #3366CC;">'px'</span>;<br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>ballRotation &amp;&amp; element.<span style="color: #006600;">tagName</span> == <span style="color: #3366CC;">'DIV'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> rotationStyle = <span style="color: #3366CC;">'rotate('</span> + <span style="color:#006600; font-weight:bold;">&#40;</span>body.<span style="color: #006600;">m_rotation0</span> * <span style="color:#800000;">57</span>.<span style="color:#800000;">2957795</span><span style="color:#006600; font-weight:bold;">&#41;</span> + <span style="color: #3366CC;">'deg)'</span>;<br />
&nbsp; &nbsp; &nbsp; element.<span style="color: #006600;">style</span>.<span style="color: #006600;">WebkitTransform</span> = rotationStyle;<br />
&nbsp; &nbsp; &nbsp; element.<span style="color: #006600;">style</span>.<span style="color: #006600;">MozTransform</span> = rotationStyle;<br />
&nbsp; &nbsp; &nbsp; element.<span style="color: #006600;">style</span>.<span style="color: #006600;">OTransform</span> = rotationStyle;<br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><br />
<span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp;</div>
</div>
</div>
<p>This method gets called with a setInterval periodically. Basically, we apply a delta and a gravity at each time step; see if the mouse is being pressed down (with hooks for touch devices like the iPhone to see if a finger is being pressed down); tell the Box2D World about our gravity and delta and to make an iteration step; and finally use the computed physics values from Box2D to apply CSS3 rotation transforms on our parent DIV and move the element's CSS top and left values around the screen.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ajaxian?a=JMa7jAZn5kM:0VBl8dDdW6Q:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=JMa7jAZn5kM:0VBl8dDdW6Q:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=JMa7jAZn5kM:0VBl8dDdW6Q:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ajaxian?i=JMa7jAZn5kM:0VBl8dDdW6Q:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/view-source-tutorial-content-site-using-html5-canvas-css3/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://ajaxian.com/archives/view-source-tutorial-content-site-using-html5-canvas-css3</feedburner:origLink></item>
		<item>
		<title>Find Info On Webkit Spec Extensions</title>
		<link>http://feedproxy.google.com/~r/ajaxian/~3/wRIBZeKMApQ/find-info-on-webkit-spec-extensions</link>
		<comments>http://ajaxian.com/archives/find-info-on-webkit-spec-extensions#comments</comments>
		<pubDate>Fri, 27 Aug 2010 11:00:41 +0000</pubDate>
		<dc:creator>Brad Neuberg</dc:creator>
				<category><![CDATA[Front Page]]></category>
		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=10082</guid>
		<description><![CDATA[
I stumbled across http://webkit.org/specs recently, which is basically a nifty listing of all custom extensions Apple/Webkit has made to web specs, written up as specs themselves so that other browsers can implement them:

Squirrelfish Bytecode
Timed Media Elements
CSS Effects
Extensions to CSS 3 Media Queries
The 'pointer-events' property

There were some on here that I had never even heard of. [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://ajaxian.com/wp-content/images/safari_logo.png"><img class="aligncenter size-full wp-image-10083" title="safari_logo" src="http://ajaxian.com/wp-content/images/safari_logo.png" alt="" width="179" height="167" /></a></p>
<p>I stumbled across <a href="http://webkit.org/specs/">http://webkit.org/specs</a> recently, which is basically a nifty listing of all custom extensions Apple/Webkit has made to web specs, written up as specs themselves so that other browsers can implement them:</p>
<ul>
<li><a href="http://webkit.org/specs/squirrelfish-bytecode.html">Squirrelfish Bytecode</a></li>
<li><a href="http://webkit.org/specs/Timed_Media_CSS.html">Timed Media Elements</a></li>
<li><a href="http://webkit.org/specs/CSSVisualEffects/">CSS Effects</a></li>
<li><a href="http://webkit.org/specs/MediaQueriesExtensions.html">Extensions to CSS 3 Media Queries</a></li>
<li><a href="http://webkit.org/specs/PointerEventsProperty.html">The 'pointer-events' property</a></li>
</ul>
<p>There were some on here that I had never even heard of. The first is the <a href="http://webkit.org/specs/Timed_Media_CSS.html">Timed Media Elements</a> spec, which is a fancy name for basically CSS that can control playback of video and audio:</p>
<div class="igBar"><a href="javascript:showCodeTxt('css-23');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color:#000000; font-weight:bold;">CSS:</span>
<div id="css-23">
<div class="css">
myVideo <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; media-play-state: paused; <span style="color: #808080; font-style: italic;">/* Pause the video. */</span><br />
&nbsp; media-play-rate: <span style="color:#800000;">50</span>%; <span style="color: #808080; font-style: italic;">/* Play at half speed. */</span><br />
&nbsp; media-loop-count: <span style="color:#800000;">2</span>;<br />
<span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp;</div>
</div>
</div>
<p>Another interesting spec contains <a href="http://webkit.org/specs/MediaQueriesExtensions.html">extensions to CSS Media Queries</a>, basically making it possible for user agents to query whether CSS Transforms, Animations, 3D Transforms, and Transitions are available so you can apply different style sheets for platforms that support these CSS effects:</p>
<div class="igBar"><a href="javascript:showCodeTxt('html-24');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color:#000000; font-weight:bold;">HTML:</span>
<div id="html-24">
<div class="html">
<span style="color: #009900;"><a href="http://december.com/html/4/element/link.html"><span style="color: #000000; font-weight: bold;">&lt;link</span></a> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">"stylesheet"</span> <span style="color: #000066;">media</span>=<span style="color: #ff0000;">"screen and (transform-2d)"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><br />
&nbsp;</div>
</div>
</div>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ajaxian?a=wRIBZeKMApQ:IqclUmLa6oE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=wRIBZeKMApQ:IqclUmLa6oE:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=wRIBZeKMApQ:IqclUmLa6oE:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ajaxian?i=wRIBZeKMApQ:IqclUmLa6oE:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/find-info-on-webkit-spec-extensions/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://ajaxian.com/archives/find-info-on-webkit-spec-extensions</feedburner:origLink></item>
		<item>
		<title>It’s Gmail: The Game!</title>
		<link>http://feedproxy.google.com/~r/ajaxian/~3/lmlOCjmhBb0/its-gmail-the-game</link>
		<comments>http://ajaxian.com/archives/its-gmail-the-game#comments</comments>
		<pubDate>Fri, 27 Aug 2010 10:00:01 +0000</pubDate>
		<dc:creator>Brad Neuberg</dc:creator>
				<category><![CDATA[Front Page]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=10002</guid>
		<description><![CDATA[
TechCrunch reports on a Googler, Paul Truong, who created an HTML5-based game for Gmail called Galactic Inbox using his 20% time:
When you start it up, a little Gmail logo envelope guy pops out of a “20% Projects Lab” and starts flying. Essentially, he’s a spaceship and can shoot objects coming his way. It’s simple, but [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://ajaxian.com/wp-content/images/444.png"><img class="aligncenter size-full wp-image-10003" title="444" src="http://ajaxian.com/wp-content/images/444.png" alt="" width="504" height="378" /></a></p>
<p><a href="http://techcrunch.com/2010/08/13/gmail-game/">TechCrunch reports</a> on a Googler, <a href="http://www.monocubed.com">Paul Truong</a>, who created an HTML5-based game for Gmail called <a href="http://www.monocubed.com/?p=549">Galactic Inbox</a> using his 20% time:</p>
<blockquote><p>When you start it up, a little Gmail logo envelope guy pops out of a “20% Projects Lab” and starts flying. Essentially, he’s a spaceship and can shoot objects coming his way. It’s simple, but fun.</p></blockquote>
<p style="text-align: center;"><a href="http://ajaxian.com/wp-content/images/galactic4.png"><img class="aligncenter size-full wp-image-10004" title="galactic4" src="http://ajaxian.com/wp-content/images/galactic4.png" alt="" width="504" height="378" /></a></p>
<p>Read more on the <a href="http://gmailblog.blogspot.com/2010/08/galactic-inbox-html5-game-inspired-by.html?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed:+OfficialGmailBlog+(Gmail+Blog)">Gmail Blog</a>.</p>
<p><a href="http://www.monocubed.com/?p=549">Play the game yourself</a> (note that you must be using a modern browser)!</p>
<p>[<a href="http://www.linkedin.com/in/bryanneuberg">via Bryan Neuberg</a>]</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ajaxian?a=lmlOCjmhBb0:2YiAHGgHVqY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=lmlOCjmhBb0:2YiAHGgHVqY:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=lmlOCjmhBb0:2YiAHGgHVqY:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ajaxian?i=lmlOCjmhBb0:2YiAHGgHVqY:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/its-gmail-the-game/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://ajaxian.com/archives/its-gmail-the-game</feedburner:origLink></item>
		<item>
		<title>How to Drag Out Files Like Gmail</title>
		<link>http://feedproxy.google.com/~r/ajaxian/~3/sOKoIERL09o/how-to-drag-out-files-like-gmail</link>
		<comments>http://ajaxian.com/archives/how-to-drag-out-files-like-gmail#comments</comments>
		<pubDate>Thu, 26 Aug 2010 11:00:40 +0000</pubDate>
		<dc:creator>Brad Neuberg</dc:creator>
				<category><![CDATA[Front Page]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=10076</guid>
		<description><![CDATA[Ryan Seddon, aka the CSS Ninja, has a nice blog post up where he reverse engineers the new feature in Gmail where you can drag attachments from an email on to your desktop.


Note that the feature only currently works in Chrome.
Ryan begins with the following code:
PLAIN TEXT
JAVASCRIPT:


var file = document.getElementById&#40;"dragout"&#41;;
file.addEventListener&#40;"dragstart",function&#40;evt&#41;&#123;
&#160; evt.dataTransfer.setData&#40;"DownloadURL",fileDetails&#41;;
&#125;,false&#41;;
&#160;


Describing the code Ryan says:
From [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ryanseddon.com/">Ryan Seddon</a>, aka <a href="http://www.thecssninja.com/">the CSS Ninja</a>, has a <a href="http://www.thecssninja.com/javascript/gmail-dragout">nice blog post up</a> where he reverse engineers the new feature in Gmail where you can <a href="http://gmailblog.blogspot.com/2010/08/drag-and-drop-attachments-to-save-them.html">drag attachments from an email on to your desktop</a>.</p>
<p style="text-align: center;"><a href="http://ajaxian.com/wp-content/images/drag_attachment2.jpg"><img class="aligncenter size-full wp-image-10077" title="drag_attachment2" src="http://ajaxian.com/wp-content/images/drag_attachment2.jpg" alt="" width="335" height="193" /></a></p>
<p style="text-align: center;"><a href="http://ajaxian.com/wp-content/images/drag_attachment3.jpg"><img class="aligncenter size-full wp-image-10078" title="drag_attachment3" src="http://ajaxian.com/wp-content/images/drag_attachment3.jpg" alt="" width="368" height="190" /></a></p>
<p>Note that the feature only currently works in Chrome.</p>
<p>Ryan begins with the following code:</p>
<div class="igBar"><a href="javascript:showCodeTxt('javascript-27');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color:#000000; font-weight:bold;">JAVASCRIPT:</span>
<div id="javascript-27">
<div class="javascript">
<span style="color: #003366; font-weight: bold;">var</span> file = document.<span style="color: #006600;">getElementById</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #3366CC;">"dragout"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</p>
<p>file.<span style="color: #006600;">addEventListener</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #3366CC;">"dragstart"</span>,<span style="color: #003366; font-weight: bold;">function</span><span style="color:#006600; font-weight:bold;">&#40;</span>evt<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; evt.<span style="color: #006600;">dataTransfer</span>.<span style="color: #006600;">setData</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #3366CC;">"DownloadURL"</span>,fileDetails<span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
<span style="color:#006600; font-weight:bold;">&#125;</span>,<span style="color: #003366; font-weight: bold;">false</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp;</div>
</div>
</div>
<p>Describing the code Ryan says:</p>
<blockquote><p>From the code above you attach an ondragstart event listener to something you want to “drag out” and save to your file system. On the dragstart event you set the data using the new “DownloadURL” type and pass file information to it.</p></blockquote>
<p>Note though that in order to pass the correct data to the dragstart event you need to provide a download URL that can be passed to the <code>setData("DownloadURL"</code> call. Ryan uses the <a href="http://ejohn.org/blog/html-5-data-attributes/">HTML5 data-* attribute</a> to pass this custom data in:</p>
<div class="igBar"><a href="javascript:showCodeTxt('html-28');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color:#000000; font-weight:bold;">HTML:</span>
<div id="html-28">
<div class="html">
<span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"Eadui.ttf"</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"dragout"</span> draggable=<span style="color: #ff0000;">"true"</span> data-downloadurl=<span style="color: #ff0000;">"<br />
&nbsp; &nbsp; application/octet-stream<br />
&nbsp; &nbsp; :Eadui.ttf<br />
&nbsp; &nbsp; :http://thecssninja.com/gmail_dragout/Eadui.ttf"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>Font file<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span><br />
&nbsp;</div>
</div>
</div>
<p>The custom attribute uses three different fields of data separated by colons:</p>
<blockquote><p>The files mime type, the name you wish it to be saved as (this can be anything) and the url to where the file can be downloaded from.</p></blockquote>
<p>Nice find Ryan!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ajaxian?a=sOKoIERL09o:ms7JUj7w4-g:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=sOKoIERL09o:ms7JUj7w4-g:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=sOKoIERL09o:ms7JUj7w4-g:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ajaxian?i=sOKoIERL09o:ms7JUj7w4-g:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/how-to-drag-out-files-like-gmail/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://ajaxian.com/archives/how-to-drag-out-files-like-gmail</feedburner:origLink></item>
		<item>
		<title>innerShiv: Make innerHTML + HTML5 Work in IE</title>
		<link>http://feedproxy.google.com/~r/ajaxian/~3/pMCWAyq9R5U/innershiv-make-innerhtml-html5-work-in-ie</link>
		<comments>http://ajaxian.com/archives/innershiv-make-innerhtml-html5-work-in-ie#comments</comments>
		<pubDate>Thu, 26 Aug 2010 10:00:47 +0000</pubDate>
		<dc:creator>Brad Neuberg</dc:creator>
				<category><![CDATA[Front Page]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[Library]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=9997</guid>
		<description><![CDATA[(Various Shivs)
Via JD Bartlett comes HTML5 innerShiv for IE. Before innerShiv, the following would not work in IE:
PLAIN TEXT
HTML:


var s = document.createElement('div');
s.innerHTML = &#34;&#60;section&#62;Hi!&#60;/section&#62;&#34;;
document.body.appendChild(s);
&#160;


For example, let's imagine we have some CSS that defines the following for the HTML5 elements footer, header, and section:
PLAIN TEXT
CSS:


footer, header, section &#123;
&#160; border:1px solid #ccc; 
&#160; display:block;
&#160; padding:10px;
&#125;
&#160;


Unfortunately, even if [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://ajaxian.com/wp-content/images/7_knive.jpg"><img class="aligncenter size-full wp-image-9998" title="7_knive" src="http://ajaxian.com/wp-content/images/7_knive.jpg" alt="" width="373" height="247" /></a><em>(Various <a href="http://en.wikipedia.org/wiki/Shiv_(weapon)">Shivs</a>)</em></p>
<p style="text-align: left;">Via <a href="http://jdbartlett.com/">JD Bartlett</a> comes <a href="http://jdbartlett.github.com/innershiv/">HTML5 innerShiv for IE</a>. Before innerShiv, the following would not work in IE:</p>
<div class="igBar"><a href="javascript:showCodeTxt('html-33');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color:#000000; font-weight:bold;">HTML:</span>
<div id="html-33">
<div class="html">
var s = document.createElement('div');<br />
s.innerHTML = &quot;<span style="color: #009900;">&lt;section&gt;</span>Hi!<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>/section&gt;</span>&quot;;<br />
document.body.appendChild(s);<br />
&nbsp;</div>
</div>
</div>
<p>For example, let's imagine we have some CSS that defines the following for the HTML5 elements footer, header, and section:</p>
<div class="igBar"><a href="javascript:showCodeTxt('css-34');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color:#000000; font-weight:bold;">CSS:</span>
<div id="css-34">
<div class="css">
footer, header, section <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; border<span style="color: #3333ff;">:1px </span>solid #ccc; <br />
&nbsp; <span style="color: #000000; font-weight: bold;">display</span>:<span style="color: #993333;">block</span>;<br />
&nbsp; <span style="color: #000000; font-weight: bold;">padding</span>:10px;<br />
<span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp;</div>
</div>
</div>
<p>Unfortunately, even if you are using one of the tricks to force IE to deal with HTML5 elements shivs don't work when dealing with innerHTML before an element is appended to the DOM:</p>
<blockquote><p>However, the shiv doesn't work in Internet Explorer when an element's content is added with innerHTML before being appended to the document. That's a common use case, and noticeable in libraries like jQuery when you try to append or load (etc.) HTML5 content</p></blockquote>
<p>Some example bad JQuery code that runs into this problem:</p>
<div class="igBar"><a href="javascript:showCodeTxt('javascript-35');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color:#000000; font-weight:bold;">JAVASCRIPT:</span>
<div id="javascript-35">
<div class="javascript">
$<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #3366CC;">'#example-1'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color: #006600;">append</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #3366CC;">"&lt;section&gt;&lt;header&gt;&lt;h3&gt;Example 1:<span style="color: #000099; font-weight: bold;">\<br />
</span>&nbsp; a broken section&lt;/h3&gt;&lt;/header&gt;&lt;p&gt;This section element should<span style="color: #000099; font-weight: bold;">\<br />
</span>&nbsp; have a black border like the others. It doesn't in Internet<span style="color: #000099; font-weight: bold;">\<br />
</span>&nbsp; Explorer. :(&lt;/p&gt;&lt;/section&gt;"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp;</div>
</div>
</div>
<p>JD's library is the solution to this problem:</p>
<blockquote><p>innerShiv is a function which takes your HTML string, adds it to a hidden document-appended element in IE, and returns an IE-safe document fragment or collection</p></blockquote>
<p>Now you can do the following to have things work:</p>
<div class="igBar"><a href="javascript:showCodeTxt('javascript-36');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color:#000000; font-weight:bold;">JAVASCRIPT:</span>
<div id="javascript-36">
<div class="javascript">
$<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #3366CC;">'#example-2'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color: #006600;">append</span><span style="color:#006600; font-weight:bold;">&#40;</span>innerShiv<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #3366CC;">"&lt;section&gt;&lt;header&gt;&lt;h3&gt;<span style="color: #000099; font-weight: bold;">\<br />
</span>&nbsp; Example 2: a successfully styled section&lt;/h3&gt;&lt;/header&gt;<span style="color: #000099; font-weight: bold;">\<br />
</span>&nbsp; &lt;p&gt;This section element should have a gray border like the<span style="color: #000099; font-weight: bold;">\<br />
</span>&nbsp; others. And it does! Even in Internet Explorer! Yay!.&lt;/p&gt;<span style="color: #000099; font-weight: bold;">\<br />
</span>&nbsp; &lt;/section&gt;"</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp;</div>
</div>
</div>
<p>Note that you don't have to use JQuery to use innerShiv.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ajaxian?a=pMCWAyq9R5U:umdpXRn_IGM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=pMCWAyq9R5U:umdpXRn_IGM:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=pMCWAyq9R5U:umdpXRn_IGM:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ajaxian?i=pMCWAyq9R5U:umdpXRn_IGM:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/innershiv-make-innerhtml-html5-work-in-ie/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://ajaxian.com/archives/innershiv-make-innerhtml-html5-work-in-ie</feedburner:origLink></item>
		<item>
		<title>Adobe Releases Web Fonts</title>
		<link>http://feedproxy.google.com/~r/ajaxian/~3/BcJvfS3vrYY/adobe-releases-web-fonts</link>
		<comments>http://ajaxian.com/archives/adobe-releases-web-fonts#comments</comments>
		<pubDate>Wed, 25 Aug 2010 11:00:48 +0000</pubDate>
		<dc:creator>Brad Neuberg</dc:creator>
				<category><![CDATA[Adobe]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Font]]></category>
		<category><![CDATA[Front Page]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=10072</guid>
		<description><![CDATA[
Last week Adobe announced they are jumping into the Web Fonts game in a partnership with Typekit:
For this debut of Adobe Web Fonts, I think we’ve made some great choices. Everyone knows Myriad and Minion — pervasive workhorse sans serif and serif typefaces, respectively, which will prove to be as useful on the web as they have been [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://ajaxian.com/wp-content/images/adobewebfonts.png"><img class="size-full wp-image-10073  aligncenter" title="adobewebfonts" src="http://ajaxian.com/wp-content/images/adobewebfonts.png" alt="" width="341" height="146" /></a></p>
<p>Last week Adobe <a href="http://blogs.adobe.com/typblography/2010/08/adobe-web-fonts-2.html">announced</a> they are jumping into the Web Fonts game in a partnership with <a href="http://typekit.com/">Typekit</a>:</p>
<blockquote><p>For this debut of Adobe Web Fonts, I think we’ve made some great choices. Everyone knows <strong>Myriad</strong> and <strong>Minion</strong> — pervasive workhorse sans serif and serif typefaces, respectively, which will prove to be as useful on the web as they have been in print. Thomas Phinney’s <strong>Hypatia Sans</strong> and Carol Twombly’s <strong>Chaparral</strong> are distinctive and versatile. <strong>Adobe Text</strong> is Robert Slimbach’s newest design which a lot of people haven’t even seen yet (so far it has only been available as a registration benefit for CS5 customers) but I’m certain it will quickly establish itself as a flexible and reliable text typeface, and I’m pleased it will now get a wider audience.</p>
<p>Richard Lipton’s classic <strong>Bickham Script</strong> is one of our most popular display typefaces and a distinctive addition to the Adobe Web Fonts collection. More of Robert Slimbach’s work now available for web use include <strong>Adobe Garamond</strong>, <strong>Caflisch Script</strong>, <strong>Cronos</strong>, and the “display” designs for <strong>Garamond Premier </strong>(based on Claude Garamond’s beautiful <em>Gros Canon</em> type).</p>
<p>Speaking of which: You will find that we’ve included optical size variations for some of our typefaces. These designs are carefully crafted to look their best at small sizes (“caption”), medium- to large-size headings (“subhead”), or in headlines and other large sizes (“display”). On the web, these distinctions are less resolved than in print, but optical sizes will give you more options to find just the right font for your needs — and giving users better options for fine typography is what Adobe Originals are all about.</p>
<p>Remember, Adobe Web Fonts support the same languages and scripts as their desktop counterparts. Most are “Pro” fonts — meaning their character set supports Central European languages. Adobe Text, Garamond Premier, Hypatia Sans, Minion, and Myriad also support Greek and Cyrillic. (Select the “All Characters” Subset option in Typekit to use them.)</p></blockquote>
<p>It's exciting to see Adobe supporting web fonts!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ajaxian?a=BcJvfS3vrYY:3fXDB0hbCBo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=BcJvfS3vrYY:3fXDB0hbCBo:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=BcJvfS3vrYY:3fXDB0hbCBo:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ajaxian?i=BcJvfS3vrYY:3fXDB0hbCBo:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/adobe-releases-web-fonts/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://ajaxian.com/archives/adobe-releases-web-fonts</feedburner:origLink></item>
		<item>
		<title>Real World Canvas Tips from Hakim El Hattab</title>
		<link>http://feedproxy.google.com/~r/ajaxian/~3/MBv_qIYH-AE/real-world-canvas-tips</link>
		<comments>http://ajaxian.com/archives/real-world-canvas-tips#comments</comments>
		<pubDate>Wed, 25 Aug 2010 10:00:27 +0000</pubDate>
		<dc:creator>Brad Neuberg</dc:creator>
				<category><![CDATA[Canvas]]></category>
		<category><![CDATA[Front Page]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=9992</guid>
		<description><![CDATA[
From Hakim El Hattab (who has some very nifty HTML5 experiments up) comes some nice tips on using the Canvas tag:
 
Cross browser implementation
There are no real discrepancies between the canvas outputs of different browsers so long as the JavaScript code is written correctly (if not, browsers tend to try and fix things for you, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://ajaxian.com/wp-content/images/hakim_experiment1.png"><img class="aligncenter size-full wp-image-9993" title="hakim_experiment1" src="http://ajaxian.com/wp-content/images/hakim_experiment1.png" alt="" width="425" height="364" /></a></p>
<p>From <a href="http://www.hakim.se/">Hakim El Hattab</a> (who has some very nifty HTML5 <a href="http://hakim.se/experiments/">experiments</a> up) comes some <a href="http://www.kontain.com/fi/entries/94636/">nice tips on using the Canvas tag</a>:</p>
<blockquote><p><span style="font-family: Arial, Verdana, sans-serif; line-height: 20px; font-size: 11.6667px; color: #333333;"> </span></p>
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;"><strong>Cross browser implementation</strong></p>
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;">There are no real discrepancies between the canvas outputs of different browsers so long as the JavaScript code is written correctly (if not, browsers tend to try and fix things for you, often resulting in varying results).</p>
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;">
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;"><strong>Performance</strong></p>
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;">When working with animation on canvas, performance can be a challenge since bitmap operations are very processing expensive, especially at high resolutions. One important optimization rule to follow is to reuse as many pixels as possible between frames. What I mean by that is the fewer pixels that need to be processed each frame, the faster your program will run. A good example of this is when erasing pixels with the <em>clearRect(x,y,w,h)</em>method, it is very beneficial to clear and redraw only the pixels that have changed and not, for instance, a full screen 1920x1280 sized canvas. Unlike the Flash Player’s redraw regions, this management of “dirty rectangles” needs to be done manually for canvas.</p>
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;">
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;"><strong>State stack &amp; transformation</strong></p>
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;">The canvas can be manipulated via transformations such as rotation and scaling, resulting in a change to the canvas co-ordinate system. This is where it’s important to know about the state stack for which two methods are available: “save” (pushes the current state to the stack) and “restore” (reverts to the previous state). This enables you to apply transformation to a drawing and then restore back to the previous state to make sure the next shape is not affected by any earlier transformation. The states also include properties such as the fill and stroke colors.</p>
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;">
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;"><strong>Compositing</strong></p>
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;">A very powerful tool at hand when working with canvas is compositing modes which, amongst other things, allow for masking and layering. As an example, you can check out <a style="cursor: pointer; outline-style: none; outline-width: initial; outline-color: initial; color: #007bb8;" href="http://hakim.se/experiments/html5/bakemono/01/" target="_blank">Bakemono</a>, where composite modes are used to mask the eye and mouth. There's a wide array of <a style="cursor: pointer; outline-style: none; outline-width: initial; outline-color: initial; color: #007bb8;" href="http://simon.html5.org/dump/html5-canvas-cheat-sheet.html" target="_blank">available composite modes</a> and they are all set through the canvas context's “globalCompositeOperation” property.</p>
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;">
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;"><strong>Anti-aliasing</strong></p>
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;">To allow for sub-pixel drawings, all browser implementations of canvas employ anti-aliasing (although this does not seem to be a requirement in the HTML5 spec). Anti-aliasing can be important to keep in mind if you want to draw crisp lines and notice the result looks blurred. To work around this you will need to either round to integer values or offset by half a pixel depending on if you’re drawing fills or strokes.</p>
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;">
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;"><strong>Clearing the canvas</strong></p>
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;">To clear the entire canvas of any existing pixels you would normally use the <em>clearRect(x,y,w,h) </em>function but there is another option available. Whenever the width/height of the canvas are set, even if they are set to the value they already have, the canvas is reset. This is good to know when working with a dynamically sized canvas as you will notice drawings disappearing.</p>
</blockquote>
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;">[<a href="http://twitter.com/mrdoob">via Mr. Doob</a>]</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">
<p><span style="font-family: Arial, Verdana, sans-serif; line-height: 20px; font-size: 11.6667px; color: #333333;"> </span></p>
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;"><strong>Cross browser implementation</strong></p>
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;">There are no real discrepancies between the canvas outputs of different browsers so long as the JavaScript code is written correctly (if not, browsers tend to try and fix things for you, often resulting in varying results).</p>
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;">
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;"><strong>Performance</strong></p>
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;">When working with animation on canvas, performance can be a challenge since bitmap operations are very processing expensive, especially at high resolutions. One important optimization rule to follow is to reuse as many pixels as possible between frames. What I mean by that is the fewer pixels that need to be processed each frame, the faster your program will run. A good example of this is when erasing pixels with the <em>clearRect(x,y,w,h)</em>method, it is very beneficial to clear and redraw only the pixels that have changed and not, for instance, a full screen 1920x1280 sized canvas. Unlike the Flash Player’s redraw regions, this management of “dirty rectangles” needs to be done manually for canvas.</p>
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;">
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;"><strong>State stack &amp; transformation</strong></p>
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;">The canvas can be manipulated via transformations such as rotation and scaling, resulting in a change to the canvas co-ordinate system. This is where it’s important to know about the state stack for which two methods are available: “save” (pushes the current state to the stack) and “restore” (reverts to the previous state). This enables you to apply transformation to a drawing and then restore back to the previous state to make sure the next shape is not affected by any earlier transformation. The states also include properties such as the fill and stroke colors.</p>
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;">
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;"><strong>Compositing</strong></p>
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;">A very powerful tool at hand when working with canvas is compositing modes which, amongst other things, allow for masking and layering. As an example, you can check out <a style="cursor: pointer; outline-style: none; outline-width: initial; outline-color: initial; color: #007bb8;" href="http://hakim.se/experiments/html5/bakemono/01/" target="_blank">Bakemono</a>, where composite modes are used to mask the eye and mouth. There's a wide array of <a style="cursor: pointer; outline-style: none; outline-width: initial; outline-color: initial; color: #007bb8;" href="http://simon.html5.org/dump/html5-canvas-cheat-sheet.html" target="_blank">available composite modes</a> and they are all set through the canvas context's “globalCompositeOperation” property.</p>
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;">
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;"><strong>Anti-aliasing</strong></p>
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;">To allow for sub-pixel drawings, all browser implementations of canvas employ anti-aliasing (although this does not seem to be a requirement in the HTML5 spec). Anti-aliasing can be important to keep in mind if you want to draw crisp lines and notice the result looks blurred. To work around this you will need to either round to integer values or offset by half a pixel depending on if you’re drawing fills or strokes.</p>
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;">
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;"><strong>Clearing the canvas</strong></p>
<p style="color: #333333; font-size: 14px; line-height: 20px; max-width: 640px; overflow-x: hidden; overflow-y: hidden; padding: 0px; margin: 0px;">To clear the entire canvas of any existing pixels you would normally use the <em>clearRect(x,y,w,h) </em>function but there is another option available. Whenever the width/height of the canvas are set, even if they are set to the value they already have, the canvas is reset. This is good to know when working with a dynamically sized canvas as you will notice drawings disappearing.</p>
</div>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ajaxian?a=MBv_qIYH-AE:XvsfcGycpoY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=MBv_qIYH-AE:XvsfcGycpoY:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=MBv_qIYH-AE:XvsfcGycpoY:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ajaxian?i=MBv_qIYH-AE:XvsfcGycpoY:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/real-world-canvas-tips/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		<feedburner:origLink>http://ajaxian.com/archives/real-world-canvas-tips</feedburner:origLink></item>
		<item>
		<title>Motorola Purchases 280 North</title>
		<link>http://feedproxy.google.com/~r/ajaxian/~3/Idtbr1M3I7Q/motorola-purchases-280-north</link>
		<comments>http://ajaxian.com/archives/motorola-purchases-280-north#comments</comments>
		<pubDate>Tue, 24 Aug 2010 22:26:37 +0000</pubDate>
		<dc:creator>Brad Neuberg</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[Front Page]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=10117</guid>
		<description><![CDATA[I don't usually post acquisition news on here, but I just wanted to congratulate 280 North, who we've covered on here many times and are fellow members of the Ajax community. 280 North produces the awesome Cappuccino language/framework, including the 280 Slides presentation web application. Techcrunch is reporting that Motorola has bought 280 North. From [...]]]></description>
			<content:encoded><![CDATA[<p>I don't usually post acquisition news on here, but I just wanted to congratulate <a href="http://280north.com/">280 North</a>, who we've covered on here many times and are fellow members of the Ajax community. 280 North produces the awesome <a href="http://cappuccino.org/">Cappuccino</a> language/framework, including the <a href="http://280slides.com/">280 Slides</a> presentation web application. <a href="http://techcrunch.com/2010/08/24/motorola-snaps-up-280-north-for-20-million/">Techcrunch is reporting</a> that Motorola has bought 280 North. From Motorola:</p>
<blockquote><p><em>I can confirm that Motorola acquired 280 North earlier this summer. The transaction provides Motorola with specialized web-app engineering talent and technology that will help facilitate the continued expansion of Motorola’s application ecosystem. We believe 280 North will be instrumental in helping us continue to foster the Android ecosystem with innovative web-based technologies and applications. Terms of the transaction were not disclosed.</em></p></blockquote>
<p>Congrats!</p>
<p>[<a href="http://ejohn.org/">via John Resig</a>]</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ajaxian?a=Idtbr1M3I7Q:2ZlVY3piA18:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=Idtbr1M3I7Q:2ZlVY3piA18:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=Idtbr1M3I7Q:2ZlVY3piA18:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ajaxian?i=Idtbr1M3I7Q:2ZlVY3piA18:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/motorola-purchases-280-north/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://ajaxian.com/archives/motorola-purchases-280-north</feedburner:origLink></item>
		<item>
		<title>CSS Media Queries: Bees Knees Or Spawn of Satan?</title>
		<link>http://feedproxy.google.com/~r/ajaxian/~3/By5ZOLaQ5Ao/css-media-queries-bees-knees-or-spawn-of-satan</link>
		<comments>http://ajaxian.com/archives/css-media-queries-bees-knees-or-spawn-of-satan#comments</comments>
		<pubDate>Tue, 24 Aug 2010 11:00:58 +0000</pubDate>
		<dc:creator>Brad Neuberg</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Front Page]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=10062</guid>
		<description><![CDATA[The last month has seen an interesting back and forth over CSS Media Queries. In a nutshell, CSS Media Queries make it possible to apply style sheets only if certain properties are available on the display device. For example, you could have a stylesheet only display for screen devices with a maximum screen width of [...]]]></description>
			<content:encoded><![CDATA[<p>The last month has seen an interesting back and forth over <a href="https://developer.mozilla.org/en/css/media_queries">CSS Media Queries</a>. <a href="http://www.youtube.com/watch?v=jKMK3XGO27k">In a nutshell</a>, CSS Media Queries make it possible to apply style sheets only if certain properties are available on the display device. For example, you could have a stylesheet only display for screen devices with a maximum screen width of 480px (i.e. a mobile device) using the following CSS Media Query, bolded below:</p>
<div class="igBar"><a href="javascript:showCodeTxt('css-38');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color:#000000; font-weight:bold;">CSS:</span>
<div id="css-38">
<div class="css">
&lt;link rel=<span style="color: #ff0000;">"stylesheet"</span> type=<span style="color: #ff0000;">"text/css"</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; media=<span style="color: #ff0000;">"screen and (max-device-width: 480px)"</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; href=<span style="color: #ff0000;">"shetland.css"</span> /&gt;<br />
&nbsp;</div>
</div>
</div>
<p>Things kicked off with a <a href="http://www.alistapart.com/articles/responsive-web-design/">nice introductory article</a> by <a href="http://www.alistapart.com/authors/m/emarcotte">Ethan Marcotte</a> introducing CSS Media Queries in order to have responsive and adaptable web designs.</p>
<p style="text-align: center;"><a href="http://www.alistapart.com/articles/responsive-web-design/"><img class="aligncenter size-full wp-image-10064" title="mediaquery1" src="http://ajaxian.com/wp-content/images/mediaquery1.png" alt="" width="293" height="196" /></a></p>
<p>Things started to get interesting with a counter-article by Jason Grigsby titled "<a href="http://www.cloudfour.com/css-media-query-for-mobile-is-fools-gold/">CSS Media Query for Mobile is Fool's Gold</a>". Jason claims:</p>
<blockquote><p>Unfortunately, <strong>CSS media query is fool’s gold for mobile devices</strong>. It hides tough problems and gives developers a false promise of a simple solution for designing to multiple screens.</p></blockquote>
<p style="text-align: center;"><a href="http://en.wikipedia.org/wiki/Pyrite"><img class="aligncenter size-full wp-image-10065" title="Pyrite_foolsgold" src="http://ajaxian.com/wp-content/images/Pyrite_foolsgold.jpg" alt="" width="288" height="221" /></a></p>
<p>His chief issues with CSS Media Queries can be boiled down to:</p>
<blockquote><p>The idea of adding more code—adding more to download—in order to optimize for mobile should be the first clue that this isn’t a good solution.</p></blockquote>
<p>From a high level his other objections are:</p>
<ul>
<li>That speed matters more on mobile devices</li>
<li>That letting the browser scale images for you is a bad idea since delivering images at the maximum size then scaling them down is wasteful on mobile devices</li>
<li>That resizing images on mobile browsers is cpu and memory intensive, both of which mobile devices can lack</li>
</ul>
<p>Jason also discusses some interesting workarounds people have proposed for the above issues still using CSS Media Queries, such as delivering different images at different sizes using different CSS Media Queries and using hidden CSS background images but:</p>
<blockquote><p>However, the <strong>iPhone still downloads the images</strong> even though they are not displayed.</p></blockquote>
<p>He does find some workarounds but there are issues:</p>
<blockquote><p>Two methods that appear to work are:</p>
<ul>
<li>Setting the parent of an element with a background image to display:none.</li>
<li>Using media query min-width declaration to only specify a minimum browser width for the desktop image and a max-width for the mobile image does result in only the mobile image being downloaded in Mobile Safari.</li>
</ul>
<p>These two options mean that using CSS media queries isn’t completely impossible, but using the parent element to hide images and changing existing desktop CSS to add min-width declarations are significant changes to existing CSS. It isn’t going to be as simple as adding a CSS media query for mobile and calling your job done.</p></blockquote>
<p>In the end Jason argues for separate web sites for mobile, but:</p>
<blockquote><p>There are some good uses of CSS media queries. If you’re building a discrete web application where you have more control and can make sure that the desktop web isn’t bloated, it can make sense.</p>
<p>Also, Ros Hodgekiss from Campaign Monitor wrote an exceptional article on how you can use <a href="http://www.campaignmonitor.com/blog/post/3163/optimizing-your-emails-for-mobile-devices-with-media/">media queries in html email</a> to provide a mobile optimized layout. This is perhaps the ideal use case because when you send html email, you have no choice but to send a single html document regardless of what device the recipient will be using.</p></blockquote>
<p>In response to Jason's CSS Media Query smackdown <a href="http://www.quirksmode.org/">PPK</a> wrote up an editorial titled "<a href="http://www.quirksmode.org/blog/archives/2010/08/combining_media.html">Combining Media Queries and JavaScript</a>":</p>
<blockquote><p>On Tuesday Jason Grigsby challenged the conventional view that media queries are all we need to make a website mobile-friendly. Although he’s right when he points out some serious problems, I do not think that media queries are the “fool’s gold,” as Jason says. The message seems to be more that media queries alone are not enough to make your sites mobile-friendly. An additional component is required.</p></blockquote>
<p>PPK argues that CSS Media Queries have their place:</p>
<blockquote><p>Media queries <em>are</em> silver bullets when it comes to <em>pure CSS</em>. Restricting the width of your site, moving sidebars and main navigations elsewhere, media queries can do all that and more.</p>
<p>The trick, however, is that a pure CSS approach is not enough. In addition we need a JavaScript that also reads out the media queries and uses the data to decide whether to download the complicated mapping script, whether to download the low-source or the full-source images, or possibly none.</p>
<p>As far as I know there is no direct access to media queries from JavaScript. You can’t read out whether the example media query above has fired or not.</p></blockquote>
<p>He then talks about a nifty way to pair up JS and CSS Media Queries:</p>
<blockquote><p>Fortunately, there is a pretty safe way of using JavaScript in conjunction with media queries. It turns out that <em>all browsers</em> I tested so far have paired the <code>width</code> and <code>device-width</code> media queries with the values of <code>document.documentElement. clientWidth</code> and <code>screen.width</code>, respectively.</p>
<p>This is a <em>general rule</em>. All mobile browsers that support media queries exhibit these pairings. It’s hard to believe, but I haven’t found any exceptions yet — and rest assured that I searched for them, because I could not believe that it would be this simple. And I will continue to keep an eye on this and report problems as soon as I find them.</p>
<p>...</p>
<p>When these scripts are <em>added to</em> media queries, we’re a whole lot closer to making one website that reacts to a mobile (or rather, a narrow-screen) environment both in its CSS and in its asset management.</p></blockquote>
<p>Finally, <a href="http://www.brucelawson.co.uk/">Bruce Lawson</a> tag teamed into the rumble with an article on the topic titled "<a href="http://my.opera.com/ODIN/blog/theres-more-to-mobile-than-media-queries">There's more to mobile than than media queries</a>":</p>
<blockquote><p>In our enthusiasm to try out media queries and in our rush to skim the latest articles and tutorials, it's easy to overlook caveats and restrictions. Media queries are good at what they do but are just a single tool for a job where two or three are probably needed. In particular, combining them with JavaScript as PPK and others advocate seems to me the most practical solution for web developers to adopt at the moment.</p></blockquote>
<p><center><a href="http://ajaxian.com/wp-content/images/2667481293_43cf507b5a.jpg"><img class="aligncenter size-full wp-image-10066" title="2667481293_43cf507b5a" src="http://ajaxian.com/wp-content/images/2667481293_43cf507b5a.jpg" alt="" width="351" height="500" /></a></center></p>
<p style="text-align: center;">[<a href="http://www.flickr.com/photos/vegaseddie/2667481293/">CC-A by Paolo Camera</a>]</p>
<p>Tell me below whether you think CSS Media Queries are your <a href="http://www.last.fm/music/Pixies/_/There+Goes+My+Gun">friend or foe</a>?</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ajaxian?a=By5ZOLaQ5Ao:BDFoftZB7_s:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=By5ZOLaQ5Ao:BDFoftZB7_s:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=By5ZOLaQ5Ao:BDFoftZB7_s:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ajaxian?i=By5ZOLaQ5Ao:BDFoftZB7_s:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/css-media-queries-bees-knees-or-spawn-of-satan/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://ajaxian.com/archives/css-media-queries-bees-knees-or-spawn-of-satan</feedburner:origLink></item>
		<item>
		<title>Blow Things Up!</title>
		<link>http://feedproxy.google.com/~r/ajaxian/~3/_iTP5kDvB-0/blow-things-up</link>
		<comments>http://ajaxian.com/archives/blow-things-up#comments</comments>
		<pubDate>Tue, 24 Aug 2010 10:00:09 +0000</pubDate>
		<dc:creator>Brad Neuberg</dc:creator>
				<category><![CDATA[Animation]]></category>
		<category><![CDATA[Front Page]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=9987</guid>
		<description><![CDATA[Jonas Wagner has ported the Flash 2D physics engine Box2DFlash to JavaScript:

In his demo Jonas uses the Canvas tag to map the physics simulations on. Click on it to create explosions:

Jonas talks about the approach he used to convert the original library from ActionScript to JavaScript:
At first I thought this conversion would be trivial as [...]]]></description>
			<content:encoded><![CDATA[<p>Jonas Wagner has ported the Flash 2D physics engine <a href="http://www.box2dflash.org/">Box2DFlash</a> to JavaScript:<br />
<a href="http://ajaxian.com/wp-content/images/box2dflash.png"><img src="http://ajaxian.com/wp-content/images/box2dflash.png" alt="" title="box2dflash" width="256" height="256" class="aligncenter size-full wp-image-9988" /></a></p>
<p><a href="http://29a.ch/sandbox/2010/box2d2/test.html">In his demo</a> Jonas uses the Canvas tag to map the physics simulations on. Click on it to create explosions:</p>
<div><a href="http://29a.ch/sandbox/2010/box2d2/test.html"><img src="http://ajaxian.com/wp-content/images/physics1.png" alt="" title="physics1" width="324" height="204" class="aligncenter size-full wp-image-10107" /></a></div>
<p>Jonas talks about the approach he used to convert the original library from ActionScript to JavaScript:</p>
<blockquote><p>At first I thought this conversion would be trivial as both actionscript and javascript are dialects of ECMAScript. Well, I was wrong. Nevertheless I continued to follow my regex based approach, basically trying to ram my head through a wall. After a few attempts I succeeded to convert Box2DAS3 to javascript. It had a nasty bug though. Two solid cubes were able to penetrate each other when they fell on their edges. The reason? ActionScript supports 'properties'. I didn't know about this and the conversion script does not support it. In the end I fixed the few properties in the translated code by hand because I was too lazy to add support for getters and setters to the conversion script. Now it seems to work pretty well. Please keep in mind, this is not a generic actionscript to javascript compiler, it's just a script that happens to work for box2dflash.</p>
<p>The explosions in the demo are simulated by shooting out a few tracer particles with a high density and velocity. The benefit over just applying an impulse to each object is that the strength of the impulse is proportional to the surface area. Also the force of the explosion will to some extent be redirected to the side by the floor. When using this in production code you would probably want to destroy the tracer particles after their first collision or a few seconds.</p></blockquote>
<p>You can grab the converted JavaScript <a href="http://29a.ch/sandbox/2010/box2d2/box2d.js">yourself</a>. There isn't any current documentation but you can follow the <a href="http://www.box2dflash.org/docs/2.0.2/manual">existing Flash box2dflash documentation</a>.</p>
<p>Here's what the explode function looks like in Jonas' test demo for example:</p>
<div class="igBar"><a href="javascript:showCodeTxt('javascript-40');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color:#000000; font-weight:bold;">JAVASCRIPT:</span>
<div id="javascript-40">
<div class="javascript">
<span style="color: #003366; font-weight: bold;">function</span> explode<span style="color:#006600; font-weight:bold;">&#40;</span>x, y<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> ntracer = <span style="color:#800000;">25</span>;<br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">while</span><span style="color:#006600; font-weight:bold;">&#40;</span>explosionParticles.<span style="color: #006600;">length</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; world.<span style="color: #006600;">DestroyBody</span><span style="color:#006600; font-weight:bold;">&#40;</span>explosionParticles.<span style="color: #006600;">pop</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">for</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i = <span style="color:#800000;">0</span>; i &lt;ntracer; i++<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> a = Math.<span style="color: #006600;">PI</span>/ntracer*<span style="color:#800000;">2</span>*i;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> vx = Math.<span style="color: #006600;">cos</span><span style="color:#006600; font-weight:bold;">&#40;</span>a<span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> vy = Math.<span style="color: #006600;">sin</span><span style="color:#006600; font-weight:bold;">&#40;</span>a<span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> bodyDef = <span style="color: #003366; font-weight: bold;">new</span> b2BodyDef<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; bodyDef.<span style="color: #006600;">position</span>.<span style="color: #006600;">Set</span><span style="color:#006600; font-weight:bold;">&#40;</span>x+vx, y+vy<span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; bodyDef.<span style="color: #006600;">isBullet</span> = <span style="color: #003366; font-weight: bold;">true</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> body = world.<span style="color: #006600;">CreateBody</span><span style="color:#006600; font-weight:bold;">&#40;</span>bodyDef<span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> shapeDef = <span style="color: #003366; font-weight: bold;">new</span> b2CircleDef<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; shapeDef.<span style="color: #006600;">radius</span> = <span style="color:#800000;">0</span>.<span style="color:#800000;">1</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//var shapeDef = new b2PolygonDef();</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//shapeDef.SetAsBox(1.0, 1.0);</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; shapeDef.<span style="color: #006600;">restitution</span> = <span style="color:#800000;">0</span>.<span style="color:#800000;">0</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; shapeDef.<span style="color: #006600;">density</span> = <span style="color:#800000;">5000</span>.<span style="color:#800000;">0</span>/ntracer;<br />
&nbsp; &nbsp; &nbsp; &nbsp; shapeDef.<span style="color: #006600;">friction</span> = <span style="color:#800000;">0</span>.<span style="color:#800000;">0</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; body.<span style="color: #006600;">CreateShape</span><span style="color:#006600; font-weight:bold;">&#40;</span>shapeDef<span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; body.<span style="color: #006600;">SetMassFromShapes</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; body.<span style="color: #006600;">ApplyImpulse</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#123;</span>x: vx*<span style="color:#800000;">500</span>, y:vy*<span style="color:#800000;">500</span><span style="color:#006600; font-weight:bold;">&#125;</span>, <span style="color:#006600; font-weight:bold;">&#123;</span>x:x, y:y<span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; body.<span style="color: #006600;">w</span> = <span style="color:#800000;">1</span>.<span style="color:#800000;">0</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; body.<span style="color: #006600;">h</span> = <span style="color:#800000;">1</span>.<span style="color:#800000;">0</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; explosionParticles.<span style="color: #006600;">push</span><span style="color:#006600; font-weight:bold;">&#40;</span>body<span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><br />
<span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp;</div>
</div>
</div>
<p>This library is useful for games and fancy user interfaces using HTML5.</p>
<p>[<a href="http://twitter.com/mrdoob">via Mr. Doob]</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ajaxian?a=_iTP5kDvB-0:R4h3zVnoKFE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=_iTP5kDvB-0:R4h3zVnoKFE:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=_iTP5kDvB-0:R4h3zVnoKFE:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ajaxian?i=_iTP5kDvB-0:R4h3zVnoKFE:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/blow-things-up/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://ajaxian.com/archives/blow-things-up</feedburner:origLink></item>
		<item>
		<title>The CSS3 Song</title>
		<link>http://feedproxy.google.com/~r/ajaxian/~3/KOhtmjbdLSs/the-css3-song</link>
		<comments>http://ajaxian.com/archives/the-css3-song#comments</comments>
		<pubDate>Mon, 23 Aug 2010 11:00:32 +0000</pubDate>
		<dc:creator>Brad Neuberg</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Front Page]]></category>
		<category><![CDATA[Fun]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=10058</guid>
		<description><![CDATA[Don't be bummed it's Monday, 'cuse the CSS3 Song is here to cheer you up:

How can you go wrong with lyrics like this:
CSS3
Web animation done properly
CSS3
Degrading gracefully
I had a dream, an awesome dream
People surfing in the park
On Windows, Linux and Mac
And their page load speeds were oh-so-high
No big JavaScript library
Just to show some eye-candy
CSS3
Web animation [...]]]></description>
			<content:encoded><![CDATA[<p>Don't be bummed it's Monday, 'cuse the <a href="http://my.opera.com/tagawa/blog/css3-song">CSS3 Song</a> is here to cheer you up:</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="385" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/5b7dNNapMCM?fs=1&amp;hl=en_US" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="480" height="385" src="http://www.youtube.com/v/5b7dNNapMCM?fs=1&amp;hl=en_US" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>How can you go wrong with lyrics like this:</p>
<blockquote><p>CSS3<br />
Web animation done properly<br />
CSS3<br />
Degrading gracefully</p>
<p>I had a dream, an awesome dream<br />
People surfing in the park<br />
On Windows, Linux and Mac<br />
And their page load speeds were oh-so-high<br />
No big JavaScript library<br />
Just to show some eye-candy</p>
<p>CSS3<br />
Web animation done properly<br />
CSS3<br />
Degrading gracefully</p>
<p>As we surf down the superhighway<br />
Did you ever even think<br />
We could replace &lt;marquee&gt; and &lt;blink&gt;?<br />
With just one, just one line of code<br />
But it's open to abuse<br />
We must be careful not to overuse it</p>
<p>CSS3<br />
Web animation done properly<br />
CSS3<br />
Degrading gracefully</p>
<p>CSS3<br />
Web animation done properly<br />
CSS3<br />
Degrading gracefully<br />
Degrading gracefully<br />
With HTML5, naturally</p></blockquote>
<p>[<a href="http://www.brucelawson.co.uk/">via Bruce Lawson</a>]</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ajaxian?a=KOhtmjbdLSs:JoTr9XEwLDY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=KOhtmjbdLSs:JoTr9XEwLDY:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=KOhtmjbdLSs:JoTr9XEwLDY:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ajaxian?i=KOhtmjbdLSs:JoTr9XEwLDY:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/the-css3-song/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://ajaxian.com/archives/the-css3-song</feedburner:origLink></item>
		<item>
		<title>Pure Pulsing CSS Map Markers</title>
		<link>http://feedproxy.google.com/~r/ajaxian/~3/kt75oFdyEnw/pure-pulsing-css-map-markers</link>
		<comments>http://ajaxian.com/archives/pure-pulsing-css-map-markers#comments</comments>
		<pubDate>Mon, 23 Aug 2010 10:00:18 +0000</pubDate>
		<dc:creator>Brad Neuberg</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Front Page]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=9982</guid>
		<description><![CDATA[Via Zachary Johnson (aka the Zachstronaut) comes a cool experiment using pure CSS to generate pulsing rings/map markers. He's put together a nice video explaining the concept:

He has a cool demo (Chrome or Safari + Snow Leopard only) of the effect:

The pulsing effect, for example, is generated by a CSS3 Animation:
PLAIN TEXT
CSS:


@-webkit-keyframes ringpulser
&#160; &#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Via <a href="http://www.zachstronaut.com/">Zachary Johnson</a> (aka the Zachstronaut) comes <a href="http://www.zachstronaut.com/posts/2010/04/27/pure-css-map-markers.html">a cool experiment using pure CSS to generate pulsing rings/map markers</a>. He's put together a nice video explaining the concept:</p>
<p><object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/oXXAe6r2mgo?fs=1&amp;hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/oXXAe6r2mgo?fs=1&amp;hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></p>
<p>He has a <a href="http://www.zachstronaut.com/lab/mapmarkers.html">cool demo</a> (Chrome or Safari + Snow Leopard only) of the effect:</p>
<div><a href="http://www.zachstronaut.com/lab/mapmarkers.html"><img src="http://ajaxian.com/wp-content/images/map1.png" alt="" title="map1" width="402" height="140" class="aligncenter size-full wp-image-10110" /></a></div>
<p>The pulsing effect, for example, is generated by a CSS3 Animation:</p>
<div class="igBar"><a href="javascript:showCodeTxt('css-44');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color:#000000; font-weight:bold;">CSS:</span>
<div id="css-44">
<div class="css">
<span style="color: #a1a100;">@-webkit-keyframes ringpulser</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#800000;">0</span>%<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; opacity: <span style="color:#800000;">1</span>.<span style="color:#800000;">0</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -webkit-transform: scale<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;">0</span>.<span style="color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#800000;">80</span>%<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; opacity: <span style="color:#800000;">0</span>.<span style="color:#800000;">0</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -webkit-transform: scale<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;">1</span>.<span style="color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#800000;">100</span>%<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; opacity: <span style="color:#800000;">0</span>.<span style="color:#800000;">0</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -webkit-transform: scale<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;">0</span>.<span style="color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp;</div>
</div>
</div>
<p>The map itself is rotated to a 3D angle using a CSS 3D Transform:</p>
<div class="igBar"><a href="javascript:showCodeTxt('css-45');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color:#000000; font-weight:bold;">CSS:</span>
<div id="css-45">
<div class="css">
<span style="color: #cc00cc;">#map<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">position</span>: <span style="color: #993333;">absolute</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">top</span>: -430px;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">left</span>: 50px;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">background</span>: <span style="color: #993333;">url</span><span style="color:#006600; font-weight:bold;">&#40;</span>planis-map.jpg<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">top</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #993333;">no-repeat</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">width</span>: 800px;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">height</span>: 548px;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;-webkit-transform-style: preserve-3d;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;-webkit-transform: rotateX<span style="color:#006600; font-weight:bold;">&#40;</span>60deg<span style="color:#006600; font-weight:bold;">&#41;</span> translate3d<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;">0</span>, <span style="color:#800000;">0</span>, -500px<span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;opacity: <span style="color:#800000;">0</span>.<span style="color:#800000;">75</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp;</div>
</div>
</div>
<p>While the pin, marker, and pinhead themselves are a combination of CSS 3D, CSS Transforms, CSS Gradients, and more:</p>
<div class="igBar"><a href="javascript:showCodeTxt('css-46');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color:#000000; font-weight:bold;">CSS:</span>
<div id="css-46">
<div class="css">
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666ff;">.marker<br />
</span>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">position</span>: <span style="color: #993333;">absolute</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">width</span>: 100px;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">height</span>: 100px;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -webkit-perspective: <span style="color:#800000;">600</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666ff;">.pin<br />
</span>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">position</span>: <span style="color: #993333;">absolute</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">top</span>: <span style="color:#800000;">10</span>%;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">left</span>: <span style="color:#800000;">52</span>%;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">border-left</span>: 2px <span style="color: #993333;">solid</span> <span style="color: #993333;">transparent</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">border-right</span>: 2px <span style="color: #993333;">solid</span> <span style="color: #993333;">transparent</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">border-top</span>: 40px <span style="color: #993333;">solid</span> #666;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;-webkit-transform: rotate<span style="color:#006600; font-weight:bold;">&#40;</span>9deg<span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">width</span>: <span style="color:#800000;">0</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">height</span>: <span style="color:#800000;">0</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #6666ff;">.pinhead<br />
</span>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">position</span>: <span style="color: #993333;">absolute</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">top</span>: <span style="color:#800000;">8</span>%;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">left</span>: <span style="color:#800000;">49</span>%;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">width</span>: 15px;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">height</span>: 15px;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;-webkit-border-radius: 15px;<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">background</span>: #999 -webkit-gradient<span style="color:#006600; font-weight:bold;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;radial, <span style="color:#800000;">95</span>% <span style="color:#800000;">40</span>%, <span style="color:#800000;">5</span>, <span style="color:#800000;">85</span>% <span style="color:#800000;">40</span>%, <span style="color:#800000;">10</span>, from<span style="color:#006600; font-weight:bold;">&#40;</span>rgba<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;">0</span>, <span style="color:#800000;">0</span>, <span style="color:#800000;">0</span>, <span style="color:#800000;">0</span>.<span style="color:#800000;">40</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>, to<span style="color:#006600; font-weight:bold;">&#40;</span>rgba<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;">0</span>, <span style="color:#800000;">0</span>, <span style="color:#800000;">0</span>, <span style="color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp;</div>
</div>
</div>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ajaxian?a=kt75oFdyEnw:B8ItwzpRumI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=kt75oFdyEnw:B8ItwzpRumI:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=kt75oFdyEnw:B8ItwzpRumI:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ajaxian?i=kt75oFdyEnw:B8ItwzpRumI:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/pure-pulsing-css-map-markers/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://ajaxian.com/archives/pure-pulsing-css-map-markers</feedburner:origLink></item>
		<item>
		<title>Want to pack JS and CSS really well? Convert it to a PNG and unpack it via Canvas</title>
		<link>http://feedproxy.google.com/~r/ajaxian/~3/EuVQN0WFtzU/want-to-pack-js-and-css-really-well-convert-it-to-a-png-and-unpack-it-via-canvas</link>
		<comments>http://ajaxian.com/archives/want-to-pack-js-and-css-really-well-convert-it-to-a-png-and-unpack-it-via-canvas#comments</comments>
		<pubDate>Sun, 22 Aug 2010 19:30:36 +0000</pubDate>
		<dc:creator>Chris Heilmann</dc:creator>
				<category><![CDATA[Canvas]]></category>
		<category><![CDATA[Front Page]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[buildscript]]></category>
		<category><![CDATA[png]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=10102</guid>
		<description><![CDATA[Jacob Seidelin of nihilogic fame (remember his Super Mario in JavaScript solution) is one of my unsung heroes of JavaScript. His solutions have that Dean Edwards "genius bordering on the bat-sh*t-crazy" touch that make you shake your head in disbelief when they come out but later on become very interesting. 
One of his posts from [...]]]></description>
			<content:encoded><![CDATA[<p>Jacob Seidelin of <a href="http://blog.nihilogic.dk/">nihilogic</a> fame (remember his <a href="http://www.nihilogic.dk/labs/mario/mario_small_music.htm">Super Mario in JavaScript</a> solution) is one of my unsung heroes of JavaScript. His solutions have that Dean Edwards "genius bordering on the bat-sh*t-crazy" touch that make you shake your head in disbelief when they come out but later on become very interesting. </p>
<p>One of his <a href="http://blog.nihilogic.dk/2008/05/compression-using-canvas-and-png.html">posts from 2008 entitled "Compression using Canvas and PNG-embedded data"</a> had a good idea: if you want to compress JavaScript and CSS you could <a href="http://dean.edwards.name/packer/">reverse engineer a packing algorithm in JavaScript</a> or you could use a lossless packing system that is already in use and supported in browsers. In this case the packed format is PNG and the way to unpack it is by using the canvas API's getImageData() method:</p>
<div class="igBar"><a href="javascript:showCodeTxt('javascript-48');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color:#000000; font-weight:bold;">JAVASCRIPT:</span>
<div id="javascript-48">
<div class="javascript"><span style="color: #003366; font-weight: bold;">var</span> x = <span style="color: #003366; font-weight: bold;">function</span><span style="color:#006600; font-weight:bold;">&#40;</span>z, m, ix <span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color: #009900; font-style: italic;">// image, callback, chunk index</span><br />
&nbsp; <span style="color: #003366; font-weight: bold;">var</span> o = <span style="color: #003366; font-weight: bold;">new</span> Image<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; o.<span style="color: #006600;">onload</span> = <span style="color: #003366; font-weight: bold;">function</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> s = <span style="color: #3366CC;">""</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; c = d.<span style="color: #006600;">createElement</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #3366CC;">"canvas"</span><span style="color:#006600; font-weight:bold;">&#41;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; t = c.<span style="color: #006600;">getContext</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #3366CC;">"2d"</span><span style="color:#006600; font-weight:bold;">&#41;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; w = o.<span style="color: #006600;">width</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; h = o.<span style="color: #006600;">height</span>;<br />
&nbsp; &nbsp; c.<span style="color: #006600;">width</span> = c.<span style="color: #006600;">style</span>.<span style="color: #006600;">width</span> = w;<br />
&nbsp; &nbsp; c.<span style="color: #006600;">height</span> = c.<span style="color: #006600;">style</span>.<span style="color: #006600;">height</span> = h;<br />
&nbsp; &nbsp; t.<span style="color: #006600;">drawImage</span><span style="color:#006600; font-weight:bold;">&#40;</span>o, <span style="color:#800000;">0</span>, <span style="color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> b = t.<span style="color: #006600;">getImageData</span><span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#800000;">0</span>, <span style="color:#800000;">0</span>, w, h <span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color: #006600;">data</span>; <span style="color: #009900; font-style: italic;">//b : bucket of data</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">for</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i= <span style="color:#800000;">0</span>; i &lt;b.<span style="color: #006600;">length</span>; i += <span style="color:#800000;">4</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span> b<span style="color:#006600; font-weight:bold;">&#91;</span>i<span style="color:#006600; font-weight:bold;">&#93;</span>&gt; <span style="color:#800000;">0</span> <span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; s += String.<span style="color: #006600;">fromCharCode</span><span style="color:#006600; font-weight:bold;">&#40;</span>b<span style="color:#006600; font-weight:bold;">&#91;</span>i<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; m<span style="color:#006600; font-weight:bold;">&#40;</span>s, ix<span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; o.<span style="color: #006600;">src</span> = z;<br />
<span style="color:#006600; font-weight:bold;">&#125;</span></div>
</div>
</div>
<p>As there are quite some <a href="http://10k.aneventapart.com/">interesting</a> <a href="http://js1k.com/home">competitions</a> going on that need really small JavaScript solutions <a href="http://alexle.net/archives/306">Alex Le</a> took up Jacob's work and wrapped it in a <a href="http://gist.github.com/542462">build script that concatenates, packs and converts to a PNG</a> and unpacks it for the 10K competition with a JavaScript. In the process Alex also found some bug in Internet Explorer 9's canvas implementation as it only reads the first 8192 bytes of a PNG and returns 0 for the others :(.</p>
<p>It is pretty amazing how efficient this way of packing is. What we need to test now is when and if it is worth while to have the unpacking done on the client. Imagine adding your JS and CSS to the end of an image and cropping it in CSS to have all the info you need in an app in a single HTTP request. Let the games begin.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ajaxian?a=EuVQN0WFtzU:nid_6tErrGw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=EuVQN0WFtzU:nid_6tErrGw:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=EuVQN0WFtzU:nid_6tErrGw:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ajaxian?i=EuVQN0WFtzU:nid_6tErrGw:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/want-to-pack-js-and-css-really-well-convert-it-to-a-png-and-unpack-it-via-canvas/feed</wfw:commentRss>
		<slash:comments>14</slash:comments>
		<feedburner:origLink>http://ajaxian.com/archives/want-to-pack-js-and-css-really-well-convert-it-to-a-png-and-unpack-it-via-canvas</feedburner:origLink></item>
		<item>
		<title>Attack of the IE Conditional Comment…</title>
		<link>http://feedproxy.google.com/~r/ajaxian/~3/puVCwE_YCCY/attack-of-the-ie-conditional-comment</link>
		<comments>http://ajaxian.com/archives/attack-of-the-ie-conditional-comment#comments</comments>
		<pubDate>Fri, 20 Aug 2010 11:00:16 +0000</pubDate>
		<dc:creator>Brad Neuberg</dc:creator>
				<category><![CDATA[Front Page]]></category>
		<category><![CDATA[IE]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=10052</guid>
		<description><![CDATA[Just in time for Friday, James Padolsey wins the award for most creative Internet Explorer detection code:
PLAIN TEXT
JAVASCRIPT:


// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
//&#160; &#160; &#160;ie === undefined
// If you're in IE (&#62;5) then you can determine which version:
//&#160; &#160; &#160;ie === 7; // IE7
// Thus, to [...]]]></description>
			<content:encoded><![CDATA[<p>Just in time for Friday, <a href="http://james.padolsey.com/">James Padolsey</a> wins the award for most creative Internet Explorer detection code:</p>
<div class="igBar"><a href="javascript:showCodeTxt('javascript-50');">PLAIN TEXT</a></div>
<div class="syntax_hilite"><span style="color:#000000; font-weight:bold;">JAVASCRIPT:</span>
<div id="javascript-50">
<div class="javascript">
<span style="color: #009900; font-style: italic;">// ----------------------------------------------------------</span><br />
<span style="color: #009900; font-style: italic;">// If you're not in IE (or IE version is less than 5) then:</span><br />
<span style="color: #009900; font-style: italic;">//&nbsp; &nbsp; &nbsp;ie === undefined</span><br />
<span style="color: #009900; font-style: italic;">// If you're in IE (&gt;5) then you can determine which version:</span><br />
<span style="color: #009900; font-style: italic;">//&nbsp; &nbsp; &nbsp;ie === 7; // IE7</span><br />
<span style="color: #009900; font-style: italic;">// Thus, to detect IE:</span><br />
<span style="color: #009900; font-style: italic;">//&nbsp; &nbsp; &nbsp;if (ie) {}</span><br />
<span style="color: #009900; font-style: italic;">// And to detect the version:</span><br />
<span style="color: #009900; font-style: italic;">//&nbsp; &nbsp; &nbsp;ie === 6 // IE6</span><br />
<span style="color: #009900; font-style: italic;">//&nbsp; &nbsp; &nbsp;ie&gt; 7 // IE8, IE9 ...</span><br />
<span style="color: #009900; font-style: italic;">//&nbsp; &nbsp; &nbsp;ie &lt;9 // Anything less than IE9</span><br />
<span style="color: #009900; font-style: italic;">// ----------------------------------------------------------</span><br />
<span style="color: #003366; font-weight: bold;">var</span> ie = <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> undef, v = <span style="color:#800000;">3</span>, div = document.<span style="color: #006600;">createElement</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #3366CC;">'div'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">while</span> <span style="color:#006600; font-weight:bold;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; div.<span style="color: #006600;">innerHTML</span> = <span style="color: #3366CC;">'&lt;!--[if gt IE '</span>+<span style="color:#006600; font-weight:bold;">&#40;</span>++v<span style="color:#006600; font-weight:bold;">&#41;</span>+<span style="color: #3366CC;">']&gt;&lt;i&gt;&lt;/i&gt;&lt;![endif]--&gt;'</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; div.<span style="color: #006600;">getElementsByTagName</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #3366CC;">'i'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span><br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> v&gt; <span style="color:#800000;">4</span> ? v : undef;<br />
<span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp;</div>
</div>
</div>
<p><center><a href="http://ajaxian.com/wp-content/images/490423135_a7e8e7b8fa.jpg"><img class="aligncenter size-full wp-image-10053" title="490423135_a7e8e7b8fa" src="http://ajaxian.com/wp-content/images/490423135_a7e8e7b8fa.jpg" alt="" width="202" height="240" /></a><br />
[<i><a href="http://www.flickr.com/photos/thefangmonster/490423135/sizes/m/in/photostream/">CC-A by Noah Sussman</a></i>]</center></p>
<p>That's a pretty creative use of <a href="http://msdn.microsoft.com/en-us/library/ms537512(VS.85).aspx">IE Conditional Comments</a>.</p>
<p>[<a href="http://twitter.com/jdalton">via jdalton</a>]</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ajaxian?a=puVCwE_YCCY:S6TsHU1wMxU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=puVCwE_YCCY:S6TsHU1wMxU:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=puVCwE_YCCY:S6TsHU1wMxU:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ajaxian?i=puVCwE_YCCY:S6TsHU1wMxU:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/attack-of-the-ie-conditional-comment/feed</wfw:commentRss>
		<slash:comments>25</slash:comments>
		<feedburner:origLink>http://ajaxian.com/archives/attack-of-the-ie-conditional-comment</feedburner:origLink></item>
		<item>
		<title>Auto-Generate CSS3 For Fame and Fortune!</title>
		<link>http://feedproxy.google.com/~r/ajaxian/~3/f9PoxvCLXs8/auto-generate-css3-for-fame-and-fortune</link>
		<comments>http://ajaxian.com/archives/auto-generate-css3-for-fame-and-fortune#comments</comments>
		<pubDate>Fri, 20 Aug 2010 10:00:14 +0000</pubDate>
		<dc:creator>Brad Neuberg</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Front Page]]></category>

		<guid isPermaLink="false">http://ajaxian.com/?p=9974</guid>
		<description><![CDATA[
We've seen a number of nice CSS3 generators. I stumbled across another one recently that has a nice set of features for autogenerating the following from a single CSS3 generator web page:

Border Radius
Gradients
CSS Transforms
CSS Animations
CSS Transitions
Text Shadow
Box Shadow
Text Rotation
@Font Face


]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://ajaxian.com/wp-content/images/CSS3Generator.png"><img class="aligncenter size-full wp-image-9976" title="CSS3Generator" src="http://ajaxian.com/wp-content/images/CSS3Generator.png" alt="" width="479" height="112" /></a></p>
<p>We've seen a number of nice CSS3 generators. I <a href="http://www.css3maker.com/">stumbled across another one</a> recently that has a nice set of features for autogenerating the following from a single CSS3 generator web page:</p>
<ul>
<li>Border Radius</li>
<li>Gradients</li>
<li>CSS Transforms</li>
<li>CSS Animations</li>
<li>CSS Transitions</li>
<li>Text Shadow</li>
<li>Box Shadow</li>
<li>Text Rotation</li>
<li>@Font Face</li>
</ul>
<p style="text-align: center;"><a href="http://ajaxian.com/wp-content/images/CSS3Generator2.png"><img class="aligncenter size-full wp-image-9977" title="CSS3Generator2" src="http://ajaxian.com/wp-content/images/CSS3Generator2.png" alt="" width="479" height="225" /></a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ajaxian?a=f9PoxvCLXs8:uCPOzaNFuVg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=f9PoxvCLXs8:uCPOzaNFuVg:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/ajaxian?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ajaxian?a=f9PoxvCLXs8:uCPOzaNFuVg:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ajaxian?i=f9PoxvCLXs8:uCPOzaNFuVg:D7DqB2pKExk" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://ajaxian.com/archives/auto-generate-css3-for-fame-and-fortune/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://ajaxian.com/archives/auto-generate-css3-for-fame-and-fortune</feedburner:origLink></item>
	</channel>
</rss>
