Here is my standard conditional comments to give IE hacks to IE8 and below only. It works on initial load.
<!--[if lt IE 9]>
<link href="Styles/IE.css" rel="stylesheet" type="text/css" />
<![endif]-->
When there is a postback, Chrome 21.0.1180.60 m suddenly loads it! What is going on?
Update:
I Confirmed that this happens in Firefox and Opera as well. I am wondering if somehow .NET scrapes the source for CSS includes without regard to conditional comments and puts them in the viewstate, which somehow includes the CSS file on postback? Does that even make sense? What else could be happening here?
Update 2:
This is weird. The conditional comments only load CSS, (not plaintext, html, or javascript) and only if in the header. Firefox, Opera, and IE will load any number of conditional comments (regardless of which browser they target), but Chrome will only load the first one. Thus:
<!--[if lt IE 9]>
<link href="Styles/IE.css" rel="stylesheet" type="text/css" />
<![endif]-->
<!--[if IE 7]>
<style>#test{border:dashed 1px red;</style>
<script>alert("seven");</script>
<![endif]-->
<!--[if IE 8]>
<style>#test{border:dashed 1px blue;</style>
<script>alert("eight");</script>
<![endif]-->
<!--[if IE 9]>
<style>#test{border:dashed 1px green;</style>
<script>alert("nine");</script>
<![endif]-->
Will load the IE.css
in all browsers on postback, and IE, Opera and Firefox will load the CSS for IE 7, 8 and 9, resulting in a green border on #test
. Chrome doesn't give #test
any border. No javascript alerts will happen.
RadControls is grabbing the conditional stylesheet only when in the header...as far as I can tell from their documentation ( http://www.telerik.com/help/aspnet-ajax/ajax-conditional-comments.html ), it says: "Unfortunately we have not found a feasible way to check for those [referring to the conditional stylesheets] and we cannot easily fix this problem.", so they just provided a couple workarounds, 1 option being to place the conditional comments in the body. So, to answer your question, the developers know this is a bug and will hopefully fix soon...