fix scriptloading on old ie

This commit is contained in:
nightwing 2012-07-06 12:06:42 +04:00
commit 4319abf256

View file

@ -8,6 +8,8 @@
define(function(require, exports, module) { define(function(require, exports, module) {
"use strict"; "use strict";
var useragent = require("ace/lib/useragent");
exports.get = function (url, callback) { exports.get = function (url, callback) {
var xhr = exports.createXhr(); var xhr = exports.createXhr();
xhr.open('GET', url, true); xhr.open('GET', url, true);
@ -56,6 +58,11 @@ exports.loadScript = function(path, callback) {
s.src = path; s.src = path;
head.appendChild(s); head.appendChild(s);
if (useragent.isOldIE)
s.onreadystatechange = function () {
this.readyState == 'loaded' && callback();
};
else
s.onload = callback; s.onload = callback;
}; };