Menu: Rename activate to focus and deactivate to blur method

This commit is contained in:
jzaefferer 2011-02-24 10:06:08 +01:00
parent d7682daaa8
commit 0d659d44c3
5 changed files with 21 additions and 21 deletions

View File

@ -32,7 +32,7 @@
menu.hide();
return false;
}
menu.menu("deactivate").show().css({top:0, left:0}).position({
menu.menu("blur").show().position({
my: "left top",
at: "right top",
of: this

View File

@ -30,7 +30,7 @@
}).click(function(event) {
// TODO required to prevent the click handler below from handling this event
event.stopPropagation();
var menu = $("#menu" + this.id).menu("deactivate").show().position({
var menu = $("#menu" + this.id).menu("blur").show().position({
my: "left top",
at: "right top",
of: event.pageX > 0 ? event : this
@ -72,7 +72,7 @@
});
}
if (match.length) {
menu.activate(event, match);
menu.focus(event, match);
if (match.length > 1) {
menu.previousFilter = character;
menu.filterTimer = setTimeout(function() {

View File

@ -108,7 +108,7 @@
var nested = this.activeItem.find(">ul");
if (nested.length) {
this._open(nested);
nested.menu("activate", event, nested.children(":first"))
nested.menu("focus", event, nested.children(":first"))
}
},
@ -185,7 +185,7 @@
});
}
if (match.length) {
menu.activate(event, match);
menu.focus(event, match);
if (match.length > 1) {
menu.previousFilter = character;
menu.filterTimer = setTimeout(function() {

View File

@ -135,7 +135,7 @@ $.widget("ui.flyoutmenu", {
activate: function(event, item) {
if (item) {
item.parent().data("menu").widget().show();
item.parent().data("menu").activate(event, item);
item.parent().data("menu").focus(event, item);
}
this.activeItem = item;
this.active = item.parent("ul")
@ -147,7 +147,7 @@ $.widget("ui.flyoutmenu", {
},
hide: function() {
this.activeItem = this.element.children("li").first();
this.element.find("ul").andSelf().menu("deactivate").hide();
this.element.find("ul").andSelf().menu("blur").hide();
}
});

28
ui/jquery.ui.menu.js vendored
View File

@ -43,7 +43,7 @@ $.widget("ui.menu", {
}
var target = $( event.target ).closest( ".ui-menu-item" );
if ( target.length && target.parent()[0] === self.element[0] ) {
self.activate( event, target );
self.focus( event, target );
}
})
.bind("mouseout.menu", function( event ) {
@ -52,7 +52,7 @@ $.widget("ui.menu", {
}
var target = $( event.target ).closest( ".ui-menu-item" );
if ( target.length && target.parent()[0] === self.element[0] ) {
self.deactivate( event );
self.blur( event );
}
});
this.refresh();
@ -118,9 +118,9 @@ $.widget("ui.menu", {
.attr( "tabIndex", -1 );
},
activate: function( event, item ) {
focus: function( event, item ) {
var self = this;
this.deactivate();
this.blur();
if ( this._hasScroll() ) {
var borderTop = parseFloat( $.curCSS( this.element[0], "borderTopWidth", true) ) || 0,
paddingtop = parseFloat( $.curCSS( this.element[0], "paddingTop", true) ) || 0,
@ -147,7 +147,7 @@ $.widget("ui.menu", {
this._trigger( "focus", event, { item: item } );
},
deactivate: function(event) {
blur: function(event) {
if (!this.active) {
return;
}
@ -179,21 +179,21 @@ $.widget("ui.menu", {
_move: function(direction, edge, filter, event) {
if ( !this.active ) {
this.activate( event, this.element.children(edge)[filter]() );
this.focus( event, this.element.children(edge)[filter]() );
return;
}
var next = this.active[ direction + "All" ]( ".ui-menu-item" ).eq( 0 );
if ( next.length ) {
this.activate( event, next );
this.focus( event, next );
} else {
this.activate( event, this.element.children(edge)[filter]() );
this.focus( event, this.element.children(edge)[filter]() );
}
},
nextPage: function( event ) {
if ( this._hasScroll() ) {
if ( !this.active || this.last() ) {
this.activate( event, this.element.children( ".ui-menu-item" ).first() );
this.focus( event, this.element.children( ".ui-menu-item" ).first() );
return;
}
var base = this.active.offset().top,
@ -204,9 +204,9 @@ $.widget("ui.menu", {
return $( this ).offset().top - base - height < 0;
});
this.activate( event, result );
this.focus( event, result );
} else {
this.activate( event, this.element.children( ".ui-menu-item" )
this.focus( event, this.element.children( ".ui-menu-item" )
[ !this.active || this.last() ? "first" : "last" ]() );
}
},
@ -214,7 +214,7 @@ $.widget("ui.menu", {
previousPage: function( event ) {
if ( this._hasScroll() ) {
if ( !this.active || this.first() ) {
this.activate( event, this.element.children( ".ui-menu-item" ).last() );
this.focus( event, this.element.children( ".ui-menu-item" ).last() );
return;
}
@ -226,9 +226,9 @@ $.widget("ui.menu", {
return $(this).offset().top - base + height > 0;
});
this.activate( event, result );
this.focus( event, result );
} else {
this.activate( event, this.element.children( ".ui-menu-item" )
this.focus( event, this.element.children( ".ui-menu-item" )
[ !this.active || this.first() ? ":last" : ":first" ]() );
}
},