Skip to main content

Bug Tracker

Side navigation

#11720 closed enhancement (fixed)

Opened May 07, 2012 03:24PM UTC

Closed May 07, 2012 07:53PM UTC

Last modified May 16, 2012 06:05PM UTC

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.

Attachments (0)
Change History (4)

Changed May 07, 2012 06:52PM UTC by sindresorhus comment:1

component: unfiledtraversing
priority: undecidedlow

Changed May 07, 2012 07:53PM UTC by rwaldron comment:2

resolution: → fixed
status: newclosed

Changed May 16, 2012 06:05PM UTC by Sindre Sorhus comment:3

Remove unnecessary arguments from .nth(). Fixes #11720

Also use postfix increment to make it a little clearer.

Changeset: 4de7b5412e33331ca6f9f8a2d6e5e00dec7299f2

Changed May 16, 2012 06:05PM UTC by Rick Waldron comment:4

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

Remove unnecessary arguments from .nth(). Fixes #11720

Changeset: fbee36be16e155cc1384f34a35b455c2413ea94d