ie9-js - has something else rendered it obsolete?

Marcin picture Marcin · Apr 19, 2012 · Viewed 9.1k times · Source

So, everyone knows ie9.js (from http://code.google.com/p/ie7-js/). It seems to work, but it never left beta since the last release in 2010.

Obviously, there are some other things that do something a bit similar (such as modernizr, html5shiv, and CSS3Pie), but they aren't quite the same (not least because they need to be applied per-feature or are more limited in scope).

Is it still considered good practice to use it for modernisation? Should I be using something else?

Answer

Spudley picture Spudley · May 19, 2012

ie9.js is still a good piece of code. It does a lot of work, fixing up stuff that IE gets wrong.

As you rightly point out, it is now an old piece of code, but it does still work.

Reasons why people might not be using it so much any more:

  • ie9.js is a single large polyfill. That makes it bulky and slow. If you only need to fix certain specific features, it may be overkill; a few smaller patches may be better.
  • The bulk of the fixes that ie9.js does are for IE6. Fewer and fewer sites are bothering to support IE6 any more, so all that code is redundant. Again, a few smaller patches may be better.
  • ie9.js isn't being actively maintained any more. That's fine, because it does the job it set out to do, but other, newer patches are generating more interest, as much because they're new as for any advantage they may have.

Of the tools you mentioned as alternatives (modernizr, html5shiv, CSS3Pie), none of them actually have any feature cross-over with ie9.js at all. (see also this answer)

However, here are some more recent tools that might be good alternatives to ie9.js:

  • jQuery - or one of the other similar libraries. This does a whole lot more than just fix IE's holes, but because it makes a point of cross-browser compatibility, even in IE6, if you're writing jQuery code, there's very little need for the Javascript patches provided by ie9.js
  • Selectivzr - this is probably the main one. It's a polyfill for most of the missing CSS selectors that IE doesn't support. ie9.js does a few more (namely relational selectors for IE6 & 7), but Selectivzr uses pre-existing selector engines (your choice of jQuery, Prototype, etc), meaning that it's very fast and also lightweight because it makes use of resources that are already loaded.

Given that the vast majority of JS code in the browser is written using jQuery these days, this basically reduces the need for an all-encompassing IE-fixer patch like ie9.js down to virtually zero.

However, if you're not using jQuery or a similar library, then you may find ie9.js can still work for you very well.