V
VK
The W3C DOM 2 HTML makes no statement that createElement and appendChild
Besides method descriptions, there is the concept of DOM itself, where we
have a strict hierarchy of objects / elements from the top to the bottom
(and visa versa). It was the whole idea to start all this mess in the first
place.
IMHO it is hardly DOM-compliant to use the statement
document.createElement() as some kind of stay-alone universal object
factory. And it becomes recently a common practice even on official sample
code pages.
document.createElement(table) - fine by me: "add to the document structure
element Table"
document.createElement(tbody,...tr,td,...) - oops: "add to the document
structure element tBody..."
Sorry, but there is not such element in the document structure. It is an
object of the table object.
It should be either TOM, or:
var t = document.createElement(table);
var b = t.createElement(tbody);
....
If it doesn't work this way, so it was not intended to work this way, so
TOM.
cannot be used to add a new table row to a table.
The text "The create* and delete* methods on the table allow authors
to construct and modify tables." is not excluding other ways to create
and add rowgroups, rows or cells.
Besides method descriptions, there is the concept of DOM itself, where we
have a strict hierarchy of objects / elements from the top to the bottom
(and visa versa). It was the whole idea to start all this mess in the first
place.
IMHO it is hardly DOM-compliant to use the statement
document.createElement() as some kind of stay-alone universal object
factory. And it becomes recently a common practice even on official sample
code pages.
document.createElement(table) - fine by me: "add to the document structure
element Table"
document.createElement(tbody,...tr,td,...) - oops: "add to the document
structure element tBody..."
Sorry, but there is not such element in the document structure. It is an
object of the table object.
It should be either TOM, or:
var t = document.createElement(table);
var b = t.createElement(tbody);
....
If it doesn't work this way, so it was not intended to work this way, so
TOM.