diff --git a/css.js b/css.js index d30bf98..2d0f346 100644 --- a/css.js +++ b/css.js @@ -146,21 +146,23 @@ define(function() { } }, 10); link.href = url; + // Support for requireJS error handling on links. Tested Chrome v44 & Firefox v40 + link.onerror=function(error){ + this.remove(); + callback.error(error); + } head.appendChild(link); } //>>excludeEnd('excludeRequireCss') cssAPI.normalize = function(name, normalize) { - if (name.substr(name.length - 4, 4) == '.css') - name = name.substr(0, name.length - 4); - - return normalize(name); + // Only append .css if it doesn't have it already or a ? + return normalize( /(\?|\.css$)/.test(name) ? name : name+'.css' ); } //>>excludeStart('excludeRequireCss', pragmas.excludeRequireCss) cssAPI.load = function(cssId, req, load, config) { - - (useImportLoad ? importLoad : linkLoad)(req.toUrl(cssId + '.css'), load); + (useImportLoad ? importLoad : linkLoad)(req.toUrl(cssId), load); } diff --git a/css.min.js b/css.min.js index 2e1d120..923c99b 100644 --- a/css.min.js +++ b/css.min.js @@ -1 +1 @@ -define(function(){if("undefined"==typeof window)return{load:function(e,t,n){n()}};var e=document.getElementsByTagName("head")[0],t=window.navigator.userAgent.match(/Trident\/([^ ;]*)|AppleWebKit\/([^ ;]*)|Opera\/([^ ;]*)|rv\:([^ ;]*)(.*?)Gecko\/([^ ;]*)|MSIE\s([^ ;]*)|AndroidWebKit\/([^ ;]*)/)||0,n=!1,r=!0;t[1]||t[7]?n=parseInt(t[1])<6||parseInt(t[7])<=9:t[2]||t[8]?r=!1:t[4]&&(n=parseInt(t[4])<18);var o={};o.pluginBuilder="./css-builder";var a,i,s,l=function(){a=document.createElement("style"),e.appendChild(a),i=a.styleSheet||a.sheet},u=0,d=[],c=function(e){u++,32==u&&(l(),u=0),i.addImport(e),a.onload=function(){f()}},f=function(){s();var e=d.shift();return e?(s=e[1],void c(e[0])):void(s=null)},h=function(e,t){if(i&&i.addImport||l(),i&&i.addImport)s?d.push([e,t]):(c(e),s=t);else{a.textContent='@import "'+e+'";';var n=setInterval(function(){try{a.sheet.cssRules,clearInterval(n),t()}catch(e){}},10)}},p=function(t,n){var o=document.createElement("link");if(o.type="text/css",o.rel="stylesheet",r)o.onload=function(){o.onload=function(){},setTimeout(n,7)};else var a=setInterval(function(){for(var e=0;e