Bug Tracker


Ticket #10076 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

$.inArray crushes IE6 and Chrome if second argument is `null` or `undefined`

Reported by: Anton Ryzhov Owned by:
Priority: low Milestone: 1.6.3
Component: core Version: git
Keywords: Cc:
Blocking: Blocked by:


$.inArray crushes IE6 and Chrome if second argument is null or undefined, but in Firefox and Opera native functions returns -1.

Following patch unifies $.inArray behavior and avoids JS-engine from crush.

Test case is available  here.

Patch and pull request is  here.

Change History

comment:1 Changed 3 years ago by rwaldron

  • Status changed from new to open

The real issue is that the correctly thrown TypeError is preventing the method from returning a value:

Uncaught TypeError: Array.prototype.indexOf called on null or undefined

comment:2 Changed 3 years ago by rwaldron

  • Priority changed from undecided to low
  • Component changed from unfiled to core
  • Milestone changed from None to 1.6.3

comment:4 Changed 3 years ago by Dave Methvin

  • Status changed from open to closed
  • Resolution set to fixed

Merge pull request #465 from anton-ryzhov/master

Fixes #10076. $.inArray crashes IE6 and Chrome if second argument is null or undefined (Thanks anton-ryzhov!)

Changeset: a839af034db2bd934e4d4fa6758a3fed8de74174

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.


Add a comment

Modify Ticket

as closed

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.