Closed
Bug 30420
Opened 25 years ago
Closed 21 years ago
createTHead / createTFoot should create a TBODY
Categories
(Core :: DOM: Core & HTML, enhancement, P3)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
INVALID
Future
People
(Reporter: taras.tielkes, Assigned: vidur)
Details
(Keywords: dom1)
Attachments
(1 file)
1.60 KB,
text/html
|
Details |
(Note aside: I would say that creating a "TABLE" element should create a TBODY
child, but I think I'm wrong in that)
When creating a table from the DOM interfaces, the creation of a THeader or
TFooter should trigger the creation of a TBODY element, unless one is already
present.(This is the current behaviour of insertRow() using M14 or IE5).
IE5 will create a tbody at the moment that I add a header or footer through the
Dom1. I think this is good.
The DOM1 spec doesn't say this is what should happen. But perhaps the spec
should be clarified.
Marking confirmed, although the bug may well be invalid. I'd rather let
somebody else decide.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Reporter | ||
Comment 2•25 years ago
|
||
From html40:
"The TBODY start tag is always required except when the table contains only one
table body and no table head or foot sections." (this is because user agent
needs to know what's THEAD and what's TBODY - if there is a tbody, that is)
When I build a table using the DOM1, it's reasonable that, if the first thing
that I add to the table is a header(thead) or footer(tfoot), an implicit TBODY
is created.
Both THeadElement and TFootElement have specific methods to add table cells.
(HTMLTableSectionElement::insertRow()) It would be nice if I could just use
HTMLTableElement::insertRow(), and the added rows would automatically end up
between header and footer.
Right now, it seems I have to
1 create header & footer
2 create a tbody
3 and then add cells through oTable.tBodies[0].insertRow()
(in that specific sequence)
Reporter | ||
Comment 3•25 years ago
|
||
After thinking about it I am getting more and more confused ;-)
To keep as close a possible to the spirit of DOM2:
"HTMLTableElement::insertRow
Insert a new empty row in the table. The new row is inserted immediately before
and in the same section as the current (index)th row in the table. If index is
equal to the number of rows, the new row is appended. In addition, when the
table is empty the row is inserted into a TBODY which is created and inserted
into the table."
Now, in practice, you will want to add THEAD, TFOOT and TBODY in any sequence
you see fit, and expect them to end up in the right place. Also, IMO, TFOOT and
THEAD elements should stay in the right place no matter how many rows I add via
HTMLTableElement::insertRow().
Ok, now the PROBLEM:
When I do:
1 table.insertRow(..) (and fill 10x10 body)
2 table.createTHead() (and fill thead cells)
3 table.createTFoot() (and fill tfoot cells)
everything is OK.
But when I try this:
1 table.createTHead() (and fill thead cells)
2 table.createTFoot() (and fill tfoot cells)
3 table.insertRow(..) (and fill 10x10 body)
Then header & footer end up beneath the cells.
I don't know for sure what's right and wrong here, bug the DOM1 is unclear.
Perhaps Vidur(or someone else familiar with DOM1/2) could post a "TBodies for
dummies" in the dom newsgroup?
Reporter | ||
Comment 4•25 years ago
|
||
Reporter | ||
Comment 5•25 years ago
|
||
The attachment I included illustrates the problem mentioned in previous
comment. Swap the table build blocks like I outlined to get the described
behaviour.
Hope the attachment will save somebody a couple of hours of experimentation ;-)
(N.B.: Manually creating and adding tbodies can lead to multiple TBODY elements
in Ie5.)
Comment 6•25 years ago
|
||
Taras: many thanks for your careful analysis! If I understand you correctly, it
is possible to find a usable sequence of commands that will create any valid
TABLE, right? (Even if it requires some knowledge of how to get the sequence
right.) If so, then this bug is a relatively lower priority.
It would be a serious problem if there were valid TABLEs that couldn't be
created using JS.
I don't think it's necessary for the JavaScript developer to be able to create
and insert table HEADs, FOOTERs, and ROWs in *any* order and for Mozilla to have
to be smart enough to straighten out the order on its own. (It would be nice,
but that's basically an enhancement request.) I'm comfortable for FCS with
requiring that the TABLE elements be inserted in an order that, as-is, creates
a valid TABLE.
Reporter | ||
Comment 7•25 years ago
|
||
ekrock@netscape.com, I agree.
The behaviour I described is .. acceptable. I will file other enhancement
requests in separate bugs.
Assignee | ||
Comment 8•25 years ago
|
||
This is embarrassing and, at the very least, is something that should be tech
noted. Given where we are, though, I'll go along with Eric Krock's
recommendation that we future this one.
Target Milestone: --- → Future
Updated•25 years ago
|
Component: DOM Level 1 → DOM HTML
Updated•24 years ago
|
Target Milestone: Future → mozilla1.0
Comment 12•24 years ago
|
||
Bugs targeted at mozilla1.0 without the mozilla1.0 keyword moved to mozilla1.0.1
(you can query for this string to delete spam or retrieve the list of bugs I've
moved)
Target Milestone: mozilla1.0 → mozilla1.0.1
![]() |
||
Comment 14•21 years ago
|
||
Um... comment 3 even quotes the relevant part of the DOM spec and this bug is
_still_ open?
If you create the thead and tfoot first, then when you insertRow() at index 0 it
is "inserted immediately before and in the same section as the current (index)th
row in the table". Which means inserted in the thead. What's not clear about that?
So what we're doing is exactly correct and doing anything else would be a
violation of the DOM2 HTML specification.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → INVALID
Component: DOM: HTML → DOM: Core & HTML
QA Contact: stummala → general
You need to log in
before you can comment on or make changes to this bug.
Description
•