If the question is about a DOM tree built from an HTML document that conforms to the HTML specifications, then the answer will be td and th , as explained in paxdiablos answer.
But you can change the DOM tree as you like in scripts. For example:
<!doctype html> <table border> <tr><td>foo <td>bar </table> <script> var p = document.createElement('div'); p.innerHTML = 'Hello world!'; document.getElementsByTagName('tr')[0].appendChild(p); </script>
This will make the div element a child of the tr element. You can even create multiple td elements and make them children of the div element.
Whether this makes sense and whether it can confuse browsers is another problem. And browsers will not parse ordinary HTML markup, where, for example, the tr element contains a div element as a child element - parsers are not ready to handle such cases. Grouping td elements (in any other way than creating their child tr elements) is not possible with HTML markup. But in the DOM, you can create odd trees.
If you want to deal with some td elements in a special way, give them a class .
Jukka K. Korpela
source share