Skip to main content

Bug Tracker

Side navigation

#10616 closed bug (fixed)

Opened October 29, 2011 01:22PM UTC

Closed November 06, 2011 09:21PM UTC

Last modified November 06, 2011 10:05PM UTC

Type coersion not done for -1 in .eq

Reported by: anonymous Owned by: rwaldron
Priority: low Milestone: 1.7.1
Component: core Version: 1.7b2
Keywords: Cc:
Blocked by: Blocking:
Description

Test case: http://jsfiddle.net/pimvdb/NZdAa/1/

Proposed fix:

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

instead of

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

(Notice the extra +.)

Attachments (0)
Change History (7)

Changed October 29, 2011 01:24PM UTC by anonymous comment:1

Changed October 29, 2011 02:16PM UTC by rwaldron comment:2

_comment0: Another perspective on the test case: http://jsfiddle.net/rwaldron/NZdAa/4/1319897810324125
component: unfiledcore
owner: → rwaldron
priority: undecidedlow
status: newassigned

Another perspective on the test case: http://jsfiddle.net/rwaldron/NZdAa/4/

patch to follow

Changed October 30, 2011 05:15PM UTC by rwaldron comment:3

milestone: None1.next

Regardless of whether or not type coercion occurs within this function's body, the documented api says "index" which it defines as an "integer", but not as a string.

https://github.com/jquery/jquery/pull/568

Changed November 05, 2011 09:50AM UTC by anonymous comment:4

Yes, I guess removing type coercion altogether would not be a bad idea.

Changed November 05, 2011 01:39PM UTC by rwaldron comment:5

The patch fixes coercion support

Changed November 06, 2011 09:21PM UTC by Rick Waldron comment:6

resolution: → fixed
status: assignedclosed

Coerce eq() argument all the time. Fixes #10616

Changeset: 7cbd7a640fb6590b0eb7cbedd83a8d46eb553c5a

Changed November 06, 2011 10:05PM UTC by dmethvin comment:7

milestone: 1.next1.7.1