Permalink
Browse files

Menu: Change first() and last() to isFirstItem() and isLastItem()

  • Loading branch information...
1 parent c88add2 commit f0007ec74526979837c93be13bf181b3cf57c2ce @kborchers kborchers committed Dec 23, 2011
Showing with 6 additions and 6 deletions.
  1. +2 −2 ui/jquery.ui.autocomplete.js
  2. +4 −4 ui/jquery.ui.menu.js
@@ -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;
@@ -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;
},
@@ -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() ) {
@@ -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() ) {

0 comments on commit f0007ec

Please sign in to comment.