Opened 11 years ago
Closed 11 years ago
#10831 closed bug (invalid)
inArray is broken on IE7 and 8 at least when called with just 2 params
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | core | Version: | 1.7.1rc1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
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 (4)
comment:1 Changed 11 years ago by
Component: | unfiled → core |
---|---|
Owner: | set to [email protected]… |
Status: | new → pending |
comment:2 Changed 11 years ago by
Status: | pending → 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.
Note: See
TracTickets for help on using
tickets.
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.