HighDots Forums  

Re: Internet Explorer insertRow/insertCell failure

Javascript JavaScript language (comp.lang.javascript)


Discuss Re: Internet Explorer insertRow/insertCell failure in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
RobG
 
Posts: n/a

Default Re: Internet Explorer insertRow/insertCell failure - 11-04-2005 , 07:34 PM






Howard Jess wrote:
Quote:
CLJ --

I've searched the newsgroup and FAQ for info on insertRow(), but
didn't see this reported.

It seems that Internet Explorer doesn't respond correctly to either
insertRow() or insertCell(), if the object that calls this method isn't
already within a table. That is:

row = tbody.insertRow(0); // fails if tbody's parent is null
cell = row.insertCell(0); // fails if row's parent or grandparent is null

By "fail", I mean the method returns null. As I understand the DOM spec,
this behavior is wrong. Am I missing something? Mozilla, Opera, and
Safari work as expected.
Perhaps not strictly 'wrong', but certainly 'not as expected'. The logic
might be that a tbody must belong to a table, and a row to a tbody and a
table. But that seems like making excuses: when building elements
dynamically they must exist for some (short) time with invalid
structures - rows will not have cells when they are created, nor tbodys
rows, etc.


The Microsoft documentation says:

"If you insert a row in a tFoot, tBody, or tHead, you also need to
add the row to the rows collection for the table. If you insert a
row in the table, you also need to add the row to the rows collection
for the tBody."

<URL:http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/insertrow.asp>


Confusing (their code example is not worth quoting)?

Just another IE quirk?


[...]

--
Rob


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.