55 */
66( function ( $ ) {
77
8+ // TODO take non-menubar buttons into account
89$ . widget ( "ui.menubar" , {
910 _create : function ( ) {
1011 var self = this ;
1112 var items = this . element . children ( "button, a" ) ;
1213 items . next ( "ul" ) . each ( function ( i , elm ) {
13- $ ( elm ) . flyoutmenu ( {
14- select : self . options . select
15- } ) . hide ( ) . addClass ( "ui-menu-flyout" ) . keydown ( function ( event ) {
14+ $ ( elm ) . menu ( {
15+ select : function ( event , ui ) {
16+ ui . item . parents ( "ul:last" ) . hide ( )
17+ self . options . select . apply ( this , arguments ) ;
18+ }
19+ } ) . hide ( ) . keydown ( function ( event ) {
1620 var menu = $ ( this ) ;
1721 if ( menu . is ( ":hidden" ) )
1822 return ;
@@ -54,8 +58,8 @@ $.widget("ui.menubar", {
5458 } ,
5559
5660 _open : function ( event , menu ) {
57- this . active && this . active . flyoutmenu ( "hide" ) ;
58- this . active = menu . flyoutmenu ( " show" ) . position ( {
61+ this . active && this . active . menu ( "closeAll" ) . hide ( ) ;
62+ this . active = menu . show ( ) . position ( {
5963 my : "left top" ,
6064 at : "left bottom" ,
6165 offset : "0 -1" ,
@@ -64,20 +68,20 @@ $.widget("ui.menubar", {
6468 } ,
6569
6670 left : function ( event ) {
67- var prev = this . active . prevAll ( ".ui-menu-flyout " ) . eq ( 0 ) ;
71+ var prev = this . active . prevAll ( ".ui-menu" ) . eq ( 0 ) ;
6872 if ( prev . length ) {
6973 this . _open ( event , prev ) ;
7074 } else {
71- this . _open ( event , this . element . children ( ".ui-menu-flyout :last" ) ) ;
75+ this . _open ( event , this . element . children ( ".ui-menu:last" ) ) ;
7276 }
7377 } ,
7478
7579 right : function ( event ) {
76- var next = this . active . nextAll ( ".ui-menu-flyout " ) . eq ( 0 ) ;
80+ var next = this . active . nextAll ( ".ui-menu" ) . eq ( 0 ) ;
7781 if ( next . length ) {
7882 this . _open ( event , next ) ;
7983 } else {
80- this . _open ( event , this . element . children ( ".ui-menu-flyout :first" ) ) ;
84+ this . _open ( event , this . element . children ( ".ui-menu:first" ) ) ;
8185 }
8286 }
8387} ) ;
0 commit comments