I don't really know for sure if this is a real issue or not but I've got a problem due to JS scripts being executed as soon as they are downloaded. I think JS scrips should be executed in the exact order as they appear on script tags. I changed injectHtml method to something like this on its last lines and it looks like the problem is gone.
var loadNextScript = function() {
jQuery.getScript(newScripts[loadedScriptsCount] + (new Date().getTime()), function () {
loadedScriptsCount++;
if (loadedScriptsCount === newScripts.length) {
scriptsLoaded();
} else {
loadNextScript();
}
});
}
/**
* Scripts loaded callback
*/
var scriptsLoaded = function () {
// Execute inline scripts
for (var i = 0; i < inlineInjections.length; i += 1) {
window.eval(inlineInjections[i]);
}
};
// Load scripts
if (newScripts.length) {
loadNextScript();
} else {
scriptsLoaded();
}
I don't really know for sure if this is a real issue or not but I've got a problem due to JS scripts being executed as soon as they are downloaded. I think JS scrips should be executed in the exact order as they appear on script tags. I changed injectHtml method to something like this on its last lines and it looks like the problem is gone.