---
title: "解决Ext的Tooltip在IE9中不能显示"
author: "whoosh"
date: "2012-02-07T12:13:14Z"
tags: ["EXT", "IE9", "tooltip"]
categories: ["Web前端"]
slug: "ext-tooltip-ie9"
draft: false
lastmod: "2012-02-07T12:13:14Z"
id: 1396409
url: "https://whoosh.iteye.com/blog/1396409"
---

项目最近使用的浏览器要升级到IE9了。发现所有的Ext的Tooltip都不能出现。  
在IE9中Debug的时候发现Ext的createContextualFragment方法有问题，网上提供了一段修复该方法的代码，只需要把如下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;
   };
}
```

 

问题解决。

原因：看解决该问题的代码，感觉是Ext可能是未定义Range或者在定义该方法的时候有点问题。