<?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>DaveOnCode &#187; browser</title>
	<atom:link href="http://www.daveoncode.com/tag/browser/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.daveoncode.com</link>
	<description>coder and technology lover</description>
	<lastBuildDate>Sun, 16 May 2010 16:55:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>&#8220;Not authorized&#8221; error due to Safari &#8220;private browsing&#8221; mode! :P</title>
		<link>http://www.daveoncode.com/2009/12/27/not-authorized-error-due-to-safari-private-browsing-mode/</link>
		<comments>http://www.daveoncode.com/2009/12/27/not-authorized-error-due-to-safari-private-browsing-mode/#comments</comments>
		<pubDate>Sun, 27 Dec 2009 14:26:56 +0000</pubDate>
		<dc:creator>Davide Zanotti</dc:creator>
				<category><![CDATA[browsers]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.daveoncode.com/?p=562</guid>
		<description><![CDATA[This is just a quick post to share my misadventure with Safari and the &#8220;private browsing&#8221; mode. I&#8217;m working on a small JavaScript library which has the goal to abstract SQLite database api and allow users to create table, insert, update and delete records easily&#8230; my code seems to work very well, but this morning]]></description>
			<content:encoded><![CDATA[<p>This is just a quick post to share my misadventure with Safari and the &#8220;private<br />
browsing&#8221; mode. I&#8217;m working on a small JavaScript library which has the goal to abstract  SQLite database api and allow users to create table, insert, update and delete<br />
records easily&#8230; my code seems to work very well, but this morning during some<br />
tests, I got the &#8220;not authorized&#8221; exception (error code n°1)  on every<br />
transaction. After hours of debugging I realized that my code was ok, but I forgot<br />
to disable the &#8220;private browsing&#8221; mode in Safari!<br />
So, bear in mind, if you want to play with database api and other client-related store capabilities (such cookies), remember to disable that option in Safari ;)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.daveoncode.com/2009/12/27/not-authorized-error-due-to-safari-private-browsing-mode/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using getAttribute() to retrieve the label&#8217;s &quot;for&quot; attribute returns NULL on internet explorer!</title>
		<link>http://www.daveoncode.com/2008/12/12/using-getattribute-to-retrieve-the-labels-for-attribute-returns-null-on-internet-explorer/</link>
		<comments>http://www.daveoncode.com/2008/12/12/using-getattribute-to-retrieve-the-labels-for-attribute-returns-null-on-internet-explorer/#comments</comments>
		<pubDate>Fri, 12 Dec 2008 15:40:47 +0000</pubDate>
		<dc:creator>Davide Zanotti</dc:creator>
				<category><![CDATA[browsers]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[browser incopatibility]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[crossbrowser]]></category>
		<category><![CDATA[ie]]></category>
		<category><![CDATA[internet explorer]]></category>

		<guid isPermaLink="false">http://daveoncode.wordpress.com/?p=136</guid>
		<description><![CDATA[Damned Internet Explorer!!! I&#8217;ve just faced another browser issue by using the javascript function getAttribute() in order to retrieve the &#8220;for&#8221; value of a form&#8217;s label, ie: myLabel.getAttribute("for"); (where &#8220;myLabel&#8221; is a reference to a &#60;label&#62; node) The function always returns NULL, even if the &#8220;for&#8221; attribute is manually specified into HTML code, ie: &#60;label]]></description>
			<content:encoded><![CDATA[<p>Damned Internet Explorer!!! I&#8217;ve just faced another browser issue by using the javascript function <em><strong>getAttribute()</strong></em> in order to retrieve the &#8220;for&#8221; value of a form&#8217;s label, ie:</p>
<pre>
myLabel.getAttribute("for");
</pre>
<p>(where &#8220;myLabel&#8221; is a reference to a &lt;label&gt; node)<br />
The function always returns NULL, even if the &#8220;for&#8221; attribute is manually specified into HTML code, ie:</p>
<pre>
&lt;label for="my_field_id"&gt;my label&lt;/label&gt;
</pre>
<p>Fortunately, after a brief search on Google, I&#8217;ve found a post on quirksmode.org, which contains a comment by Tino Zijdel, that show an easy and crossbrowser solution to get the &#8220;for&#8221; attribute (that can be used both to set a value or to get it):</p>
<pre>
myLabel.htmlFor
</pre>
<p>Thank you Tino!</p>
<p>In my search I&#8217;d even discovered that on Internet Explorer <strong><em>getAttribute()</em></strong> is different from other browsers, because it offers an extra argument called &#8220;iFlags&#8221; that is a number that can be 0, 1 or 2 (genial!) and means (I&#8217;m reporting the official microsoft documentation):</p>
<p>0 -&gt; Default. Performs a property search that is not case-sensitive, and returns an interpolated value if the property is found<br />
1 -&gt; Performs a case-sensitive property search. To find a match, the uppercase and lowercase letters in AttributeName  must exactly match those in the attribute name. If the iFlags  parameter for getAttribute is set to 1 and this option is set to 0 (default), the specified property name might not be found.<br />
2 -&gt; Returns the value exactly as it was set in script or in the source document</p>
<p>It would be a better world without Internet Explorer!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.daveoncode.com/2008/12/12/using-getattribute-to-retrieve-the-labels-for-attribute-returns-null-on-internet-explorer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript string concatenation performance on modern browsers: array.join(&quot;&quot;) is now slower!</title>
		<link>http://www.daveoncode.com/2008/12/09/javascript-string-concatenation-performance-on-modern-browsers-arrayjoin-is-now-slower/</link>
		<comments>http://www.daveoncode.com/2008/12/09/javascript-string-concatenation-performance-on-modern-browsers-arrayjoin-is-now-slower/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 15:52:32 +0000</pubDate>
		<dc:creator>Davide Zanotti</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[browser performance]]></category>
		<category><![CDATA[dhtml]]></category>
		<category><![CDATA[javascript buffer]]></category>
		<category><![CDATA[javascript performance]]></category>
		<category><![CDATA[javascript string]]></category>
		<category><![CDATA[join]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[string buffer]]></category>
		<category><![CDATA[string concatenation]]></category>

		<guid isPermaLink="false">http://daveoncode.wordpress.com/?p=107</guid>
		<description><![CDATA[Well&#8230; as many Javascript developers know, a common practice to handle big string concatenation, is to implement a sort of  &#8220;stringBuffer&#8221; by using an array as data container and then convert it to a string by using the method join(). Ie: var buffer = []; var target = document.getElementById("box"); for (var i=0; i&#60;10000; i++) {]]></description>
			<content:encoded><![CDATA[<p>Well&#8230; as many Javascript developers know, a common practice to handle big string concatenation, is to implement a sort of  &#8220;stringBuffer&#8221; by using an array as data container and then convert it to a string by using the method <strong><em>join()</em></strong>.  Ie:</p>
<pre>
var buffer = [];
var target = document.getElementById("box");

for (var i=0; i&lt;10000; i++) {
    buffer .push(['&lt;p id="node_', i, '" id="node_', i, '"&gt;Content ', i, '&lt;/p&gt;'].join(""));
}

target.innerHTML = buffer.join("");
</pre>
<p>This is theoretically the fastest way to manage huge strings and to speed up the building of dynamic content.</p>
<p><span id="more-107"></span></p>
<p>
It&#8217;s been a long time since I used this technique, but today I was doing some tests and I&#8217;ve realized that is not obsolete, but somehow inadequate to some modern browsers (Firefox 3, Opera 9 and Google Chrome), due to the worst performance compared to the old and classic string concatenation technique with the plus (+) operator. In my test I&#8217;ve compared the time required to concatenate a string built in a 10.000 steps loop with the time required to filling an array, and the amazing result is that, except for internet explorer (for the which buffer technique improve a lot the browser performance) and safari 3, other browser run faster with normal string concatenation with +&#8230; even 70/80% faster!<br />
The results are the following:</p>
<p>- String concatenation with +:</p>
<ul>
<li>17000 milliseconds on Internet Explorer 6</li>
<li>17000 milliseconds on Internet Explorer 7</li>
<li>265 milliseconds on Opera 9</li>
<li>125 milliseconds on Firefox 3</li>
<li>165 milliseconds on Safari 3</li>
<li>50 milliseconds on Google Chrome</li>
</ul>
<p>- Array based technique:</p>
<ul>
<li><span style="color:#008000;">530 milliseconds on Internet Explorer 6 -&gt; -16470 milliseconds (damned good!)</span></li>
<li><span style="color:#008000;">470 milliseconds on Internet Explorer 7 -&gt; -16530 milliseconds (damned good!)</span></li>
<li> <span style="color:#ff0000;">450 milliseconds on Opera 9 -&gt; +185  milliseconds (very bad!)<br />
</span></li>
<li><span style="color:#ff0000;"> 200 milliseconds on Firefox 3 -&gt; +75 milliseconds (bad!)</span></li>
<li><span style="color:#ff0000;"><span style="color:#008000;">145 milliseconds on Safari 3 -&gt; -20 milliseconds (good)</span><br />
</span></li>
<li><span style="color:#ff0000;">95 milliseconds on Google Chrome -&gt; +45 milliseconds (bad)</span></li>
</ul>
<p>In conclusion:  if we want to get the best performances from Firefox, Opera and Chrome we have to avoid the array based technique (and use &#8220;+&#8221; operator instead),  however this technique is still valid if we don&#8217;t want to import a browser specific javascript file or branch the code from one browser to another, because it enhance meaningfully the code execution speed of Internet Explorer and decrease in an acceptable manner the execution on other browsers.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.daveoncode.com/2008/12/09/javascript-string-concatenation-performance-on-modern-browsers-arrayjoin-is-now-slower/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS tip: if you can&#8217;t remove the evil, you can imprison it!</title>
		<link>http://www.daveoncode.com/2008/11/21/css-tip-if-you-cant-remove-the-evil-you-can-imprison-it/</link>
		<comments>http://www.daveoncode.com/2008/11/21/css-tip-if-you-cant-remove-the-evil-you-can-imprison-it/#comments</comments>
		<pubDate>Fri, 21 Nov 2008 15:13:59 +0000</pubDate>
		<dc:creator>Davide Zanotti</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[browser incopatibility]]></category>
		<category><![CDATA[ie6]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquery plugin]]></category>
		<category><![CDATA[positioning]]></category>

		<guid isPermaLink="false">http://daveoncode.wordpress.com/?p=57</guid>
		<description><![CDATA[Yesterday a colleague asked me to help her in debugging a crazy behavior of internet explorer 6 (all the others browsers worked fine!), which caused the wrong display of the boxes inside the page. The bug was caused by the rendering of a jQuery powered div, ie one of those things like: $("#myDivID").doMagic({...}); In somehow]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-60" style="margin: 0pt 10px 10px 0pt;" title="prison" src="http://www.daveoncode.com/wp-content/uploads/2008/11/prison1.gif" alt="prison" />Yesterday a colleague asked me to help her in debugging a crazy behavior of internet explorer 6 (all the others browsers worked fine!), which caused the wrong display of the boxes inside the page. The bug was caused by the rendering of a jQuery powered div, ie one of those things like:</p>
<pre>$("#myDivID").doMagic({...});</pre>
<p>In somehow the jQuery&#8217;s function used, annoyed ie6 due to the CSS styles that it applied to the div. After a couple of minutes of debugging, I realized that we should have needed to spend a full day or more to fix the problem at the root (due to the complexity of the page content). So I decided to isolate the problem by using the CSS positioning technique. Fundamentally <span class="__mozilla-findbar-search" style="background-color:yellow;color:black;display:inline;font-size:inherit;padding:0;">I</span> put the div (&#8220;#myDivID&#8221;) into another div with relative position and set the first with an absolute position, in this way:</p>
<pre>&lt;div style="position: relative; width: Npx; height: Npx;"&gt;
    &lt;div id="myDivID" style="position: absolute; top: 0; left: 0;"&gt;&lt;/div&gt;
&lt;/div&gt;</pre>
<p>With this expedient &#8220;myDivID&#8221; is now &#8220;trapped&#8221; into the parent div and it can&#8217;t influence the others page elements.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.daveoncode.com/2008/11/21/css-tip-if-you-cant-remove-the-evil-you-can-imprison-it/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
