Home  >  Article  >  Database  >  EXTJS 2.2版本在IE9中会报错:对象不支持“createContextualFrag

EXTJS 2.2版本在IE9中会报错:对象不支持“createContextualFrag

WBOY
WBOYOriginal
2016-06-07 15:36:461151browse

如果是EXTJS 2.2的版本,应该是在ext-all.js 233行处报错:对象不支持“createContextualFragment”属性或方法,这是extjs2.2的一个BUG,应该那个时候还没有IE9,只有后面的版本解决了这个问题,这两天我也正遇到了这个问题,根据网上查阅,发现很多人都遇到

如果是EXTJS 2.2的版本,应该是在ext-all.js 233行处报错:对象不支持“createContextualFragment”属性或方法,这是extjs2.2的一个BUG,应该那个时候还没有IE9,只有后面的版本解决了这个问题,这两天我也正遇到了这个问题,根据网上查阅,发现很多人都遇到同样的问题,解决办法如下:

在 ext-all.js报错的那一行前面加入下面的代码:

if ((typeof Range !== "undefined") && !Range.prototype.createContextualFragment)
{
     Range.prototype.createContextualFragment = function(html)
     {
         var frag = document.createDocumentFragment(),  
         div = document.createElement("div");
         frag.appendChild(div);
         div.outerHTML = html;
         return frag;
     };

注:上面代码是网友提供的。

我试了,这样可以解决问题了。但EXTJS 在IE9下面好像问题还挺多,如果设置为浏览器兼容模式,很多问题都可以解决。希望大家都能把自己在IE9下遇到的问题拿出来,一起讨论,找寻解决办法。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn