From 0d659d44c3a95ff380ec88c7338ef270bf04683c Mon Sep 17 00:00:00 2001 From: jzaefferer Date: Thu, 24 Feb 2011 10:06:08 +0100 Subject: [PATCH] Menu: Rename activate to focus and deactivate to blur method --- demos/menu/contextmenu.html | 2 +- tests/visual/menu/contextmenu.html | 4 ++-- tests/visual/menu/drilldown.html | 4 ++-- tests/visual/menu/flyoutmenu.js | 4 ++-- ui/jquery.ui.menu.js | 28 ++++++++++++++-------------- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/demos/menu/contextmenu.html b/demos/menu/contextmenu.html index f54c50d56..1fa4daaeb 100644 --- a/demos/menu/contextmenu.html +++ b/demos/menu/contextmenu.html @@ -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 diff --git a/tests/visual/menu/contextmenu.html b/tests/visual/menu/contextmenu.html index 68fdd5234..03e21fdc3 100644 --- a/tests/visual/menu/contextmenu.html +++ b/tests/visual/menu/contextmenu.html @@ -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() { diff --git a/tests/visual/menu/drilldown.html b/tests/visual/menu/drilldown.html index 65cdf1111..572c1765b 100644 --- a/tests/visual/menu/drilldown.html +++ b/tests/visual/menu/drilldown.html @@ -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() { diff --git a/tests/visual/menu/flyoutmenu.js b/tests/visual/menu/flyoutmenu.js index bffecea7f..2599d105b 100644 --- a/tests/visual/menu/flyoutmenu.js +++ b/tests/visual/menu/flyoutmenu.js @@ -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(); } }); diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js index c6c557134..579610405 100644 --- a/ui/jquery.ui.menu.js +++ b/ui/jquery.ui.menu.js @@ -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" ]() ); } },