Long time reader, first time poster.
I need to disable an external CSS stylesheet, and am planning on using the technique described in this thread.
Removing or replacing a stylesheet (a <link>) with JavaScript/jQuery
My question is, how "early" is safe to do it? I would think that as long as script to disable the link is lower in the HTML, the CSS link (though not necessarily the contents of the external stylesheet) will be in the DOM already.
But "the other guys" are saying that's not the case, and to avoid possible race conditions, you shouldn't disable the CSS until "document.ready". (But, if you wait until document.ready, content "flicks" onto the page with the old styles.)
In other words, is this code at all risky?
<head>
<title>Example</title>
<link rel="stylesheet" href="/Common/css/default.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>
jQuery('link[rel=stylesheet]').prop('disabled', true);
</script>
</head>