selectivizr icon indicating copy to clipboard operation
selectivizr copied to clipboard

Error in IE8 when serving empty stylesheet

Open KeesCBakker opened this issue 10 years ago • 0 comments

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.

KeesCBakker avatar Nov 20 '13 14:11 KeesCBakker