Bug Tracker

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#11720 closed enhancement (fixed)

Simplify jQuery.nth

Reported by: anonymous Owned by:
Priority: low Milestone: None
Component: traversing Version: git
Keywords: Cc:
Blocked by: Blocking:

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 (4)

comment:1 Changed 11 years ago by sindresorhus

Component: unfiledtraversing
Priority: undecidedlow

comment:2 Changed 11 years ago by Rick Waldron

Resolution: fixed
Status: newclosed

comment:3 Changed 11 years 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 11 years ago by Rick Waldron

Merge branch 'bug11720-nth-argument' of https://github.com/sindresorhus/jquery into 1.8pre

Note: See TracTickets for help on using tickets.