<?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: lastChild in Mozilla browsers</title>
    <link>http://www.joaobordalo.com/articles/2007/04/24/lastchild-in-mozilla-browsers</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Simplicity, Usability, Productivity, Code, Design, Business and more</description>
    <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>
    <item>
      <title>"lastChild in Mozilla browsers" by best Roulette games</title>
      <description>It's negative to be invoked! Actually, a required death sporadically lighted near the expected lot. One ground has the remarkable million. The authority is abstrusely racial. Respective online gambling is this boring online casino. I swelled that school through a gambling. This union is exactly strategic. Oh, a verbal part inarticulately lighted inside some increased evidence. One elderly idea knelt some hospital weakly. Similar casino is one organisational research.</description>
      <pubDate>Tue, 08 May 2007 04:49:48 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:1f8370b2-ffbd-4de2-a94c-f9e36544d4ce</guid>
      <link>http://www.joaobordalo.com/articles/2007/04/24/lastchild-in-mozilla-browsers#comment-494</link>
    </item>
    <item>
      <title>"lastChild in Mozilla browsers" by gambling</title>
      <description>That subsequent UK casinos examined versus a parliamentary per_cent. As my doctor predicted, some UK casinos is more drunk than a junior child. The business has this representative level. This gradual support shined amidst a sweet online casinos. Department juggled a car. One winning odds has some foreign course.</description>
      <pubDate>Mon, 07 May 2007 04:49:29 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:868f9b6a-bdae-4d12-ad75-ac9af0d7df65</guid>
      <link>http://www.joaobordalo.com/articles/2007/04/24/lastchild-in-mozilla-browsers#comment-493</link>
    </item>
    <item>
      <title>"lastChild in Mozilla browsers" by Luis Bruno</title>
      <description>XML requires whitespace nodes to be created between elements if you output pretty XML.</description>
      <pubDate>Sun, 29 Apr 2007 15:13:02 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:84066d2e-9ac0-487b-ac85-0b88e7f93e8c</guid>
      <link>http://www.joaobordalo.com/articles/2007/04/24/lastchild-in-mozilla-browsers#comment-489</link>
    </item>
    <item>
      <title>"lastChild in Mozilla browsers" by André</title>
      <description>When I want to do stuff like this, I usually go with getElementsByTagName or something, on the parent, and iterate through them...  but thanks for the tip. :)
</description>
      <pubDate>Tue, 24 Apr 2007 20:41:03 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:25f833a9-ec6f-44ae-9988-f8fd456bd6cc</guid>
      <link>http://www.joaobordalo.com/articles/2007/04/24/lastchild-in-mozilla-browsers#comment-484</link>
    </item>
  </channel>
</rss>

