diff --git a/source/Ox/js/Request.js b/source/Ox/js/Request.js index 7ae3b345..58c78d32 100644 --- a/source/Ox/js/Request.js +++ b/source/Ox/js/Request.js @@ -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) {