<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>samuli.hakoniemi.net &#187; Web Development</title>
	<atom:link href="http://samuli.hakoniemi.net/tag/webdev/feed/" rel="self" type="application/rss+xml" />
	<link>http://samuli.hakoniemi.net</link>
	<description></description>
	<lastBuildDate>Thu, 20 Oct 2011 10:03:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<atom:link rel='hub' href='http://samuli.hakoniemi.net/?pushpress=hub'/>
		<item>
		<title>iOS 5 and New Features for Web Developers</title>
		<link>http://samuli.hakoniemi.net/ios-5-and-new-features-for-web-developers/</link>
		<comments>http://samuli.hakoniemi.net/ios-5-and-new-features-for-web-developers/#comments</comments>
		<pubDate>Wed, 12 Oct 2011 21:33:01 +0000</pubDate>
		<dc:creator>Samuli Hakoniemi</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[features]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[safari]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://samuli.hakoniemi.net/?p=777</guid>
		<description><![CDATA[<a href="/ios-5-and-new-features-for-web-developers"><img src="/wp-content/images/ios5-new-features/ios5-new-features.jpg" alt="iOS 5 and New Features for Web Developers" /></a>

<p>The final version of iOS 5 has been finally released and there's lots of buzz going around it's new features. Most of the discussion focuses on the operating system itself which is totally understandable. There are lots of improvements and nifty little features to play with.</p>

<p>But one thing that seems not to get such attention is what iOS 5 brings to us, web developers, and how it improves the experience with web applications.</p>

<p>In this article I'll go through most of the major features that are included in iOS 5 for web developer point-of-view.</p>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsamuli.hakoniemi.net%2Fios-5-and-new-features-for-web-developers%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsamuli.hakoniemi.net%2Fios-5-and-new-features-for-web-developers%2F&amp;source=zvona&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><img src="/wp-content/images/ios5-new-features/ios5-new-features.jpg" alt="iOS 5 and New Features for Web Developers" /></p>
<div class="ingress">
<p>The final version of iOS 5 has been finally released and there&#8217;s lots of buzz going around it&#8217;s new features. Most of the discussion focuses on the operating system itself which is totally understandable. There are lots of improvements and nifty little features to play with.</p>
<p>But one thing that seems not to get such attention is what iOS 5 brings to us, web developers, and how it improves the experience with web applications.</p>
<p>In this article I&#8217;ll go through most of the major features that are included in iOS 5 for web developer point-of-view.</p>
</div>
<h2>Table of Contents</h2>
<ul>
<li><a href="#webkit-overflow-scrolling">-webkit-overflow-scrolling</a></li>
<li><a href="#position-fixed">position:fixed</a></li>
<li><a href="#new-input-types">New Input Types</a></li>
<li><a href="#woff-font-support">WOFF Font Support</a></li>
<li><a href="#web-workers">Web Workers API</a></li>
<li><a href="#content-editable">contentEditable</a></li>
<li><a href="#classlist">classList API</a></li>
<li><a href="#matchmedia">matchMedia()</a></li>
<li><a href="#changes-in-gesture-events">Changes in Gestures Events</a></li>
<li><a href="#compass">Compass</a></li>
<li><a href="#webgl">WebGL</a></li>
<li><a href="#anythingelse">Anything Else?</a></li>
</ul>
<h2><a name="webkit-overflow-scrolling"></a>-webkit-overflow-scrolling</h2>
<p>This is probably most anticipated feature for web applications. Until today it hasn&#8217;t been easily possible to add scrollable content in web document.</p>
<p>Briefly, all you need to define is:</p>
<pre name="code" class="css">elem {
 overflow:scroll;
 -webkit-overflow-scrolling:touch;
}</pre>
<p>To achieve proper scrolling support for iOS 4 and/or other devices, I strongly suggest using  <a rel="external" href="http://cubiq.org/iscroll-4">iScroll 4</a>.</p>
<p>And if you want to display scrollbars all the time, read this post: <a rel="external" href="http://simurai.com/post/8083942390/force-lion-scrollbar">Force Lion’s scrollbar back</a>. It will help you on displaying the scrollbar while user is not accessing the scrollable area, which is a very good visual guidance for user that content can be scrolled. But be warned: &#8220;custom&#8221; scrollbar won&#8217;t update it&#8217;s location while user is scrolling and meantime there are two scrollbars displayed.</p>
<h2><a name="position-fixed">position:fixed</a></h2>
<p>Position:fixed is well-known CSS property that hasn&#8217;t earlier been included in iOS. But now it&#8217;s there, ready to use.</p>
<p>I noticed that setting a fixed element it has partial transparency by default. You even can&#8217;t turn it off by setting opacity to 1.0. If you happen to know how to solve this, please comment on my blog.</p>
<h2><a name="new-input-types"></a>New Input Types</h2>
<p>iOS5 provides several new input types that didn&#8217;t exist earlier on iOS4. These input types are: <i>date</i>, <i>time</i>, <i>datetime</i>, <i>month</i> and <i>range</i>.</p>
<p>I have to mention that the user experience with <i>range</i> is awful &#8211; with your (fat) finger you end up selecting the whole control instead of value slider all the time.</p>
<p><strong>Note:</strong> input type=&#8221;file&#8221; isn&#8217;t still working. &#8220;Choose File&#8221; button is displayed, but at the same time it&#8217;s disabled.</p>
<h2><a name="woff-font-support">WOFF Font Support</a></h2>
<p>iOS 5 supports WOFF (Web Open Font Format) fonts. This is good news in a way. I haven&#8217;t personally tested whether there&#8217;s any benefit compared to SVG or TTF from a rendering or performance point-of-view.</p>
<h2><a name="web-workers">Web Workers</a></h2>
<p>Web Workers API is a bit less familiar for many developers. They allow to run long-running scripts without halting the user interface and they&#8217;re not interrupted by other actions.</p>
<p>The problem with Web Workers on iOS 5 is &#8211; as you may guess &#8211; the perfomance. You can try Web Workers with <a rel="external" href="http://pmav.eu/stuff/javascript-webworkers/">Javascript Web Workers Test</a>. But I have to mention that while it took only about five seconds with my workstation, the same execution time with my iPhone 4 was 106 seconds. So as you can see, there&#8217;s a huge difference on performance.</p>
<h2><a name="content-editable">contentEditable</a></h2>
<p>iOS 5 supports <i>contentEditable</i> attribute, which allows rich text editing (RTE) of content. This is very welcomed feature offering the possibility of building WYSIWYG editors that can be used eg. with iPad.</p>
<p>Read more about this feature at: <a rel="external" href="http://www.midwesternmac.com/blogs/jeff-geerling/wysiwyg-editing">WYSIWYG Editing (contentEditable support) in iOS 5</a>.</p>
<h2><a name="classlist">classList API</a></h2>
<p>ClassList API is very useful while writing native JavaScript. It has few simple functions (like add(), remove(), toggle()) that are meant for handling classNames in an element.</p>
<p>If you want to implement classList API and ensure backwards compatibility, use <a rel="external" href="https://github.com/eligrey/classList.js">classList.js</a> polyfill, written by Eli Grey.</p>
<h2><a name="matchmedia">matchMedia()</a></h2>
<p>Function matchMedia() is relatively new function for detecting media queries with JavaScript. The implementation is very simple:</p>
<pre name="code" class="javascript">
if (matchMedia("(min-width: 1024px)").matches) {
    alert('your screen is at least 1024px wide');
}
else {
    alert('your screen is less than 1024px wide');
}</pre>
<p>Can&#8217;t say how useful that is yet, since I&#8217;ve personally never used it before. But we&#8217;re living the times of Responsive Web Design and there may be conditions where this may be needed.</p>
<p>For browsers that doesn&#8217;t support matchMedia(), there is a <a rel="external" href="https://github.com/paulirish/matchMedia.js/blob/master/matchMedia.js">matchMedia.js</a> polyfill available, written by Paul Irish.</p>
<p>And if you&#8217;re more interested in similar logic, I suggest reading about <a rel="external" href="http://yepnopejs.com/">yepnope.js</a>.</p>
<h2><a name="changes-in-gestures-events">Changes in Gestures Events</a></h2>
<p>Gestures events (<i>gesturestart</i>, <i>gesturechange</i>, <i>gestureend</i>) now returns <i>pageX</i> and <i>pageY</i> values for events &#8211; in addition to <i>scale</i> and <i>rotate</i> values. These values didn&#8217;t exist in iOS4, forcing developer to retrieve X/Y-coordinates with corresponding touch events.</p>
<h2><a name="compass">Compass</a></h2>
<p>iOS 5 comes also with two neat properties: <i>webkitCompassHeading</i> and <i>webkitCompassAccuracy</i>. You can read more about them and test them at: <a rel="external" href="http://tripleodeon.com/2011/10/taking-a-new-device-api-for-a-spin">Taking a new device API for a spin</a>.</p>
<h2><a name="webgl">WebGL</a></h2>
<p>Well&#8230; WebGL is kind of implemented in iOS5. But only for iAd.</p>
<p>However there are rumors promising good, and already it&#8217;s said that &#8220;things are in place&#8221; but they&#8217;re just not fully working (or have been disabled). So, let&#8217;s keep our fingers crossed that next (minor) update will include support for WebGL.</p>
<h2><a name="anythingelse">Anything Else?</a></h2>
<p>Mark Hammonds has written a comprehensive article in mobiletuts+, titled <a rel="external" href="http://mobile.tutsplus.com/tutorials/mobile-web-apps/safari-5_html5/">iOS 5 for Web Devs: Safari Mobile Updates</a>. That&#8217;s really worth of reading!</p>
<p>And if you&#8217;re interested in browser performance in general, then you should read <a rel="external" href="http://www.blaze.io/mobile/ios5-top10-performance-changes/">iOS 5 Top 10 Browser Performance Changes</a>.</p>
<p>If there are other things to mention, feel free to comment and bring your ideas up. I&#8217;ll keep on updating this post right after new information arises about iOS 5.</p>
]]></content:encoded>
			<wfw:commentRss>http://samuli.hakoniemi.net/ios-5-and-new-features-for-web-developers/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>10 Small Things You May Not Know About Javascript</title>
		<link>http://samuli.hakoniemi.net/10-small-things-you-may-not-know-about-javascript/</link>
		<comments>http://samuli.hakoniemi.net/10-small-things-you-may-not-know-about-javascript/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 00:02:40 +0000</pubDate>
		<dc:creator>Samuli Hakoniemi</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://samuli.hakoniemi.net/?p=150</guid>
		<description><![CDATA[In this article, I'll provide ten small Javascript tips, mainly aimed for beginner and intermediate Javascript developers.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsamuli.hakoniemi.net%2F10-small-things-you-may-not-know-about-javascript%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsamuli.hakoniemi.net%2F10-small-things-you-may-not-know-about-javascript%2F&amp;source=zvona&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>[tweetmeme]<br />
It doesn&#8217;t matter how many years I&#8217;ve been dealing with Javascript &#8211; it contains many little things that surprises me almost every week. For me, Javascript means a constant learning process.</p>
<p>In this article, I&#8217;ll provide ten small Javascript tips, mainly aimed for beginner and intermediate Javascript developers. Hopefully there&#8217;s at least one useful tip for every reader :).</p>
<h2>1. Variables conversions</h2>
<p>This sounds quite obvious, but as far I&#8217;ve seen, using object constructors, like <i>Array()</i> or <i>Number()</i> for converting variables is quite common practice.</p>
<p>Always use primitive data types (sometimes referred as literals) for converting variables. These won&#8217;t do any extra tricks and they usually have better performance.</p>
<pre name="code" class="javascript:nocontrols">var myVar	= "3.14159",
	str		= ""+ myVar,//	to string
	int		= ~~myVar,	//	to integer
	float	= 1*myVar,	//	to float
	bool	= !!myVar,	/*	to boolean - any string with length
							and any number except 0 are true */
	array	= [myVar];	//	to array</pre>
<p>Converting to dates (new Date(myVar)) and regular expressions (new RegExp(myVar)) must be done with constructors. However, always use <i>/pattern/flags</i> when creating regular expressions.</p>
<h2>2. Converting decimals to hex or octals and vice versa</h2>
<p>Are you writing separate functions for hex (or octal) conversios? Stop. This can be easily done with existing methods:</p>
<pre name="code" class="javascript:nocontrols">(int).toString(16);	// converts int to hex, eg 12 => "C"
(int).toString(8);	// converts int to octal, eg. 12 => "14"
parseInt(string, 16) // converts hex to int, eg. "FF" => 255
parseInt(string, 8) // converts octal to int, eg. "20" => 16</pre>
<h2>3. More playing with numbers</h2>
<p>In addition to previous section, here are some more small tricks with when dealing with numbers.</p>
<pre name="code" class="javascript:nocontrols">0xFF; // Hex declaration, returns 255
020; // Octal declaration, returns 16
1e3; // Exponential, same as 1 * Math.pow(10,3), returns 1000
(1000).toExponential(); // Opposite with previous, returns 1e3
(3.1415).toFixed(3); // Rounding the number, returns "3.142"</pre>
<h2>4. Javascript Version Detection</h2>
<p>Are you aware which version of Javascript your browser supports? If not, check <a href="http://en.wikipedia.org/wiki/JavaScript#Versions" title="Wikipedia: Javascript Versions">Javascript Versions</a> sheet from Wikipedia.</p>
<p>For some reason, features in <a href="https://developer.mozilla.org/en/New_in_JavaScript_1.7" title="MDC: New in Javascript 1.7">Javascript version 1.7</a> are not widely supported. However, most browsers released within a year support features in version 1.8 (and in 1.8.1).</p>
<p>Note: all the versions of Internet Explorer (8 and older) supports only Javascript version 1.5.</p>
<p>Here&#8217;s a tiny script both for detecting the version of Javascript via feature detection. It also allows checking support for specific version of Javascript:</p>
<pre name="code" class="javascript:nocontrols">var JS_ver	= [];

(Number.prototype.toFixed)?JS_ver.push("1.5"):false;
([].indexOf &#038;&#038; [].forEach)?JS_ver.push("1.6"):false;
((function(){try {[a,b] = [0,1];return true;}catch(ex) {return false;}})())?JS_ver.push("1.7"):false;
([].reduce &#038;&#038; [].reduceRight &#038;&#038; JSON)?JS_ver.push("1.8"):false;
("".trimLeft)?JS_ver.push("1.8.1"):false;

JS_ver.supports	= function()
{
	if (arguments[0])
		return (!!~this.join().indexOf(arguments[0] +",") +",");
	else
		return (this[this.length-1]);
}

alert("Latest Javascript version supported: "+ JS_ver.supports());
alert("Support for version 1.7 : "+ JS_ver.supports("1.7"));</pre>
<h2>5. window.name for simple session handling</h2>
<p>This one is something I really like. You can assign values as a string for <i>window.name</i> property and it preserves the values until you close the tab or window.</p>
<p>Although I&#8217;m not providing any script, I strongly suggest you to take full advantage from it. For instance, it&#8217;s very useful for toggling between debugging and (perfomance) testing modes, when building a website or an application.</p>
<h2>6. Testing existence of property</h2>
<p>This issue can be approached at least from two directions. Either we check whether property exists or we check the type of property. But always avoid these small mistakes:</p>
<pre name="code" class="javascript:nocontrols">// BAD: This will cause an error in code when foo is undefined
if (foo) {
	doSomething();
} 

// GOOD: This doesn't cause any errors. However, even when
// foo is set to NULL or false, the condition validates as true
if (typeof foo != "undefined") {
	doSomething();
}

// BETTER: This doesn't cause any errors and in addition
// values NULL or false won't validate as true
if (window.foo) {
	doSomething();
}</pre>
<p>However, there may be situations, when we have deeper structure and proper checking would look like this:</p>
<pre name="code" class="javascript:nocontrols">// UGLY: we have to proof existence of every
// object before we can be sure property actually exists
if (window.oFoo &#038;&#038; oFoo.oBar &#038;&#038; oFoo.oBar.baz) {
	doSomething();
}</pre>
<h2>7. Passing arguments for function</h2>
<p>When function has both required and optional parameters (arguments), eventually we may end up with functions and function calls looking like this:</p>
<pre name="code" class="javascript:nocontrols">function doSomething(arg0, arg1, arg2, arg3, arg4) {
...
}

doSomething('', 'foo', 5, [], false);</pre>
<p>It&#8217;s always easier to pass only one object instead of several arguments:</p>
<pre name="code" class="javascript:nocontrols">function doSomething() {
	// Leaves the function if nothing is passed
	if (!arguments[0]) {
		return false;
	}

	var oArgs	= arguments[0]
		arg0	= oArgs.arg0 || "",
		arg1	= oArgs.arg1 || "",
		arg2	= oArgs.arg2 || 0,
		arg3	= oArgs.arg3 || [],
		arg4	= oArgs.arg4 || false;
}

doSomething({
	arg1	: "foo",
	arg2	: 5,
	arg4	: false
});
</pre>
<p>This is only a rough example of passing an object as an argument. For instance, we could declare an object with name of the variable as keys and default values as properties (and/or data types).</p>
<h2>8. Using document.createDocumentFragment()</h2>
<p>You may need to dynamically append multiple elements into document. However, appending them directly into document will fire redrawing of whole view every time, which causes perfomance penalty. Instead, you should use document fragments, which are appended only once after completion:</p>
<pre name="code" class="javascript:nocontrols">function createList() {
	var aLI	= ["first item", "second item", "third item",
		"fourth item", "fith item"];

	// Creates the fragment
	var oFrag	= document.createDocumentFragment();

	while (aLI.length) {
		var oLI	= document.createElement("li");

		// Removes the first item from array and appends it
		// as a text node to LI element
		oLI.appendChild(document.createTextNode(aLI.shift()));
		oFrag.appendChild(oLI);
	}

	document.getElementById('myUL').appendChild(oFrag);
}</pre>
<h2>9. Passing a function for replace() method</h2>
<p>There are situations when you want to replace specific parts of the string with specific values. The best way of doing this would be passing a separate function for method String.replace().</p>
<p>Following example is a rough implementation of making a more verbose output from a single deal in online poker:</p>
<pre name="code" class="javascript:nocontrols">var sFlop	= "Flop: [Ah] [Ks] [7c]";
var aValues	= {"A":"Ace","K":"King",7:"Seven"};
var aSuits	= {"h":"Hearts","s":"Spades",
			"d":"Diamonds","c":"Clubs"};

sFlop	= sFlop.replace(/\[\w+\]/gi, function(match) {
	match	= match.replace(match[2], aSuits[match[2]]);
	match	= match.replace(match[1], aValues[match[1]] +" of ");

	return match;
});

// string sFlop now contains:
// "Flop: [Ace of Hearts] [King of Spades] [Seven of Clubs]"
</pre>
<h2>10. Labeling of loops (iterations)</h2>
<p>Sometimes, you may have iterations inside iterations and you may want to exit between looping. This can be done by labeling:</p>
<pre name="code" class="javascript:nocontrols">outerloop:
for (var iI=0;iI<5;iI++) {
	if (somethingIsTrue()) {
		// Breaks the outer loop iteration
		break outerloop;
	}

	innerloop:
	for (var iA=0;iA<5;iA++) {
		if (somethingElseIsTrue()) {
			// Breaks the inner loop iteration
			break innerloop;
		}

	}
}</pre>
<h2>Afterwords</h2>
<p>Go ahead and comment! Did you learn anything new? Do you have good tips to share? I'm always delighted for sharing information about all the little details in Javascript.</p>
<p>And if you want to familiarize with Javascript irregularities, I suggest you visiting at <a rel="external" href="http://wtfjs.com/" title="wtfjs">wtfjs</a> :).</p>
]]></content:encoded>
			<wfw:commentRss>http://samuli.hakoniemi.net/10-small-things-you-may-not-know-about-javascript/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>Cross-browser Rotation Transformation with CSS</title>
		<link>http://samuli.hakoniemi.net/cross-browser-rotation-transformation-with-css/</link>
		<comments>http://samuli.hakoniemi.net/cross-browser-rotation-transformation-with-css/#comments</comments>
		<pubDate>Wed, 23 Dec 2009 11:37:50 +0000</pubDate>
		<dc:creator>Samuli Hakoniemi</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[opera]]></category>
		<category><![CDATA[rotation]]></category>
		<category><![CDATA[transformation]]></category>

		<guid isPermaLink="false">http://samuli.hakoniemi.net/?p=41</guid>
		<description><![CDATA[I was about not to publish anything before Christmas - just calming down, taking some extra time to get my blog design finished, plugins installed, and so on..

..but no. I got way too excited when I heard today that <a title="Opera Labs" href="http://labs.opera.com/news/2009/12/22/">Opera 10.5 pre-alpha for Labs</a> was released. In other words, this means that an updated version of Opera's layout engine, Presto, was out to play with - meaning, that CSS3 Transformations and Transitions are available also for Opera.

In this article, we write some lines of CSS and create rotating transform effect with all the common browsers, including Internet Explorer and the latest version of Opera.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsamuli.hakoniemi.net%2Fcross-browser-rotation-transformation-with-css%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsamuli.hakoniemi.net%2Fcross-browser-rotation-transformation-with-css%2F&amp;source=zvona&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>[tweetmeme]<br />
I was about not to publish anything before Christmas &#8211; just calming down, taking some extra time to get my blog design finished, plugins installed, and so on..</p>
<p>..but no. I got way too excited when I heard today that <a title="Opera Labs" href="http://labs.opera.com/news/2009/12/22/">Opera 10.5 pre-alpha for Labs</a> was released. In other words, this means that an updated version of Opera&#8217;s layout engine, Presto, was out to play with &#8211; meaning, that CSS3 Transformations and Transitions are available also for Opera.</p>
<p>In this article, we write some lines of CSS and create rotating transform effect with all the common browsers, including Internet Explorer and the latest version of Opera.</p>
<h2>Issues with Opera and IE</h2>
<p>Opera offers <a href="http://www.opera.com/docs/specs/presto23/css/transitions/">CSS3 Transitions support in Opera Presto 2.3</a>, at least partially. By the specification, we&#8217;re able to take advantage of <em>-o-transform:rotate(deg);</em>.</p>
<p>IE is a bit trickier (big surprise). Fortunately there&#8217;s a nice filter available, called <a href="http://msdn.microsoft.com/en-us/library/ms533014%28VS.85%29.aspx">Matrix</a>. The values for matrix are quite complicated, hence some assistance with Javascript is needed.</p>
<p>In my case, I&#8217;ve created some functionality and bound it with HTC file to CSS selectors. The functionality is based on values of property <em>-ms-transformation</em>. I&#8217;ve also implemented <em>-ms-transition</em> for transitions, but this will be examined further on later posts.</p>
<h2>Example code</h2>
<p>In this example, I&#8217;ll be using A-elements for hover support in IE6. I&#8217;ve already written a small implementation similar to <a href="http://www.xs4all.nl/~peterned/csshover.html">Whatever:hover</a>, but that &#8220;project&#8221; is still taking baby steps.</p>
<p>So let&#8217;s cut the chase and create some lines of code:</p>
<h3>HTML</h3>
<p><code>&lt;a href="#" id="one" class="rotate"&gt;This is 45deg -rotated element.&lt;/a&gt;<br />
&lt;a href="#" id="two" class="rotate"&gt;This is 10deg -rotated element, which rotates to 45deg when hovered.&lt;/a&gt;</code></p>
<h3>CSS</h3>
<p><code>#one	{<br />
behavior:url(-ms-transform.htc);<br />
-moz-transform:rotate(45deg);<br />
-webkit-transform:rotate(45deg);<br />
-o-transform:rotate(45deg);<br />
-ms-transform:rotate(45deg);<br />
}<br />
#two	{<br />
behavior:url(-ms-transform.htc);<br />
-moz-transform:rotate(10deg);<br />
-webkit-transform:rotate(10deg);<br />
-o-transform:rotate(10deg);<br />
-ms-transform:rotate(10deg);<br />
}<br />
#two:hover	{<br />
-moz-transform:rotate(45deg);<br />
-webkit-transform:rotate(45deg);<br />
-o-transform:rotate(45deg);<br />
-ms-transform:rotate(45deg);<br />
}</code></p>
<h2>Demo</h2>
<p>You can view demo at <a class="linkForDemo" href="http://demo.hakoniemi.net/Cross-browserRotateTransformationwithCSS/">Demo section: Cross-browser Rotation Transformation with CSS</a>.</p>
<h2>Final thoughts</h2>
<p>Although everything &#8220;is not fully there&#8221;, this article shows the possibility for implementing cross-browser CSS3 Transformations purely with CSS.</p>
<p>In addition, this post works as an opening post of my blog. Feel free to give feedback. Merry Christmas!</p>
]]></content:encoded>
			<wfw:commentRss>http://samuli.hakoniemi.net/cross-browser-rotation-transformation-with-css/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
	</channel>
</rss>

