aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.menu.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/jquery.ui.menu.js')
-rw-r--r--ui/jquery.ui.menu.js23
1 files changed, 12 insertions, 11 deletions
diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js
index 9cb6afe32..455a12184 100644
--- a/ui/jquery.ui.menu.js
+++ b/ui/jquery.ui.menu.js
@@ -20,6 +20,7 @@ $.widget( "ui.menu", {
defaultElement: "<ul>",
delay: 150,
options: {
+ items: "ul",
position: {
my: "left top",
at: "right top"
@@ -194,7 +195,7 @@ $.widget( "ui.menu", {
//destroy (sub)menus
this.element
.removeAttr( "aria-activedescendant" )
- .find( "ul" )
+ .find( ".ui-menu" )
.andSelf()
.removeClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
.removeAttr( "role" )
@@ -221,7 +222,7 @@ $.widget( "ui.menu", {
refresh: function() {
// initialize nested menus
- var submenus = this.element.find( "ul:not(.ui-menu)" )
+ var submenus = this.element.find( this.options.items + ":not( .ui-menu )" )
.addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
.attr( "role", "menu" )
.hide()
@@ -230,7 +231,7 @@ $.widget( "ui.menu", {
// don't refresh list items that are already adapted
var menuId = this.menuId;
- submenus.add( this.element ).children( "li:not(.ui-menu-item):has(a)" )
+ submenus.add( this.element ).children( ":not( .ui-menu-item ):has( a )" )
.addClass( "ui-menu-item" )
.attr( "role", "presentation" )
.children( "a" )
@@ -273,16 +274,16 @@ $.widget( "ui.menu", {
.children( "a" )
.addClass( "ui-state-focus" )
.end();
- this.element.attr( "aria-activedescendant", this.active.children("a").attr("id") );
+ this.element.attr( "aria-activedescendant", this.active.children( "a" ).attr( "id" ) );
// highlight active parent menu item, if any
- this.active.parent().closest(".ui-menu-item").children("a:first").addClass("ui-state-active");
+ this.active.parent().closest( ".ui-menu-item" ).children( "a:first" ).addClass( "ui-state-active" );
this.timer = this._delay( function() {
this._close();
}, this.delay );
- var nested = $( ">ul", item );
+ var nested = $( "> .ui-menu", item );
if ( nested.length && ( /^mouse/.test( event.type ) ) ) {
this._startOpening(nested);
}
@@ -353,19 +354,19 @@ $.widget( "ui.menu", {
this._close( currentMenu );
- if( !currentMenu ) {
+ if ( !currentMenu ) {
this.blur( event );
this.activeMenu = this.element;
}
},
_close: function( startMenu ) {
- if( !startMenu ) {
+ if ( !startMenu ) {
startMenu = this.active ? this.active.parent() : this.element;
}
startMenu
- .find( "ul" )
+ .find( ".ui-menu" )
.hide()
.attr( "aria-hidden", "true" )
.attr( "aria-expanded", "false" )
@@ -375,7 +376,7 @@ $.widget( "ui.menu", {
},
collapse: function( event ) {
- var newItem = this.active && this.active.parents("li:not(.ui-menubar-item)").first();
+ var newItem = this.active && this.active.parent().closest( ".ui-menu-item", this.element );
if ( newItem && newItem.length ) {
this._close();
this.focus( event, newItem );
@@ -384,7 +385,7 @@ $.widget( "ui.menu", {
},
expand: function( event ) {
- var newItem = this.active && this.active.children("ul").children("li").first();
+ var newItem = this.active && this.active.children( ".ui-menu " ).children( ".ui-menu-item" ).first();
if ( newItem && newItem.length ) {
this._open( newItem.parent() );