Side navigation
Ticket #4262: jquery.eq.patch
File jquery.eq.patch, 0.4 KB (added by ricardobeat, February 28, 2009 07:48PM UTC)
patch with support for negative indexes
Index: jquery/src/core.js
===================================================================
--- jquery/src/core.js (revision 6263)
+++ jquery/src/core.js (working copy)
@@ -498,7 +498,9 @@
},
eq: function( i ) {
- return this.slice( i, +i + 1 );
+ if (i < 0)
+ i += this.length;
+ return this.pushStack( this[i], 'eq', i );
},
slice: function() {
Download in other formats:
Original Format
File jquery.eq.patch, 0.4 KB (added by ricardobeat, February 28, 2009 07:48PM UTC)
patch with support for negative indexes
Index: jquery/src/core.js
===================================================================
--- jquery/src/core.js (revision 6263)
+++ jquery/src/core.js (working copy)
@@ -498,7 +498,9 @@
},
eq: function( i ) {
- return this.slice( i, +i + 1 );
+ if (i < 0)
+ i += this.length;
+ return this.pushStack( this[i], 'eq', i );
},
slice: function() {