I made a small tweak to cssSandpaper which you might want to integrate. I noticed that it tries to AJAX in stylesheets but most of the time that isn't possible due to same origin policy. Ignoring CORS, I think the best is to just exclude cross domain files.
Of course that poses an issue for files on CDN but I think that should be up to the implementor to figure out. In my case I'm doing everything programatically anyways so maybe I'd even want to disable all the AJAX requests to boost performance but that's a separate issue.
function getStyleSheet(node){
var sheetCssText;
switch (node.nodeName.toLowerCase()) {
case 'style':
sheetCssText = StringHelpers.uncommentHTML(node.innerHTML); //does not work with inline styles because IE doesn't allow you to get the text content of a STYLE element
break;
case 'link':
// Don't fetch stylesheets cross domain since cross domain errors will appear
var domainMatch = /\/\/(.*?)\//.exec(node.href);
if (domainMatch !== null && domainMatch[1] !== location.hostname) {
return '';
}
var xhr = XMLHelpers.getXMLHttpRequest(node.href, null, "GET", null, false);
sheetCssText = xhr.responseText;
break;
}
sheetCssText = sheetCssText.replace(reMultiLineComment, '').replace(reAtRule, '');
return sheetCssText;
}
I made a small tweak to cssSandpaper which you might want to integrate. I noticed that it tries to AJAX in stylesheets but most of the time that isn't possible due to same origin policy. Ignoring CORS, I think the best is to just exclude cross domain files.
Of course that poses an issue for files on CDN but I think that should be up to the implementor to figure out. In my case I'm doing everything programatically anyways so maybe I'd even want to disable all the AJAX requests to boost performance but that's a separate issue.