Of course exact standardization is always welcome, but there is always the problem of breaking old code by dropping past indiscretions in favour of standards exactitude - i.e. if you do it right now you might well break past code that depends on doing it a little wrong. When something is an addition to a standard then there is often the temptation to let things slip and stay as they are. Not so with Microsoft and IE10.
In a recent blog post it was revealed that some widely used legacy constructs are about to be dumped. The most important is the removal of support for the conditionals that come into play if your HTML contains anything like:
other HTML that will only render
if the browser is HTML
Conditionals are used in many pages to take account of strange behavior of past browsers - notably IE6. The whole point of a conditional is that it takes the form of a valid HTML comment which IE takes notice off as a command where the others treat it as a comment. You have to admit that it is a nice construct and a safe way of including additional functionality.
But having comments actually do something is the road to madness and Microsoft is going to eliminate them in IE10. As from IE10 you have to use the more modern approach of feature detection rather than browser identification.
The argument goes that this is no great loss as conditionals will still work in older browsers and in IE10 in legacy mode - just not in IE10 native mode. As conditionals are mostly used to make up for problems with older browsers this should all work as expected. However, don't use conditionals in any page that used HTML5 as a short cut to avoid feature and environment detection.
So everything is fine. Well there is one small problem. HTML5 doesn't have a conditional to replace it with. This isn't unreasonable as HTML is just a markup language, and a semantic markup language at that. It isn't supposed to have actions and so conditionals are out.
is a property that is only processed if the browser is from the Mozilla family (Gecko-based browsers) and ignored otherwise.
Hold on a moment, isn't this exactly the same sort of mechanism that has just been dropped by IE10 and HTML5 in general? So what isn't good for HTML5 is good for CSS.
More worryingly have you actually looked at the number of custom CSS properties? It's a growing sprawling mess that makes a nonsense of the idea of feature detection. See With the number of experimental features supported it is not only a mess it's a fragile mess destined to make web pages look silly in future browsers.
This doesn't smell good.
A simple HTML conditional that made use of either browser or feature conditions would be a great simplification. Why doesn't HTML5 have such a feature?
Because theoretical purity rules over practical simplicity.
It's not so much that IE10 needs to lose conditionals, more that HTML5 needs to find them.
If you would like to be informed about new articles on I Programmer you can either follow us on Twitter or Facebook or you can subscribe to our weekly newsletter.