Assertfail

All Posts assertfail

View the Blog on GitHub wallymathieu

using underscore filter in IE 7 & 8

09 Nov 2011

Array.prototype.filter seems to be slightly off in IE7-8. It looks like they have added support for standard array functions. That is, it looks like there is a prototype for this in IE7-8 mode in IE9. The problem is that the filter prototype does not work exactly as expected in underscore.

If we look at the documentation for this method on msdn you find that this is probably a bug.

It is simple to patch the prototype implementation you find using F12 in IE. Otherwise you could use the prototype described in the stackoverflow post (i.e. Mozilla’s Array filter implementation):
https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/filter

Tags

  • ie7
  • ie8
  • underscore
  • Comments or errors? Fork post and do a pull request on github