git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
jquery core: closes #2771
[jquery.git]
/
src
/
core.js
diff --git
a/src/core.js
b/src/core.js
index
500e400
..
42fd8d4
100644
(file)
--- a/
src/core.js
+++ b/
src/core.js
@@
-140,12
+140,10
@@
jQuery.fn = jQuery.prototype = {
var ret = -1;
// Locate the position of the desired element
var ret = -1;
// Locate the position of the desired element
- this.each(function(i){
- if ( this == elem )
- ret = i;
- });
-
- return ret;
+ return jQuery.inArray(
+ // If it receives a jQuery object, the first element is used
+ elem && elem.jquery ? elem[0] : elem
+ , this );
},
attr: function( name, value, type ) {
},
attr: function( name, value, type ) {
@@
-1124,7
+1122,8
@@
jQuery.extend({
inArray: function( elem, array ) {
for ( var i = 0, length = array.length; i < length; i++ )
inArray: function( elem, array ) {
for ( var i = 0, length = array.length; i < length; i++ )
- if ( array[ i ] == elem )
+ // Use === because on IE, window == document
+ if ( array[ i ] === elem )
return i;
return -1;
return i;
return -1;