PDA

View Full Version : [CLOSED][2.x, 3.x] appendChild/createChild not working in IE due to innerHTML issues



Artur Bodera (Joust)
30 Apr 2009, 6:05 AM
Since Ext 1.1.1 the Ext.DomHelper.useDom=true has been dumped (?). Nothing in the source code for Ext Core either.

Problem is, the following will not work in IE6/IE7:


Ext.get('mySelectElement').createChild({
tag:'option',
value:'some value',
html:'New option for select'
});
Same goes for insertBefore, append, insertHtml, overwrite and other methods. That is because IE has a bug with several form elements and innerHTML, which DomHelper heavily relies on!


This is confirmed by Microsoft: http://support.microsoft.com/kb/276228 (http://support.microsoft.com/kb/276228)
There is a discusion about innerHTML and useDom in ext 1.1.1: http://www.extjs.com/forum/showthread.php?t=13409&highlight=innerHTML+select+explorer
Here is a solution: http://domscripting.com/blog/display/99


Implementation in ext would be fairly simple - use the following workaround when Ext.isIE7 || Ext.isE6 (haven't tested under IE8 yet) and el.parent('form')



With best regards.

Artur Bodera

syscobra
30 Apr 2009, 10:09 AM
Hey there

See this thread

http://www.extjs.com/forum/showthread.php?t=66746

there i made an small fix and others too, and explain's why Ext doesn't support the IE option way of creating child's (Ext can't do everything Micro$oft does outside the standars)

Hope that helps you

Artur Bodera (Joust)
30 Apr 2009, 11:29 AM
I know the workaround, but there is number of "normalization" already in ext for ie. If the bug is still in IE8 I think the innerHTML workaround should be considered (after benchmarking of course)

Artur Bodera (Joust)
1 May 2009, 8:21 AM
btw: new Option() does not allow for adding optgroups. So you're bound to use document.createElement(), dom.appendChild() etc. and forget about ext at this point :s - this brings us 10 years back, before ext existed and prototype js has been maturing.

evant
15 Jun 2009, 4:58 AM
Going to mark this as closed. While it is a cross browser bug, it's such a small use case, compared to the amount of time it would take to fix. Another complication with this is that the useDom option isn't available in ext-core, so the fix would only apply to ext-all anyway.