Assets.js
Assets.js copied to clipboard
Stylesheet attempts to load img?
I recently incorporated this library into my framework, and it works great! Thanks!
But I'm curious why it attempts to load CSS files as an "img" first?
getCss: function(url, callback){
var d = $.Deferred(),
link = document.createElement('link');
link.type = 'text/css';
link.rel = 'stylesheet';
link.href = url;
document.getElementsByTagName('head')[0].appendChild(link);
var img = document.createElement('img');
img.onerror = function(){
d.resolve();
if(callback) callback(link);
};
img.src = url;
return d.promise();
}
What is the purpose of that? It's always failing in my browser.
Answer is https://github.com/aheinze/Assets.js/issues/2 but it's your! :)