Bug Tracker

Modify

Ticket #11720 (closed enhancement: fixed)

Opened 13 months ago

Last modified 12 months ago

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

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

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

View

Add a comment

Modify Ticket

Action
as closed
Author


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

 
Note: See TracTickets for help on using tickets.