On Wed, 21 Jan 2004 14:39:48 -0500, Brian Genisio <Br**********@yahoo.com>
wrote:
Michael Winter wrote:
<snip>
var tableRow = document.getElementById( 'rowID' );
// The first parent node points to the TBODY that contains the row.
// Even if one wasn't explicitly added, a TBODY element will be
// added implicitly
var table = tableRow.parentNode.parentNode;
Hmmmm... Is this a safe assumption? Do all DOM-compliant browsers do it
this way? What if it does not implicityly add a TBODY? I think a more
save approach is to traverse upwards, until you find the TABLE tag...
(like I mentioned in my earlier post)
What do you think?
Technically, yes. The DTD description of the table requires that at least
one TBODY element must be present inside a table. If there is only one
body, the user may omit the actual tag, but the TBODY is still there.
However, I guess there aren't really any guarantees.
You wouldn't need to traverse far, anyway. The table node will either be
the first parent node, if TBODY is omitted, or the second, if it isn't.
Mike
--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)