PDA

View Full Version : DomHelper.insertHtml and IE tables



af040
11 Jun 2007, 12:39 PM
I noticed the nasty IE workaround for inserting html into tables (as found in DomHelper) only inserts a single node, though the passed html string may include more. I have tried the following code change in DomHelper, and it seems to work well for me in IE6 and 7.

The last lines of insertIntoTable are changed from:


el.insertBefore(node, before);
return node;

to


var next = node.nextSibling;
el.insertBefore(node, before);
while (next) {
node = next;
next = node.nextSibling;
el.insertBefore(node, before);
}
return node;

I am not sure that you would call this a bug, but perhaps it is an improvement?

kpandey
15 Aug 2007, 2:54 PM
Thanks a bunch. this came in very handy for me. Extjs folks should I file a bug for this to be incorporated into the library? I'm using the Ext 1.1 release and it still has the bug

jack.slocum
15 Aug 2007, 6:07 PM
All DomHelper inserts insert a single node, or a single node with multiple children. Although passing in a string can technically insert multiple nodes, it is not supported. It could also result in other unexpected problems.