X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Ftraversing.js;h=1342c59599e97c03e8b4a64ddda339636ace268c;hb=9de120e6d7cfffa3d990a6ccf23db3cd74e2bdc0;hp=f46820f849d913a3fe95942eb58c52d31d5d1ca8;hpb=4ea4fad0902839c06c281b5de7b0aca29922b63d;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() {