diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js
index 8d99272d0..3c445eca1 100644
--- a/ui/jquery.ui.menu.js
+++ b/ui/jquery.ui.menu.js
@@ -15,8 +15,6 @@
*/
(function( $, undefined ) {
-var mouseHandled = false;
-
$.widget( "ui.menu", {
version: "@VERSION",
defaultElement: "
",
@@ -40,6 +38,7 @@ $.widget( "ui.menu", {
_create: function() {
this.activeMenu = this.element;
+ this.mouseHandled = false;
this.element
.uniqueId()
.addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
@@ -73,8 +72,8 @@ $.widget( "ui.menu", {
},
"click .ui-menu-item:has(a)": function( event ) {
var target = $( event.target ).closest( ".ui-menu-item" );
- if ( !mouseHandled && target.not( ".ui-state-disabled" ).length ) {
- mouseHandled = true;
+ if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
+ this.mouseHandled = true;
this.select( event );
// Open submenu on click
@@ -130,7 +129,7 @@ $.widget( "ui.menu", {
}
// Reset the mouseHandled flag
- mouseHandled = false;
+ this.mouseHandled = false;
}
});
},