Menu: Expose the submenu indicator icon as an icon option

This commit is contained in:
kborchers 2012-07-10 00:12:39 -05:00
parent 1a22a675d8
commit db3fabedb4
3 changed files with 7 additions and 3 deletions

View File

@ -7,6 +7,7 @@ TestHelpers.commonWidgetTests( "menu", {
at: "right top" at: "right top"
}, },
role: "menu", role: "menu",
icon: "ui-icon-carat-1-e",
// callbacks // callbacks
blur: null, blur: null,

View File

@ -26,7 +26,8 @@
$( "#menu6" ).menu({ $( "#menu6" ).menu({
menus: ".menuElement", menus: ".menuElement",
select: logger select: logger,
icon: "ui-icon-carat-1-s"
}); });
}); });
</script> </script>
@ -212,7 +213,7 @@
</blockquote> </blockquote>
</div> </div>
<h2>Menu with custom markup, multi-line items</h2> <h2>Menu with custom markup, multi-line items and a custom submenu icon</h2>
<div class="menuElement" id="menu6"> <div class="menuElement" id="menu6">
<div class="address-item"> <div class="address-item">
<a href="#"> <a href="#">

View File

@ -28,6 +28,7 @@ $.widget( "ui.menu", {
at: "right top" at: "right top"
}, },
role: "menu", role: "menu",
icon: "ui-icon-carat-1-e",
// callbacks // callbacks
blur: null, blur: null,
@ -279,6 +280,7 @@ $.widget( "ui.menu", {
refresh: function() { refresh: function() {
// Initialize nested menus // Initialize nested menus
var menus, var menus,
icon = this.options.icon,
submenus = this.element.find( this.options.menus + ":not(.ui-menu)" ) submenus = this.element.find( this.options.menus + ":not(.ui-menu)" )
.addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" ) .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
.hide() .hide()
@ -318,7 +320,7 @@ $.widget( "ui.menu", {
var menu = $( this ), var menu = $( this ),
item = menu.prev( "a" ), item = menu.prev( "a" ),
submenuCarat = $( "<span>" ) submenuCarat = $( "<span>" )
.addClass( "ui-menu-icon ui-icon ui-icon-carat-1-e" ) .addClass( "ui-menu-icon ui-icon " + icon )
.data( "ui-menu-submenu-carat", true ); .data( "ui-menu-submenu-carat", true );
item item