ext js - el.ownerDocument.createRange() errors in IE 8

≯℡__Kan透↙ 提交于 2019-12-12 04:23:38

问题


HI, I am trying to dynamically add a form to a tab in Ext-js. (the tab has already been rendered). fyi, i am using I am using Ext 2.2.

the error occurs when during the tab.add function: ie:

function tabactivate(tab)   {    
            var newItem= new Ext.FormPanel(.....);              
            **tab.add(newItem)**;    //ERRORS HERE    
            tab.doLayout();            
 }

I get this error on line 247 of ext-all-debug.js which is

range = el.ownerDocument.createRange();

the error is (Object doesn't support this property or method.)

This works fine in Firefox but breaks in IE8. Does anyone know a workaround for this ?

Thanks


回答1:


This sounds very similar to an issue I had with ExtJS 2.2 and IE.

It seems like a lot of places in the Ext code that you see code like this:

var td = document.createElement("td");
this.tr.insertBefore(td, this.tr.childNodes[index]);

When in fact that doesn't work on IE because "this.tr.childNodes([0])" does not yet exist.

My workaround was to override the prototype (in my case insertButton() in Ext.Toolbar) to check for the existence of this.tr.childNodes([0]), using a different function or creating it if it didn't exist.

I hope that I'm correct that this is the problem you are running into.




回答2:


So i found an old string that had the solution for me. http://www.extjs.com/forum/showthread.php?t=7912&highlight=createRange

Essentially, when i was instantiating empty tabs, i had my html property set to this:

html: ' ',

once i either took the property out completely or i changed to

html: '<span></span>'

it stopped breaking.

Thanks




回答3:


IE (even 8) doesn't support the document.createRange() method.

You can try var supportsDOMRanges = document.implementation.hasFeature("Range", "2.0"); to see whether a browser supports DOM ranges per the standard.



来源:https://stackoverflow.com/questions/1896902/ext-js-el-ownerdocument-createrange-errors-in-ie-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!