> Really? I'm asking because I didn't actually test that and it > surprisese me. If the TABLE contains a TR then a TBODY must be created > implicitly. According to DOM spec.
Yap, that's what the tests suggest. What's interesting is that though some browsers allow setting the innerHTML of a table without a TBODY and don't auto-create it they *may* still auto create it if creating an entire table without a TBODY via innerHTML. > "insertRow modified in DOM Level 2 > Insert a new empty row in the table. The new row is inserted > immediately before and in the same section as the current indexth row > in the table. If index is -1 or 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. " To add some confusion W3C doc example of TR usage show it without a TBODY http://www.w3.org/TR/html4/struct/tables.html#edef-TR However it was clarified a bit more in HTML5 draft: http://www.w3.org/TR/html5/tabular-data.html#the-tr-element (May be used as a child of a table element) Also the table processing model doesn't mention auto creation of TBODY elements, it just allows TR's to be children of TABLE elements. http://www.w3.org/TR/html5/tabular-data.html#processing-model-0 For additional reading, HTML5 has specs for `innerHTML` parsing: http://www.w3.org/TR/2008/WD-html5-20080610/serializing.html#html-fragment - JDD -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
