X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Ftraversing.js;h=1342c59599e97c03e8b4a64ddda339636ace268c;hb=0790989eb60df9df884837c05f90bab14df0704e;hp=f46820f849d913a3fe95942eb58c52d31d5d1ca8;hpb=d6991fa273515a8503692324499edcc71b5c3f64;p=jquery.git diff --git a/src/traversing.js b/src/traversing.js index f46820f..1342c59 100644 --- a/src/traversing.js +++ b/src/traversing.js @@ -78,7 +78,17 @@ jQuery.fn.extend({ }, eq: function( i ) { - return this.slice( i, +i + 1 ); + return i === -1 ? + this.slice( i ) : + this.slice( i, +i + 1 ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); }, slice: function() {