Published 2012-02-01 03:05 by Leif Halvard Silli
<!--[if i]><![endif]-->
<!DOCTYPE html><html><head>
<!--[if ie]><meta http-equiv=X-UA-Compatible content="IE=Edge"><![endif]-->
<!--[if i]><![endif]-->
does two things: It prevents some kind of download blocking, in Internet Explorer. And, more important in our context: Without it, the second conditional comment does not work.
[if IE]
— I wrote [if i]
, which to IE is equivalent to [if !IE]
. This is almost entirely unimportant — it just saves one character…<!--[if ie]><meta http-equiv=X-UA-Compatible content="IE=Edge"><![endif]-->
— the only thing to say is that without the empty, conditional comment before the DOCTYPE (see previous point), this conditional comment does not work.It’s all in the DOM. Let’s examine the alternatives:
x-ua-compatible
would then enter quirks mode, because it saw something — the meta element — before the DOCTYPE.x-ua-compatible
at all?Why indeed. It – hopefully – avoids that IE jumps to a legacy mode, without your awareness.
Some claim that you should send the x-ua-compatible
pragma as an HTTP header instead of including it in your code. This, in order to stay HTML5-valid. Well, I tried that — and it caused some weired problems, actually. (It affected — strangely enough — the source, uppercasing the code when saving and other things — should probably write an article about that, to document that I am not insane or something …)
Look forward to that day!
© 2013 Leif Halvard Silli