Use the native Array indexOf method if it exists, for jQuery.inArray.
This commit is contained in:
parent
96dd06ea50
commit
1e750a00e9
|
@ -40,7 +40,8 @@ var jQuery = function( selector, context ) {
|
||||||
// Save a reference to some core methods
|
// Save a reference to some core methods
|
||||||
toString = Object.prototype.toString,
|
toString = Object.prototype.toString,
|
||||||
push = Array.prototype.push,
|
push = Array.prototype.push,
|
||||||
slice = Array.prototype.slice;
|
slice = Array.prototype.slice,
|
||||||
|
indexOf = Array.prototype.indexOf;
|
||||||
|
|
||||||
jQuery.fn = jQuery.prototype = {
|
jQuery.fn = jQuery.prototype = {
|
||||||
init: function( selector, context ) {
|
init: function( selector, context ) {
|
||||||
|
@ -522,6 +523,12 @@ jQuery.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if ( indexOf ) {
|
||||||
|
jQuery.inArray = function( elem, array ) {
|
||||||
|
return indexOf.call( array, elem );
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// All jQuery objects should point back to these
|
// All jQuery objects should point back to these
|
||||||
rootjQuery = jQuery(document);
|
rootjQuery = jQuery(document);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue