From 4bb46f413a0e2f6933013b26d2aceddca6cf03f1 Mon Sep 17 00:00:00 2001 From: MORGAN Date: Tue, 16 Oct 2012 10:25:08 -0400 Subject: Return correct index for no-arg index() calls. Fixes #10977. Closes gh-971 --- src/traversing.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/traversing.js') diff --git a/src/traversing.js b/src/traversing.js index 4c58ae0b8..d92bec4cb 100644 --- a/src/traversing.js +++ b/src/traversing.js @@ -112,7 +112,7 @@ jQuery.fn.extend({ // No argument, return index in parent if ( !elem ) { - return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; + return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; } // index in selector -- cgit v1.2.3