Ticket #10831 (closed bug: invalid)
inArray is broken on IE7 and 8 at least when called with just 2 params
| Reported by: | rr.rosas@… | Owned by: | rr.rosas@… |
|---|---|---|---|
| Priority: | undecided | Milestone: | None |
| Component: | core | Version: | 1.7.1rc1 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
I've experienced an issue with IE 7 and 8 where $.inArray(elem, array) returned -1 while $.inArray(elem, array, 0) returned 3.
It turns out that Array.prototype.indexOf.call(array, elem, undefined) returns -1 in some IE7/8 mode (not sure if in Quirks mode or the opposite). jQuery should change this to:
Array.prototype.indexOf.call(array, elem, i === undefined ? 0 : i)
Or something similar.
Change History
comment:1 Changed 18 months ago by rwaldron
- Owner set to rr.rosas@…
- Status changed from new to pending
- Component changed from unfiled to core
comment:2 Changed 18 months ago by rr.rosas@…
- Status changed from pending to new
Humm... so sorry, I've just realized this is not a jQuery bug since IE8 doesn't support indexOf. I was foolished by the es5-shim project. I'll open a bug report there and you can close this one.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket!
Additionally, be sure to test against the "jQuery (edge)" version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.