selectivizr
selectivizr copied to clipboard
Error in IE8 when serving empty stylesheet
My style sheets are dynamically served by ASP.Net (using a rerouting system). It seems that the loadStyleSheet successfully gets the sheet. Because the sheet in question is empty the xhr.responseText returns null, which will cause a JavaScript error.
Changing the code to the following fixed my problem:
// --[ loadStyleSheet() ]-----------------------------------------------
function loadStyleSheet( url ) {
xhr.open("GET", url, false);
xhr.send();
return (xhr.status == 200) ? (xhr.responseText != null ? xhr.responseText : EMPTY_STRING) : EMPTY_STRING;
};
I admit that is is weird to serve an empty stylesheet, but I think it should not break.