Monday, July 9, 2012

jQuery 2.0 Drops Support for IE6, 7 and 8

In a surprise announcement on the jQuery blog the team has decided that jQuery 1.9 will be the last edition to support legacy editions of Internet Explorer. jQuery 2.0 — planned for release in 2013 — will no longer support IE6, 7 and 8.

In essence, jQuery 2.0 will be a leaner, faster library without old IE bloat such as DOM selection routines, different event models and HTML5 shims. jQuery 1.9 will continue to be developed and support the older IEs. The team advise that you’ll be able to support every browser using conditional comments, e.g.

<!--[if lt IE 9]>
    <script src="jquery-1.9.0.js"></script>
<![endif]-->
<!--[if gte IE 9]><!-->
    <script src="jquery-2.0.0.js"><</script>
<!--<![endif]-->
 
No one expects old editions of IE to be supported forever and some will applaud the decision to abandon browsers which have caused development grief for many years. But the statement is surprising for several reasons.
First, while IE6 and 7 usage has fallen to below 2%, they remain the browsers of choice for many large corporations, government departments and the Chinese. IE8 is likely to fall below 10% by 2013 but it’s the latest edition available to those on Windows XP. Almost one in three people use the OS and, while it’s dying, it’s lingering far longer than Microsoft anticipated.

[The following section has been revised. Thanks to everyone who pointed out the error in the original code.]

Second, conditional comments. Really? We’re still resorting to browser detection in 2013? That practice should have died out in 1999. Conditional comments were a temporary hack and have been dropped in IE10. JavaScript or server-side browser sniffing is no better.

It also introduces the problem of having two forked code bases for the same library. Inevitably, there will be bugs and differences between 1.9 and 2.0 — especially as jQuery evolves beyond those editions. What do you do when your code works in one but not the other?

Third: the primary reason developers use jQuery is to circumvent browser compatibility issues. The original purpose of jQuery, Prototype, Mootools, YUI and similar libraries was to provide a consistent set of objects and methods which abstracted the differing browser APIs. Wrappers are placed around features such as DOM selection and event delegation to smooth out implementation wrinkles.

Today, the differences between modern browsers is negligible. Consider the DOM querySelectorAll(CSS selector) method; it’s supported everywhere (even in IE8) and will always be faster than jQuery’s $(CSS selector). Core JavaScript features such as traversal, manipulation, events and Ajax are usable everywhere. jQuery’s animations and effects can also be replaced by CSS3. jQuery 2.0 will still provide useful utilities and compatibility fixes but, without legacy IE support, there’s less reason to use it.

Fourth is the confusion the update will cause. Currently, developers can usually migrate to the latest version without breaking their scripts. It doesn’t matter how much publicity jQuery 2.0 receives, many people will think it’s “better” than version 1.9. They’ll upgrade then complain bitterly when their site fails in IE7.

No comments:

Post a Comment