Why do i get a [Text Object] instead of the expected TR object with previousSibling in javascript?
<p>So if I have HTML code like this:</p>

<pre><code>&lt;HTML&gt;
  &lt;HEAD&gt;
    &lt;TITLE&gt;This is a test&lt;/TITLE&gt;
  &lt;/HEAD&gt;
  &lt;BODY&gt;
    &lt;TABLE&gt;
      &lt;TR&gt;
        &lt;TD&gt;First Cell&lt;/TD&gt;
      &lt;/TR&gt;
      &lt;TR&gt;
        &lt;TD&gt;Second Cell&lt;/TD&gt;
        &lt;TD&gt;&lt;A href="#" onclick="alert(this.parentNode.parentNode.previousSibling.childNodes[0].innerHTML); return false;"&gt;Click Here&lt;/A&gt;&lt;/TD&gt;
      &lt;/TR&gt;
    &lt;/TABLE&gt;
  &lt;/BODY&gt;
&lt;/HTML&gt;
</code></pre>

<p>This works for Internet explorer, but not for Firefox and probably more browsers out there. Apparently Firefox interprets the whitespace between the TR's(indentation) as the previousSibling of the parent TR of 'this' in my code above. So instead of getting the desired TR object it gives me a [Text Object].</p>

<p>So my question now is, why doesn't Firefox ignore the whitespace between TR's like Internet Explorer does. I know I can use previousElementSibling to circumvent this, but i want to know why Firefox does this and if there is a logical explanation or a use for it. I've tried looking it up on the internet but to no avail. So if someone could tell me or give me a link where I can find this information, I would appreciate it!</p>
