When will be used <! - [if! IE]>?
I pondered this question last night, debugging some things in IE7, when I typed <!--[if IE7]>... it seemed to me that I saw <!--[if !IE]> .
Now I understand that, as far as I understand, only IE recognizes these conditional comments, therefore, to say if NOT IE does not make sense, IE sees this and says "Iam IE, so this does not apply to me?" or are people confused with which browsers can recognize it?
So my question.
Where would you use <!--[if !IE]> and what is its purpose?
AFAIK, other browsers treat conditional comments as comment blocks (i.e. they are not parsed at all). Thus, such a comment will do something (that is, Include the CSS file) in something EXCEPT Internet Explorer (so this is the opposite of conditional comments [if IE] ). Add all your CSS to such comments and see how IE: P behaves.
[EDIT]
OK, I just checked. This is really stupid. Since the <style> is in CC, other browsers donโt parse it at all, so it doesnโt actually turn on at all. IE really interprets this as "yeah, I'm IE, so I need to skip this." The only reasonable explanation I can think of is that Microsoft assumes that at some point other browsers might start analyzing conditional comments.
You can use it with special synaxia:
<!--[if !(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]--> This means that IE ignores what is in between, but other browsers treat conditional comments as closed comments and interpret between them.
I would say that if you would like to run a script that works in any browser other than IE, since IE does not run it ...
To confirm your suspicion, it is useless to put it in HTML, since most or all browsers will ignore the contents of the comment block.
It is useful to use the negation operator if you want to exclude a specific version, for example, like <! - [if! (IE 6)]> will be parsed in all versions of IE (starting with IE5), but not in IE6.
http://msdn.microsoft.com/en-us/library/ms537512(v=vs.85).aspx