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

This commit is contained in:
kborchers 2011-12-23 09:48:14 -06:00
parent c88add2269
commit f0007ec745
2 changed files with 6 additions and 6 deletions

View File

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

View File

@ -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() ) {