Skip to main content

Bug Tracker

Side navigation

#4188 closed enhancement (fixed)

Opened February 19, 2009 09:50AM UTC

Closed July 16, 2009 08:33AM UTC

Last modified November 26, 2009 06:53AM UTC

.get(-n)

Reported by: rkatic Owned by:
Priority: major Milestone: 1.4
Component: core Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:
Description

Enable use of negative numbers as argument.

get: function( num ) {
    ...
    return this[ num < 0 ? this.length + num : num ];
}
Attachments (0)
Change History (6)

Changed February 23, 2009 06:38AM UTC by rkatic comment:1

eq: function( i ) {
	return i == -1 ? this.slice( i ) : this.slice( i, +i + 1 );
},

Changed March 01, 2009 02:59AM UTC by rkatic comment:2

An alternative and more optimized solution of ''eq(n)'' would be:

eq: function( i ) {
    return this.pushStack( this.get(i), 'eq', i )
}

Changed March 03, 2009 09:38AM UTC by rkatic comment:3

This last solution is not enough to handle the "out of range" case and when value is not true. So forget it.

Changed July 15, 2009 08:32AM UTC by yehuda comment:4

milestone: 1.3.21.3.3

Changed July 16, 2009 08:33AM UTC by yehuda comment:5

resolution: → fixed
status: newclosed

Resolved by #6439

Changed September 09, 2009 12:22AM UTC by john comment:6

version: 1.3.11.3.2

Landed .eq(-N) support in SVN rev [6541].