Return correct index for no-arg index() calls. Fixes #10977. Closes gh-971

This commit is contained in:
MORGAN
2012-10-16 10:25:08 -04:00
committed by Rick Waldron
parent ed9e34482a
commit 4bb46f413a
2 changed files with 10 additions and 1 deletions

View File

@@ -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