Selectmenu: click an optgroup header should not close the menu

This commit is contained in:
Felix Nagel 2012-01-27 00:06:02 +01:00
parent 827a8cb35c
commit bef7f1b15b

View File

@ -253,7 +253,13 @@ $.widget( "ui.selectmenu", {
$.each( items, function( index, item ) {
if ( item.optgroup != currentOptgroup ) {
var optgroup = $( '<li class="ui-selectmenu-optgroup">' + item.optgroup + '</li>' );
var optgroup = $( '<li />', {
'class': 'ui-selectmenu-optgroup',
html: item.optgroup,
click: function( event ){
event.stopPropagation();
}
});
if ( item.element.parent( "optgroup" ).attr( "disabled" ) ) optgroup.addClass( 'ui-state-disabled' );
ul.append( optgroup );
currentOptgroup = item.optgroup;