<?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>Christoph Schüßler » jQuery is fun! &#187; browser quirks</title>
	<atom:link href="http://herr-schuessler.de/blog/tags/browser-quirks/feed/" rel="self" type="application/rss+xml" />
	<link>http://herr-schuessler.de/blog</link>
	<description>Christoph Schüßler plans, designs and codes websites, creates user experience and simplifies human computer interaction.</description>
	<lastBuildDate>Tue, 27 Apr 2010 17:18:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Don&#8217;t use IE7 compatibility mode when testing JavaScript</title>
		<link>http://herr-schuessler.de/blog/dont-use-ie7-compatibility-mode-when-testing-javascript/</link>
		<comments>http://herr-schuessler.de/blog/dont-use-ie7-compatibility-mode-when-testing-javascript/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 17:17:41 +0000</pubDate>
		<dc:creator>Christoph Schüßler</dc:creator>
				<category><![CDATA[Browser]]></category>
		<category><![CDATA[browser quirks]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Test]]></category>

		<guid isPermaLink="false">http://herr-schuessler.de/blog/?p=319</guid>
		<description><![CDATA[I just learned the hard way that IE8 in IE7 compatibility mode is not the same as Internet Explorer 7. Apparently IE7 compatibility mode uses the IE8 JavaScript engine and you won&#8217;t be able to detect IE7-only JavaScript bugs when testing and developing in compatibility mode. I recommend using IETester, it will throw all the [...]]]></description>
			<content:encoded><![CDATA[<p>I just learned the hard way that IE8 in IE7 compatibility mode is <strong>not the same</strong> as Internet Explorer 7. Apparently IE7 compatibility mode uses the IE8 JavaScript engine and you won&#8217;t be able to detect IE7-only JavaScript bugs when testing and developing in compatibility mode.<br />
<span id="more-319"></span></p>
<p>I recommend using <a href="http://www.my-debugbar.com/wiki/IETester/HomePage">IETester</a>, it will throw all the errors you ever wanted (NOT!) at you. Combine it with <a href="http://getfirebug.com/firebuglite">Firebug Lite</a> and sleep a little better.</p>
]]></content:encoded>
			<wfw:commentRss>http://herr-schuessler.de/blog/dont-use-ie7-compatibility-mode-when-testing-javascript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Overlapping select field bug in IE6 &#8211; solved jQuery-style</title>
		<link>http://herr-schuessler.de/blog/overlapping-select-field-bug-in-ie6-solved-jquery-style/</link>
		<comments>http://herr-schuessler.de/blog/overlapping-select-field-bug-in-ie6-solved-jquery-style/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 08:43:25 +0000</pubDate>
		<dc:creator>Christoph Schüßler</dc:creator>
				<category><![CDATA[Browser]]></category>
		<category><![CDATA[XHTML & CSS]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[browser quirks]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://herr-schuessler.de/blog/?p=282</guid>
		<description><![CDATA[When using drop-down navigation like Son of Suckerfish, which entails placing absolute positioned layers above the content layer, Internet Explorer 6 displays once again really stupid behavior when it comes to HTML forms with the SELECT element. When the drop-down layer hovers above a form, the SELECT still shines through, it stays above it and [...]]]></description>
			<content:encoded><![CDATA[<p>When using drop-down navigation like <a href="http://htmldog.com/articles/suckerfish/dropdowns/">Son of Suckerfish</a>, which entails placing absolute positioned layers above the content layer, Internet Explorer 6 displays once again really stupid behavior when it comes to <code>HTML</code> forms with the <code>SELECT</code> element. When the drop-down layer hovers above a form, the <code>SELECT</code> still shines through, it stays above it and cannot be convinced by <code>z-index</code> or any other CSS trick to go where it belongs.<br />
<span id="more-282"></span></p>
<p>Some solutions have been proposed, among them:</p>
<ul>
<li>hiding the <code>select</code> element on hover</li>
<li>replacing it with an <code>input</code> element on hover</li>
<li>or <a href="http://www.bringdownie6.com/">stop caring about IE6</a> altogether</li>
</ul>
<p>These solutions all include drawbacks in usability or undesired UI changes, which can be confusing for the user. Another work-around, which is quite unnoticeable in the front-end is to <a href="http://www.macridesweb.com/oltest/IframeShim.html">place an invisible, empty <code>IFRAME</code></a> in the layer that will be positioned above the <code>SELECT</code> element.</p>
<p>Here&#8217;s how to do this jQuery-style:</p>
<p><strong>The jQuery-Plugin:</strong></p>
<pre name="code" class="js">
jQuery.fn.activeXOverlap = function() { 

    $(this).each(function(i){
        var h   = $(this).outerHeight();
        var w   = $(this).outerWidth();
        var iframe  = '<!--[if IE 6]>' +
                      '<iframe src="javascript:false;" style="height: ' +
                      h +
                      'px; width: ' +
                      w +
                      'px" class="selectOverlap">' +
                      '</iframe>' +
                      '<![endif]-->'
        $(this).prepend(iframe);
    });
}
</pre>
<p><strong>The Plugin setup:</strong></p>
<pre name="code" class="js">
$(function() {
    $('.myHoverClass').activeXOverlap();
});
</pre>
<p>where <code>.myHoverClass</code> references all elements that should hover above the select.</p>
<p><strong>The required CSS:</strong></p>
<pre name="code" class="css">
<!--[if IE 6]>
iframe.selectOverlap {
    position: absolute;
    z-index: -1;
    filter: mask();
    border: 0;
    margin: 0;
    padding: 0;
    top: 0;
    left: 0;
    overflow: hidden;
    filter: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0);
}
<![endif]-->
</pre>
<p>What this does is placing an <code>Iframe</code> behind every selected element, scaling it to the correct dimensions and hiding it from all browsers but IE6.</p>
]]></content:encoded>
			<wfw:commentRss>http://herr-schuessler.de/blog/overlapping-select-field-bug-in-ie6-solved-jquery-style/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Selecting input-fields with maxlength via jQuery</title>
		<link>http://herr-schuessler.de/blog/selecting-input-fields-with-maxlength-via-jquery/</link>
		<comments>http://herr-schuessler.de/blog/selecting-input-fields-with-maxlength-via-jquery/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 04:37:18 +0000</pubDate>
		<dc:creator>Christoph Schüßler</dc:creator>
				<category><![CDATA[Browser]]></category>
		<category><![CDATA[XHTML & CSS]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[browser quirks]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[maxlength]]></category>
		<category><![CDATA[selector]]></category>

		<guid isPermaLink="false">http://herr-schuessler.de/?p=178</guid>
		<description><![CDATA[524288? 2147483647? -1? No, that&#8217;s not my bank account balance&#8230; Unlike any other attribute, maxlength is implicitly present on any input-element. I had to find this out the hard way trying to select only input-elements with an explicitly set maxlength via the jQuery-selector input[maxlength]. Well, that didn&#8217;t work. input[maxlength] returns all inputs, regardless of whether [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>
524288?<br />
2147483647?<br />
-1?<br />
No, that&#8217;s not my bank account balance&#8230;
</p></blockquote>
<p>Unlike any other attribute, <code>maxlength</code> is implicitly present on any <code>input</code>-element. I had to find this out the hard way trying to select only <code>input</code>-elements with an explicitly set <code>maxlength</code> via the jQuery-selector <code>input[maxlength]</code>.<br />
<span id="more-178"></span></p>
<p>Well, that didn&#8217;t work. <code>input[maxlength]</code> returns all inputs, regardless of whether they have <code>maxlength</code> or not. The only conclusion this leaves us with is that <strong>browsers add a certain maxlength-value implicitly</strong> to any <code>input</code>-field.</p>
<h4>What&#8217;s my browser doing with maxlength?</h4>
<p>That&#8217;s exactly what I asked myself. <a href="http://dev.herr-schuessler.de/examples/maxlength-test/">A quick browser test</a> left me quite surprised, but, hey &ndash; what did I expect &#8211; every browser behaving the same? Not in this world&#8230;</p>
<p>Every browser rendering engine implies a different value. The most reasonable browsers are Firefox (surprised?) and Opera &#8211; they are at least assuming a negative value. The other values <del>seem (at least to me, maybe I&#8217;m just missing some nerdy inside joke) completely arbitrary</del> are natural limits: 2147483647 is the highest possible 32-bit-number (<code>2^32 /2</code> or <code>0111 1111 1111 1111 1111 1111 1111 1111</code>), while 524288 is the same in 16 bit:</p>
<table class="table">
<tr>
<th>Browser</th>
<th>OS</th>
<th>Version</th>
<th>Implicit maxlength-value</th>
</tr>
<tr>
<td>Firefox</td>
<td>Windows</td>
<td>3</td>
<td class="hilite">-1</td>
</tr>
<tr>
<td>Internet Explorer</td>
<td>Windows</td>
<td>7</td>
<td class="hilite">2147483647</td>
</tr>
<tr>
<td>Safari</td>
<td>Windows</td>
<td>3.2</td>
<td class="hilite">524288</td>
</tr>
<tr>
<td>Opera</td>
<td>Windows</td>
<td>9.6</td>
<td class="hilite">-1</td>
</tr>
<tr>
<td>Chrome</td>
<td>Windows</td>
<td>0.4</td>
<td class="hilite">524288</td>
</tr>
</table>
<h4>jQuery to the rescue</h4>
<p>So back to the original problem &#8211; my solution for selecting only <code>input</code>-fields with <code>maxlength</code>-attributes based on these findings is as follows:</p>
<pre name="code" class="js">
var inputs = $('input[maxlength!=-1][maxlength!=524288][maxlength!=2147483647]');
</pre>
<p>Ugly, I know. But it works.</p>
<p><a class="download" href="http://dev.herr-schuessler.de/examples/maxlength-test/">Take the <em>Browser Test</em><br />
and post your result in the comment section!</a></p>
<h4>Why?</h4>
<p>Why would I want to select only this subset of input elements anyway? In my case, it was to <a href="http://www.bradlis7.com/main/jquery-chars-remaining">display the number of total and remaining characters a user could enter</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://herr-schuessler.de/blog/selecting-input-fields-with-maxlength-via-jquery/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
