<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>The place João Bordalo calls home: Tag javascript</title>
    <link>http://www.joaobordalo.com/articles_controller.rb/tag?tag=javascript</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Simplicity, Usability, Productivity, Code, Design, Business and more</description>
    <item>
      <title>Loupe.js</title>
      <description>&lt;p&gt;Christian Effenberger developed &lt;a href="http://www.netzgesta.de/loupe/"&gt;Loupe.js&lt;/a&gt;, which allows you to add a magnifier to an object on your page. To use it, all you have to do is to download a Javascript file and a small PNG image, and insert the following line of code in the place you want to have the magnifier:&lt;/p&gt;

&lt;pre&gt;
&amp;lt;div&amp;gt;
&amp;lt;img id="..." onLoad="initLoupe(this.id);" ...&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/pre&gt;

&lt;p&gt;The result is something like this (click &lt;a href="http://www.netzgesta.de/loupe/"&gt;here&lt;/a&gt; to see it working):&lt;/p&gt;

&lt;p&gt;&lt;a href="http://joaobordalo.com/files/loupe.jpg"&gt;&lt;img src="http://joaobordalo.com/files/loupe.jpg" width=464 height=292&gt;&lt;/a&gt;&lt;/p&gt;
</description>
      <pubDate>Fri, 04 May 2007 07:28:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:334a0ca5-c809-4d85-b08e-227b22f3da5c</guid>
      <author>bordalix</author>
      <link>http://www.joaobordalo.com/articles/2007/05/04/loupe-js</link>
      <category>javascript</category>
    </item>
    <item>
      <title>lastChild in Mozilla browsers</title>
      <description>&lt;p&gt;For a while now I've been receiving some complaints about the comments in this blog: people using Mozilla based browsers weren't able to see the BlindDown effect when posting comments, and since they did not receive any other message about the comment being correctly posted, they posted it several times.&lt;/p&gt;

&lt;p&gt;The error message received was this:&lt;/p&gt;

&lt;pre&gt;
$(element).style has no properties
[Break on this error] $(element).style.height = '0px';
effects.js (line 369)
&lt;/pre&gt;

&lt;p&gt;After some heavy Javascript debugging, I found out the bug: Mozilla browsers add nodes for white space (in my case, in between LI elements), so it was calling the wrong node for the BlindDown effect (it was calling a white space). Here goes the original code:&lt;/p&gt;

&lt;pre&gt;
function commentAdded(request) {
  new Effect.BlindDown($('commentList').lastChild);
  $('commentform').elements[3].value = '';
  $('commentform').elements[3].focus();
}&lt;/pre&gt;

&lt;p&gt;The solution was to add a new javascript line &lt;b&gt;before&lt;/b&gt; the Effect.BlindDown call, cleaning all white spaces. Here is the corrected code:&lt;/p&gt;

&lt;pre&gt;
function commentAdded(request) {
  Element.cleanWhitespace('commentList');
  new Effect.BlindDown($('commentList').lastChild);
  $('commentform').elements[3].value = '';
  $('commentform').elements[3].focus();
}&lt;/pre&gt;

&lt;p&gt;So, the lesson is: every time you use a lastChild call, be aware of the white spaces for the Mozilla browsers. Hope it helps, thanks to all who pointed the bug.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Update:&lt;/b&gt; after a lunch conversation, I've decided to post the bug in the Mozilla foundation bugzilla. If you want to, you can check the status by accessing &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=378593"&gt;bug #378593&lt;/a&gt;.&lt;/p&gt;
</description>
      <pubDate>Tue, 24 Apr 2007 07:13:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:374a062f-618f-443f-b7fb-2da7de0b5262</guid>
      <author>bordalix</author>
      <link>http://www.joaobordalo.com/articles/2007/04/24/lastchild-in-mozilla-browsers</link>
      <category>javascript</category>
    </item>
  </channel>
</rss>

