Selectmenu: improve element creation

This commit is contained in:
Felix Nagel 2013-01-02 19:52:18 +01:00
parent 1ba02e9c5f
commit c9602857dd

View File

@ -229,7 +229,7 @@ $.widget( "ui.selectmenu", {
$.each( items, function( index, item ) { $.each( items, function( index, item ) {
if ( item.optgroup !== currentOptgroup ) { if ( item.optgroup !== currentOptgroup ) {
$( "<li />", { $( "<li>", {
"class": "ui-selectmenu-optgroup" + ( item.element.parent( "optgroup" ).attr( "disabled" ) ? " ui-state-disabled" : "" ), "class": "ui-selectmenu-optgroup" + ( item.element.parent( "optgroup" ).attr( "disabled" ) ? " ui-state-disabled" : "" ),
text: item.optgroup text: item.optgroup
}).appendTo( ul ); }).appendTo( ul );
@ -240,8 +240,8 @@ $.widget( "ui.selectmenu", {
}, },
_renderItem: function( ul, item ) { _renderItem: function( ul, item ) {
var li = $( "<li />" ).data( "ui-selectmenu-item", item ), var li = $( "<li>" ).data( "ui-selectmenu-item", item ),
a = $( "<a />", { href: "#" }); a = $( "<a>", { href: "#" });
if ( item.disabled ) { if ( item.disabled ) {
li.addClass( "ui-state-disabled" ); li.addClass( "ui-state-disabled" );