Creating a table header/footer prevents display of first tbody row

VERIFIED FIXED in M18

Status

()

Core
DOM
P2
normal
VERIFIED FIXED
19 years ago
17 years ago

People

(Reporter: Taras Tielkes, Assigned: karnaze (gone))

Tracking

({testcase})

Trunk
testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [nsbeta3+])

Attachments

(1 attachment)

(Reporter)

Description

19 years ago
(This one is probably related to 26178, but the code is Dom1 javascript only)
Building a table through DOM1:
-------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN style 
http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<script>
window.onload = createTable;

function createTable()
{
	var oTable = document.createElement("table");
	document.body.appendChild(oTable);
	oTable.appendChild(document.createElement("tbody"));
	
	/* // THead creation block
	var oTHead = oTable.createTHead();
	var oRow = oTHead.insertRow(0); 
	for(col=0;col<8;col++)
	{
		var oCell = oRow.insertCell(col);
		var cellValue = document.createTextNode("h" + col);
		oCell.appendChild(cellValue);
	}
	*/
	
	/* // TFoot creation block
	var oTFoot = oTable.createTFoot();
	var oRow = oTFoot.insertRow(0); // create table footer row
	for(col=0;col<8;col++)
	{
		var oCell = oRow.insertCell(col);
		var cellValue = document.createTextNode("f" + col);
		oCell.appendChild(cellValue);
	} */
	
	for(row=0;row<1;row++) // ask for just 1 row
	{
		var oRow = oTable.tBodies[0].insertRow(row);
		for(col=0;col<8;col++)
		{
			var oCell = oRow.insertCell(col);			
			var newValue2 = document.createTextNode("r" + row + "c" 
+ col);
			oCell.appendChild(newValue2);
		}
	}	
		
	oTable.border = 4;
		
	var str = "";
	str += ".rows.length: " + oTable.rows.length + "\n";
	//str += ".tHead.rows.length: " + oTable.tHead.rows.length + "\n";
	//str += ".tFoot.rows.length: " + oTable.tFoot.rows.length + "\n";
	str += ".tBodies.length: " + oTable.tBodies.length + "\n";
	str += ".tBodies[0].rows.length: " + oTable.tBodies[0].rows.length 
+ "\n";
	
	//alert(str);
}
</script>
</head>
<body>
</body>
</html>
-------------------------------------------------------------------
Above script will make one table row.
Uncommend the tfoot and/or thead creation block and the added tbody row will 
disappear. Adding 2 tbody rows will show only 1, et cetera.
(Reporter)

Comment 1

19 years ago
The table row *is* created, as the alert() at the end of the script will show. 
Adding a thead, tfoot, and 1 tbody row will give a result of "3" when looking 
in "oTable.tBodies[0].rows.length".

Moving the "document.body.appendChild(oTable);" statement to the end of the 
script block (e.g. to the place of the commented-out "alert") will fix the 
display problems. Hope this helps track the problem a bit.

Updated

19 years ago
QA Contact: gerardok → janc
t.r.tiekes@zap.a2000.nl - is this still not working in recent Mozilla builds?

Gerv
(Reporter)

Comment 3

18 years ago
Doesn't work in Netscape 6 beta 1.(WinNT)
Doesn't work in today's build. (WinNT)

All other bugs that are displayed by the included sample still show (first 
column is drawn last et cetera)

Updated

18 years ago
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Since Vidur is on sabbatical I'm taking this one...
Assignee: vidur → jst
Status: ASSIGNED → NEW
Accepting bug, aiming for M17.
Status: NEW → ASSIGNED
OS: Windows NT → All
Hardware: PC → All
Target Milestone: --- → M17
spam: adding keyword.

Gerv
Keywords: testcase
(Reporter)

Comment 8

18 years ago
Johnny Stenback, there is a way to modify the (JavaScript) code that will show 
the header/footer.

Basically, if I stay away from manualy creating a TBODY, but insert rows 
directly into the table, things work.
The other requirement for this to work is that the table rows insertion takes 
place *before* the THEAD/TFOOT insertion. The testcase I'm talking about is 
attached to this bug:

http://bugzilla.mozilla.org/show_bug.cgi?id=30420

Perhaps comparing the code paths and tracing the two different testcases can 
help you find the bug. If you need more testcases or other assistance, just 
yell.
Nominating for nsbeta3, I think I even had a partial fix for this waaaay back,
can't seem to find it right now tho.
Keywords: nsbeta3
Priority: P3 → P2
Target Milestone: M17 → M18
correctness of DOM1 implementation. Important to be able to generate tables
programmatically through DOM1.
Keywords: correctness

Comment 11

18 years ago
This bug has been marked "future" because the original netscape engineer working 
on this is over-burdened. If you feel this is an error, that you or another
known resource will be working on this bug,or if it blocks your work in some way 
-- please attach your concern to the bug for reconsideration, but do not clear 
the nsbeta3- nomination.
Keywords: relnote3
Whiteboard: [nsbeta3-]
Target Milestone: M18 → Future

Comment 12

18 years ago
Inserting the tbody *before* the thead insertion works.  However, the width of
the table cells does not reflow which is should if a cell in the head row is
wider than any cells in that row.  I know this can be set with css, but it would
be nice if it is not going to be fixed to at least have the table reflow after
adding a thead last to reflect wider headings if necessary.
Reassigning and removing Future milestone and nsbeta3-, karnaze, please look
into the reflow problem and target this bug appropriately. Feel free to give
this back to me once the reflow problem is dealt with. Thanks!
Assignee: jst → karnaze
Status: ASSIGNED → NEW
Whiteboard: [nsbeta3-]
Target Milestone: Future → ---

Comment 14

18 years ago
Approving for beta3
Whiteboard: [nsbeta3+]

Updated

18 years ago
Blocks: 47252

Updated

18 years ago
Target Milestone: --- → M18

Comment 15

18 years ago
PDT reviewing P2 bugs, but we can't make a judgement on the severity/criticality
of this bug. Chris or Vidur, could you make a comment?
(Assignee)

Comment 16

18 years ago
Fixed.
Status: NEW → RESOLVED
Last Resolved: 18 years ago
Resolution: --- → FIXED

Comment 17

18 years ago
Verified:
2000-09-28-09-MN6 : Windows
2000-09-26-04-M18 : Mac
2000-09-28-10-MN6 : Linux
 
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.