Bug Tracker


Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#10616 closed bug (fixed)

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:


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 +.)

Change History (7)

comment:2 Changed 5 years ago by rwaldron

  • Component changed from unfiled to core
  • Owner set to rwaldron
  • Priority changed from undecided to low
  • Status changed from new to assigned

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

patch to follow

Last edited 5 years ago by rwaldron (previous) (diff)

comment:3 Changed 5 years ago by rwaldron

  • Milestone changed from None to 1.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.


comment:4 Changed 5 years ago by anonymous

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

comment:5 Changed 5 years ago by rwaldron

The patch fixes coercion support

comment:6 Changed 5 years ago by Rick Waldron

  • Resolution set to fixed
  • Status changed from assigned to closed

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

Changeset: 7cbd7a640fb6590b0eb7cbedd83a8d46eb553c5a

comment:7 Changed 5 years ago by dmethvin

  • Milestone changed from 1.next to 1.7.1

Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Modify Ticket

Change Properties

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.