Ticket #11720 (closed enhancement: fixed)
Simplify jQuery.nth
| Reported by: | anonymous | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | None |
| Component: | traversing | Version: | git |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
Since jQuery.nth is not a documented function and only used internally, its code could be simplified. It is only called at two places:
next: function( elem ) {
return jQuery.nth( elem, 2, "nextSibling" );
},
prev: function( elem ) {
return jQuery.nth( elem, 2, "previousSibling" );
},
The second argument could be removed and inlined, so that jQuery.nth can be simplified a fair bit.
Change History
comment:1 Changed 13 months ago by sindresorhus
- Priority changed from undecided to low
- Component changed from unfiled to traversing
comment:2 Changed 13 months ago by rwaldron
- Status changed from new to closed
- Resolution set to fixed
Landed. https://github.com/jquery/jquery/commit/fbee36be16e155cc1384f34a35b455c2413ea94d
Also, sorry about the merge commit.
comment:3 Changed 12 months ago by Sindre Sorhus
Remove unnecessary arguments from .nth(). Fixes #11720
Also use postfix increment to make it a little clearer.
Changeset: 4de7b5412e33331ca6f9f8a2d6e5e00dec7299f2
comment:4 Changed 12 months ago by Rick Waldron
Merge branch 'bug11720-nth-argument' of https://github.com/sindresorhus/jquery into 1.8pre
- 'bug11720-nth-argument' of https://github.com/sindresorhus/jquery: Remove unnecessary arguments from .nth(). Fixes #11720 Changeset: fbee36be16e155cc1384f34a35b455c2413ea94d
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

PR: https://github.com/jquery/jquery/pull/769