forked from flamejs/flame.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompatibility.js
More file actions
17 lines (17 loc) · 807 Bytes
/
compatibility.js
File metadata and controls
17 lines (17 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// In IE7, Range is not defined, which Metamorph handles with a fallback
if (typeof Range !== "undefined") {
// In IE9, Range is defined but createContextualFragment is not, which Metamorph doesn't handle
// From http://stackoverflow.com/questions/5375616/extjs4-ie9-object-doesnt-support-property-or-method-createcontextualfragme
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;
};
}
}