fix loading css on Safari 5 and other older browser
This commit is contained in:
parent
8e0c2c02f6
commit
0fd84ba156
1 changed files with 17 additions and 0 deletions
|
@ -127,6 +127,11 @@ Ox.getAsync = function(urls, get, callback) {
|
|||
}
|
||||
head.appendChild(element);
|
||||
}
|
||||
if (type == 'stylesheet') {
|
||||
//fixme only call if browser does not support onload
|
||||
// Safari 5 does not fire onload
|
||||
waitForCSS();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
callback(cache[url], null);
|
||||
|
@ -145,6 +150,18 @@ Ox.getAsync = function(urls, get, callback) {
|
|||
callback(cache[url], null);
|
||||
}
|
||||
}
|
||||
function waitForCSS() {
|
||||
var error = false;
|
||||
try {
|
||||
element.sheet.cssRule;
|
||||
} catch (e) {
|
||||
error = true;
|
||||
setTimeout(function() {
|
||||
waitForCSS();
|
||||
}, 25);
|
||||
}
|
||||
!error && onLoad();
|
||||
}
|
||||
}
|
||||
|
||||
function getFiles(type, urls, callback) {
|
||||
|
|
Loading…
Reference in a new issue