Skip to content

Commit

Permalink
Menu: Change first() and last() to isFirstItem() and isLastItem()
Browse files Browse the repository at this point in the history
  • Loading branch information
kborchers committed Dec 23, 2011
1 parent c88add2 commit f0007ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions ui/jquery.ui.autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,8 @@ $.widget( "ui.autocomplete", {
this.search( null, event );
return;
}
if ( this.menu.first() && /^previous/.test(direction) ||
this.menu.last() && /^next/.test(direction) ) {
if ( this.menu.isFirstItem() && /^previous/.test(direction) ||
this.menu.isLastItem() && /^next/.test(direction) ) {
this._value( this.term );
this.menu.blur();
return;
Expand Down
8 changes: 4 additions & 4 deletions ui/jquery.ui.menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,11 +447,11 @@ $.widget( "ui.menu", {
this._move( "prev", "last", event );
},

first: function() {
isFirstItem: function() {
return this.active && !this.active.prevAll( ".ui-menu-item" ).length;
},

last: function() {
isLastItem: function() {
return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
},

Expand Down Expand Up @@ -480,7 +480,7 @@ $.widget( "ui.menu", {
this.focus( event, this.activeMenu.children( ".ui-menu-item" ).first() );
return;
}
if ( this.last() ) {
if ( this.isLastItem() ) {
return;
}
if ( this._hasScroll() ) {
Expand All @@ -504,7 +504,7 @@ $.widget( "ui.menu", {
this.focus( event, this.activeMenu.children( ".ui-menu-item" ).first() );
return;
}
if ( this.first() ) {
if ( this.isFirstItem() ) {
return;
}
if ( this._hasScroll() ) {
Expand Down

0 comments on commit f0007ec

Please sign in to comment.