Google Code Prettify

2011年4月25日 星期一

讓Ext JS 2 支援IE9

增加下列語法即可

if (typeof Range.prototype.createContextualFragment == "undefined") {
Range.prototype.createContextualFragment = function(html) {
var doc = this.startContainer.ownerDocument;
var container = doc.createElement("div");
container
.innerHTML = html;
var frag = doc.createDocumentFragment(), n;
while ( (n = container.firstChild) ) {
frag
.appendChild(n);
}
return frag;
};
}