Page MenuHomePhabricator

Use conditional comments instead of IEFixes.css
Closed, ResolvedPublic


Author: tom

IEFixes.css is included in several skins (including monobook) to load various IE**Fixes.css sheets. It's
just a collection of parser hacks to @import the right IE-fixing stylesheet to the right IE version.

But I can't see any point in it.

Instead of using it, we can simply use conditional comments in <head>, like this:

<!--[if IE 5.0]><link rel="stylesheet" href="IE50Fixes.css" /><![endif]-->
<!--[if IE 5.5]><link rel="stylesheet" href="IE55Fixes.css" /><![endif]-->
<!--[if IE 6.0]><link rel="stylesheet" href="IE60Fixes.css" /><![endif]-->

This is good for several reasons:

  • Gets rid of a HTTP request for IEFixes.css
  • Stops IE from requesting /style/monobook/null?"{ due to syntax hack
  • Doesn't require mad syntax hacks which can be hard to debug and easy to break

And yes, conditional comments aren't standard and are IE/win-only - but we already use one to include
IEFixes.css in the first place, so I see no harm in extending it to cover all versions.

Version: unspecified
Severity: minor
OS: Windows XP
Platform: PC



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 6:59 PM
bzimport set Reference to bz622.
bzimport added a subscriber: Unknown Object (MLST).

Ok, changed it to something similar after doing more testing- IE5 doesn't like
[if IE 5.0] which spoils the thing, but still we save two requests for IE6 and
shouldn't get any null requests any more as IE5 won't do them. Kept the IE6 rule
temporarily in the online code to avoid cache problems, but it's removed in CVS.
Thanks for your hint! Gabriel Wicke

Current rendered code:

<!--[if IE 5]><style type="text/css" media="all">@import


<!--[if IE 6]><style type="text/css" media="all">@import


<!--[if IE]><script type="text/javascript"


<meta http-equiv="imagetoolbar" content="no" /><![endif]-->

tom wrote:

Now uses conditional comments (with the right tests!) for IE5.0 and 5.5.