Fixing javascript Array functions in Internet Explorer (indexOf, forEach, etc)

Posted by Chas Emerick on Stack Overflow See other posts from Stack Overflow or by Chas Emerick
Published on 2010-05-07T16:14:08Z Indexed on 2010/05/07 16:18 UTC
Read the original article Hit count: 257

As detailed elsewhere, and otherwise apparently well-known, Internet Explorer (definitely 7, and in some instances, 8) do not implement key functions, in particular on Array (such as forEach, indexOf, etc).

There are a number of workarounds here and there, but I'd like to fold a proper, canonical set of implementations into our site rather than copy and paste or hack away at our own implementations. I've found js-methods, which looks promising, but thought I'd post here to see whether another library comes more highly-recommended. A couple of misc. criteria:

  • the lib should just be a no-op for those functions that a browser already has implementations for (js-methods appears to do quite well here)
  • non-GPL, please, though LGPL is acceptable

© Stack Overflow or respective owner

Related posts about internet-explorer

Related posts about JavaScript