diff --git a/source/Ox/js/Core.js b/source/Ox/js/Core.js index 9231bf54..a279738c 100644 --- a/source/Ox/js/Core.js +++ b/source/Ox/js/Core.js @@ -118,6 +118,11 @@ Ox.load = function() { var callback = arguments[arguments.length - 1], length, loaded = 0, modules = {}, succeeded = 0, type = Ox.typeOf(arguments[0]); + function done(success) { + Ox.documentReady(function() { + callback(success); + }); + } if (type == 'string') { modules = Ox.extend( {}, arguments[0], Ox.isObject(arguments[1]) ? arguments[1] : {} @@ -134,16 +139,22 @@ Ox.load = function() { modules = arguments[0]; } length = Ox.len(modules); - Ox.forEach(modules, function(options, module) { - Ox.getFile( - Ox.PATH + 'Ox.' + module + '/Ox.' + module + '.js', - function() { - Ox.load[module](options, function(success) { - succeeded += success; - ++loaded == length && callback(succeeded == length); - }); - } - ); + Ox.documentReady(function() { + if (!length) { + callback(true); + } else { + Ox.forEach(modules, function(options, module) { + Ox.getFile( + Ox.PATH + 'Ox.' + module + '/Ox.' + module + '.js', + function() { + Ox.load[module](options, function(success) { + succeeded += success; + ++loaded == length && callback(succeeded == length); + }); + } + ); + }); + } }); };