<?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>A Twofer &#187; CSS</title>
	<atom:link href="http://www.atwofer.com/category/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.atwofer.com</link>
	<description>A place to talk about Software Development (RoR, J2EE, J2ME, CSS, HTML, JavaScript, Objective-C, etc) and some other stuff</description>
	<lastBuildDate>Fri, 16 Jul 2010 14:56:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>IE7 Tricks</title>
		<link>http://www.atwofer.com/2008/12/10/ie7-tricks/</link>
		<comments>http://www.atwofer.com/2008/12/10/ie7-tricks/#comments</comments>
		<pubDate>Wed, 10 Dec 2008 18:09:51 +0000</pubDate>
		<dc:creator>Randy</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[IE7]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Mootools]]></category>

		<guid isPermaLink="false">http://www.atwofer.com/?p=10</guid>
		<description><![CDATA[Hey, my first post and I already spent an hour setting up wordpress so I&#8217;ll keep it short.  Recently, we did an overhaul of our video management web application at Episodic.  Like any sane web developer I did all my testing in Firefox and then found myself with one day left before pushing to production [...]]]></description>
			<content:encoded><![CDATA[<p>Hey, my first post and I already spent an hour setting up wordpress so I&#8217;ll keep it short.  Recently, we did an overhaul of our video management web application at <a href="http://www.episodic.com">Episodic</a>.  Like any sane web developer I did all my testing in Firefox and then found myself with one day left before pushing to production and I had yet to look at our site in IE7 (IE6 not supported).</p>
<p>So I RDC&#8217;d to our one Windows box and, uh oh, it don&#8217;t look so good and there are a bunch of JS errors.  Here were a few of the main problems that I had to solve for IE.</p>
<p><strong>Trailing Commas</strong></p>
<p>IE does not like trailing commas in things like object declarations.  For example, you will get a very general JS error that points to a line that has nothing to do with the problem if you have the following:</p>
<p><code>var myObject = {<br />
<span style="padding-left: 10px;">foo: 'bar'</span>,<br />
<span style="padding-left: 10px;">baz: anotherObject<span style="color: #800000;">,</span></span><br />
};</code></p>
<p><strong>Positioning and Z-Index</strong></p>
<p>Our site has a lot of fancy drop-down menus.  The menu is absolutely positioned within some relatively positioned element and then given a z-index so that it appears overtop of other elements on the page.  However, this was a problem on IE when I noticed that my menu would actually appear behind some elements on the page.  In particular, the menu would appear behind other elements that have &#8220;position:relative&#8221;.</p>
<p>This took a while for me to figure out.  Eventually it came down to this: If an absolutely positioned element has a z-index then it&#8217;s containing relatively positioned element must specify a z-index (z-index:1) in order for the absolutely positioned element to be able to appear on top of other relatively positioned elements.</p>
<p>I did not come up with this on my own but it did take me a while to find this excellent page called &#8220;<a href="http://css-class.com/test/css/visformatting/layers/z-index.htm">Z-Indexing with position relative and absolute</a>&#8220;.</p>
<p><strong>Mootools Events Targets</strong></p>
<p>I LOVE <a href="http://www.mootools.net">Mootools</a>.  Eventually I will do another post about some Mootools tricks I have picked up but for now I&#8217;ll stay within the context of this post.  I have a lot of JS code that looks like the following:</p>
<p><code>someElement.addEvent('click', function(event) {<br />
<span style="padding-left:10px">if (event.target.get('tag') == 'li'</span><br />
<span style="padding-left:20px">event.target.dispose();</span><br />
});</code></p>
<p>However, the Mootools documentation says that <span style="text-decoration: underline;">the event target, is not extended with $ for performance reasons</span> (which actually only seems to be true in IE and would result in JS errors).  Therefore, the above case should be written as:</p>
<p><code>someElement.addEvent('click', function(event) {<br />
<span style="padding-left:10px">if ($(event.target).get('tag') == 'li'</span><br />
<span style="padding-left:20px">$(event.target).dispose();</span><br />
});</code></p>
<p>To avoid writing code like this everywhere I extended the Event class as follows:</p>
<p><code>Event.implement({<br />
<span style="padding-left:10px">getTarget: function() {</span><br />
<span style="padding-left:20px">if (!this.extendedTarget)</span><br />
<span style="padding-left:30px">this.extendedTarget = $(this.target);</span><br />
<span style="padding-left:20px">return this.extendedTarget;</span><br />
});</code></p>
<p>This left me with:</p>
<p><code>someElement.addEvent('click', function(event) {<br />
<span style="padding-left:10px">if (event.getTarget().get('tag') == 'li'</span><br />
<span style="padding-left:20px">event.getTarget().dispose();</span><br />
});</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.atwofer.com/2008/12/10/ie7-tricks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
