IE getting rid of CC's in version 10

First I heard of it. Good maybe now everyone can stop pushing them.

It’s a handy hack though, this sort of thing allows for solutions like http://james.padolsey.com/javascript/detect-ie-in-js-using-conditional-comments/

If you buy bigger pants (AKA CC’s) it allows for slips in your diet (AKA standard compliance). Good analogy huh

You’re certainly free to dislike them, but you should at least be aware that the web community in general likes and has embraced the conditional comment class solution. And for good reason, I think. The traditional drawbacks of CCs, such as multiple stylesheets, are no longer an issue, and our CSS becomes cleaner and self-documenting. .ie selector {} is much more clear than virtually every hack.

Getting rid of them in IE10 shouldn’t be a problem as IE10 is compliant to all the same standards as the other browsers are - so all the conditional comments will be just comments as far as IE10 is concerned just as they are for other browsers.

Also just because IE10 gets rid of them will not prevent them from working in IE9 and earlier.

Crossing my fingers that we won’t uncover any inexplicable bugs that IE has historically been notorious for.

Every browser has its little quirks here and there. No doubt IE10 will have them too. At least (we hope) that M$ has tried to be standards compliant this time. And hopefully they will be good to their word and start pushing regular browser updates like the other browser makers do.

Hopefully they will be no different than the minor quirks with other browsers.

The biggest problem I had with conditional comments was in IE9 which still supports the JScript conditional comments but where most of the things those comments are actually needed for are not what IE9 expects. So having IE10 not recognise conditional comments will resolve the last of the Javascript/JScript incompatibilities.

I don’t know much about JScript, except what a massive PITA it is for a noob trying to learn JS, but this page makes me wonder if IE10 really doesn’t understand JScript comments:

@if (@_jscript_version == 10)
    document.write("You are using IE10");

Well first of all document.write has been obsolete since Netscape 4 and IE3 so that is an extremely poor example in the first place.

A better example would be creating an input tag with a name (where you can’t add a name to a field after it is first created in IE8 and earler):

var newIN;
/*@cc_on
  @if(@_jscript)
     @if (@_jscript_version < 9)
        newIN = document.createElement("<input name='"+nam+"'>");
     @else
        newIN = document.createElement("input");
        newIN.name = nam;
     @end
  @else */
     newIN = document.createElement("input");
     newIN.name = nam;
/* @end @*/

Note that IE9 does not support the JScript way of creating input tags with names even though it claims to support JScript as well as JavaScript. I would hope that after IE9 supporting both that IE10 would drop support for JScript and only support JavaScript (but I coded the above to allow for it either way).

[font=verdana]:lol: Sure, but if you are a lardy butt, buying really tight pants just means you won’t be able to wear them!

If IE10 is sufficiently standards-compliant that it doesn’t need conditional comments then this is great news. But it has to be that way round. Remember when we thought that IE7 was going to be the great saviour? And then that IE8 would? Yes, each of these has been a major step forwards, but we’ve still needed conditional comments all the way through. Hopefully with IE10 we have, at long last, a version that doesn’t need them.[/font]

Playing the devil’s advocate I’m a little worried about losing CCs I must admit. IE9 is pretty good but due to its sub pixel sizing algorithms it’s often 1px out in alignment of text and inline images due to its line height calculations and while that may not matter to me or you, some of my clients refuse to accept it especially when its something that should be simple. Although I tell my clients you can’t control every pixel it does look bad when things are supposed to be aligned nicely in a row and they are 1px out vertically. I don’t think the layout should look the same in different browsers but it shouldn’t look broken in a modern browser.

Mind you these days most of the comments I get from clients are “this looks wrong in Chrome” and although its usually something minor (not always though) it is a pain to work around. Maybe we should take the CC’s from IE and give them to webkit :slight_smile:

It’s probably a good move. People fear change. e.g. Obama gets 2nd term. They think to themselves, "he’s total !*%# but the new guy could be bigger *^%#. Don’t forget he could be better.

One of the weakest rebuttals ever. Some of the most highly respected people here at SitePoint, as well as highly respected people in the larger web community, have made rational and reasonable arguments in favor of CCs, but you dodged those arguments and instead chalked it up to fear or change.

Dude stop poking at me. I don’t care what you use. Nor should you I. I am mearly pointing out they are leaving. Make what you will of it.

You did more than that, actually. You made a claim about why people use, and would like to keep using, CCs. And according to you, it isn’t for any of the reasons we’ve expressed, but because we “fear change.” How could you even expect such a questionable claim to go undisputed?

CCs are/were a good idea. CSS hacks are far more spotty and just as likely to break down in future versions. Most times when you use a CSS you were targeting an OLDER IE anyway and you could easily change the scope of the CC. But as it has been mentioned newer IE versions are fairly compliant and CCs as no longer as vital for basic page layout or ‘bug fixes’.

That being said, I will miss them too. It’s not fear of change or even reliance on CCs ( I seldom used them but when I do they are a life saver!) ; it’s that a tool has been taken out of my kit and that’s never any fun.

For the record I have nothing against them. Why would why. For those busting out sites I see their need. But I have found there is 99.99% of the time a way to surcumvent their use without the need for hacks. Either let ie get square corners (ie users like that apparently) or code it using method number 7 instead of 11. They are somewhat (not all obviously) the lazy way out. If I could eat all I wanted (aka sloppy coding) and simply take a pill the next day (aka CCs) that would be lazy. Or easy depending on your perception. And YOUR perception being the key word. I’ve always been an advocate for do as you please I could care less. I only care what I do.

They would have been if they were actually implemented properly but the jscript ones were implemented incorrectly in IE9 - IE9 only supports part of JScript and has implemented full support for JavaScript - unfortunately a part of JScript that it supports is condifional comments and a part it doesn’t support is the only code I have ever come across that needs those conditional comments to handle it - creating a named input or textarea field in a single command because JScript doesn’t allow you to add the name after the field is created.

@if(@_jscript) <– this JScript CC recognised by IE9
newIN = document.createElement(“<input name='”+nam+“'>”); <– this JScript invalid in IE9

So you have to implement another JScript conditional comment to test specifically for IE9 because IE9 doesn’t support that one JScript statement that you can’t use feature sensing to detect.

CC as implemented by Microsoft are are almost useless because they didn’t implement them consistently. The one instance where a CC is needed in JScript is broken in IE9 because that’s the one part of JScript that IE9 doesn’t support.

Unlike in HTML where IE changed what it supports between each version of the browser, the only change regarding JScript/JavaScript is that IE8 and earlier support JScript but not JavaScript and all other non-IE browsers support JavaScript and not JScript. IE9 supports JavaScript and JScript conditional comments but not the parts of JScript that need conditional comments to distinguish them from the JavaScript version. IE9 would work better if it didn’t support JScript conditional comments and so force you to rewrite the code everywhere you have used them in order for IE9 to be able to run the JavaScript version instead of seeing the JScript code that it can’t run.