adh32 — 2011-08-19T16:06:34-04:00 — #1
Curious. What's the difference between these two conditional comments?
<!--[if gte IE 8 | !IE]><!-->
<!--[if (gte IE 8) | !(IE)]><!-->
The Sitepoint reference entry lists parentheses as a "subexpression operator". But today I've seen both of the above versions used and on my own site, I use the first version. Is it right/wrong or does it matter?
felgall — 2011-08-19T16:23:42-04:00 — #2
In that particular case since only IE reads conditional comments in the first place, the !IE is just a comment to remind you that the condition also applies to all other browsers.
adh32 — 2011-08-19T16:30:24-04:00 — #3
Yes, but what about the parentheses?
stomme_poes — 2011-08-20T19:56:48-04:00 — #4
I know they're not needed if you aren't using the | or in there... but with the OR you'd think it was safer. I'd check the MSDN pages regarding CC's to be sure. It's possible they are necessary when using | and it just looks like it's working because the !IE thing makes no sense... only IE would read the "not IE" comment, so no not-IE browsers will see that.
<!--[if gte IE 8]> stuff for browsers IE8 and IE9... IE10 does not do CCs<!-->
I would think the parens would work like this anyway:
<!--[if (gte IE 8 | IE 6)]> stuff for browsers IE8 and IE9... and IE6 (so, skipping IE7)<!-->
adh32 — 2011-08-21T09:38:48-04:00 — #5