Closed Bug 329019 Opened 18 years ago Closed 18 years ago

ChildNodes returns all sub elements

Categories

(Toolkit Graveyard :: Error Console, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 26179

People

(Reporter: jerome, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7

Try:
<HTML><BODY>
<table>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<script id="myTable">
alert(document.getElementById('myTable').parentNode.childNodes.length);
</script>
</table>
</BODY></HTML>
IE and Opera will return 5... Mozilla includes the <TD> tags as children of <TABLE> even if they are encased in <TR> tags

Reproducible: Always

Steps to Reproduce:
<HTML><BODY>
<table>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<script id="myTable">
alert(document.getElementById('myTable').parentNode.childNodes.length);
</script>
</table>
</BODY></HTML>

Actual Results:  
alerts 9 child nodes

Expected Results:  
should alert 5 child nodes
The alert keeps saying 9 when I remove 1, 2, 3 or 4 <td> tags from the code, it says 5 when I write <tr><td>...</tr><script id="myTable"> as one continuous line -> duplicate of/related to Core bug 26179? (Mozilla 1.8b1 and Firefox 1.5.0.1)
zug_treno: why don't you just resolve the bug? You're right, length is 9 because mozilla also counts the whitespace text nodes.

*** This bug has been marked as a duplicate of 26179 ***
Status: UNCONFIRMED → RESOLVED
Closed: 18 years ago
Resolution: --- → DUPLICATE
Product: Firefox → Toolkit
Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.