Side navigation
#5476 closed enhancement (fixed)
Opened November 09, 2009 04:21PM UTC
Closed December 06, 2010 10:05PM UTC
Prevent get(-1) to create a new jQuery object
Reported by: | rkatic | Owned by: | jitter |
---|---|---|---|
Priority: | high | Milestone: | 1.5 |
Component: | core | Version: | 1.4.4 |
Keywords: | get, slice | Cc: | |
Blocked by: | Blocking: |
Description
Instead of
( num < 0 ? this.slice(num)[ 0 ] : this[ num ] );
you will write
( num < 0 ? slice.call(this, num)[ 0 ] : this[ num ] );
or even better (for me)
( num < 0 ? this[ this.length - num ] : this[ num ] );
Attachments (0)
Change History (7)
Changed November 09, 2009 04:45PM UTC by comment:1
Changed November 19, 2010 06:43AM UTC by comment:2
owner: | → rkatic |
---|---|
status: | new → pending |
Sorry, what is the issue here? What use case is there for this?
Changed November 19, 2010 06:58AM UTC by comment:3
status: | pending → new |
---|
.get(Number) returns a single element. It is unnecessary and relatively expensive to create a new jQuery object calling .slice() only to get a single value.
Changed November 19, 2010 12:00PM UTC by comment:4
_comment0: | [https://github.com/jquery/jquery/pull/102 pull request] \ \ [http://jsperf.com/tetete2 performance comparision] \ \ [http://www.jsfiddle.net/jitter/4kKFJ/ test case] which shows `get()` new vs old → 1290381570500074 |
---|---|
milestone: | → 1.5 |
priority: | major → high |
status: | new → open |
version: | 1.3.2 → 1.4.4 |
Changed November 21, 2010 10:10PM UTC by comment:5
owner: | rkatic → jitter |
---|---|
status: | open → assigned |
Changed December 06, 2010 10:05PM UTC by comment:6
milestone: | 1.5 → 1.4.5 |
---|---|
resolution: | → fixed |
status: | assigned → closed |
Landed.
Changed January 14, 2011 10:20PM UTC by comment:7
milestone: | 1.4.5 → 1.5 |
---|
Move fixed tickets to appropriate milestone
oops, wrong sign