Closed Bug 324195 Opened 19 years ago Closed 19 years ago

Incorrect tbody.childNode.length count reported when "newline" added after tag

Categories

(Firefox :: General, defect)

1.5.0.x Branch
x86
Windows 2000
defect
Not set
minor

Tracking

()

VERIFIED DUPLICATE of bug 26179

People

(Reporter: lmbrtgrg, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-GB; rv:1.8) Gecko/20051111 Firefox/1.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-GB; rv:1.8) Gecko/20051111 Firefox/1.5

tbody.childNode.length will report correct length if all elements are contiguous without a newline. viz:
<tbody></tbody>
reports 0 (zero) childNode elements.
<tbody>
</tbody>
or
<tbody />
reports 1 (one) childNode element
If rows are strung as <tbody><tr></tr><tr></tr><tr></tr></tbody>
then tbody.childNodes.length returns a value of 3.
If the source is written as 
<tbody>
<tr></tr>
<tr></tr>
<tr></tr>
</tbody>

then tbody.childNodes.length returns a value of 7 (notice the extra line after the closing tbody tag.

I cannot find a reference to this behaviour elsewhere.

Reproducible: Always

Steps to Reproduce:
1.Create HTML (See additional information)
2.Use JavaScript to detect and report the childNode length 
3.

Actual Results:  
Javascript will always report a childNodes.length of 7, one for each <TR> tag and seemingly one for each newline.



Expected Results:  
childNode.length should be 3.

This error was discovered in Firefox 1.0.7, and continues into Firefox 1.5, on both Windows 2k and Linux.

XHTML is very simple:-

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
</head>
<body>
<div>
<table>
<tbody id="tbody">
<tr></tr>
<tr></tr>
<tr></tr>
</tbody>
</table>
</div>
</body>
</html>
See http://mozilla.org/docs/dom/technote/whitespace/

*** This bug has been marked as a duplicate of 26179 ***
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
So as I understand it:
- White space is treated as a child of <tbody> even when <tbody> is expected to have only <tr> as a child.
- Resolved does not mean fixed.
I have difficulty in trying to understand if this is a bug that you believe is fixed in an earlier release, and yet is clearly manifest in 1.5.
Please confirm.
Status: RESOLVED → UNCONFIRMED
Resolution: DUPLICATE → ---
Version: unspecified → 1.5 Branch
This bug, as filed, is a duplicate of bug 26179. That bug is invalid.

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