IE8 Developer Tools Bug: Attaching stylesheets

It seems if you attach a stylesheet with code like this…

$("head").append('<link type="text/css" href="/assets/css/tmp.css" rel="stylesheet" />');

You may not see all the styles in the right hand panel here. ↴

Screen Shot 2014-02-28 at 12.12.20
Although the browser will render any styles in tmp.css, IE developer tools will not be aware of that sheet in it’s style view. So if you have a lot of CSS debugging to do in IE8 (you will) and you wish to attach a sheet dynamically with javascript, I suggest you just hard code the link tag in whilst you’re developing/fixing bugs, then revert to the JS appending when done.

This entry was posted in Development and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *