Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
11 lines (10 sloc) 1.12 KB
layout title date tags
post
using underscore filter in IE 7 & 8
2011-11-09 21:00:00 +0100
ie7 ie8 underscore

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