Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Use array.indexOf if available (speeds up modern browsers). Thanks to…
… lrbabe and Andrea for the patch. Fixes #5160.
- Loading branch information
c07d15d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Andrea Giammachi suggested a larger change which would speed up inArray with other Array-like objects, see
http://groups.google.com/group/jquery-dev/browse_thread/thread/5f23ae0f85bebb89/2b014e7e55cb32c7?lnk=gst&q=indexOf#2b014e7e55cb32c7
c07d15d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of that particular change - it as assumes that all arry indexOf checks actually have the indexOf method (which is not the case for NodeLists, arguments objects, etc.).
c07d15d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, the change proposed by Andrea is in the first message of the thread: http://groups.google.com/group/jquery-dev/browse_thread/thread/5f23ae0f85bebb89/2b014e7e55cb32c7