#10616 closed bug (fixed)
Type coersion not done for -1 in .eq
Reported by: | anonymous | Owned by: | Rick Waldron |
---|---|---|---|
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 +.)
Change History (7)
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
Component: | unfiled → core |
---|---|
Owner: | set to Rick Waldron |
Priority: | undecided → low |
Status: | new → assigned |
Another perspective on the test case: http://jsfiddle.net/rwaldron/NZdAa/4/
patch to follow
comment:3 Changed 12 years ago by
Milestone: | None → 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 12 years ago by
Yes, I guess removing type coercion altogether would not be a bad idea.
comment:6 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Coerce eq() argument all the time. Fixes #10616
Changeset: 7cbd7a640fb6590b0eb7cbedd83a8d46eb553c5a
comment:7 Changed 12 years ago by
Milestone: | 1.next → 1.7.1 |
---|
Note: See
TracTickets for help on using
tickets.
Please see http://stackoverflow.com/questions/7939087/understanding-jquerys-eq/7939099#7939099 for further discussion.