From 255d4f6d0a3394102d04bf0e3cdd9bea14c0bf03 Mon Sep 17 00:00:00 2001 From: Felix Nagel Date: Tue, 30 Apr 2013 23:40:53 +0200 Subject: Selectmenu; improve HTML building in custom render demo --- demos/selectmenu/custom_render.html | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'demos') diff --git a/demos/selectmenu/custom_render.html b/demos/selectmenu/custom_render.html index 03f873d19..941c94da6 100644 --- a/demos/selectmenu/custom_render.html +++ b/demos/selectmenu/custom_render.html @@ -15,23 +15,20 @@ $(function() { $.widget( "custom.iconselectmenu", $.ui.selectmenu, { _renderItem: function( ul, item ) { - var element, span, + var a, span, li = $( "
  • " ); if ( item.disabled ) { li.addClass( "ui-state-disabled" ).text( item.label ); } else { - element = item.element; + a = $( "", { + text: item.label, + href: "#" + }).appendTo( li ); span = $( "", { - style: element.attr( "style" ), - "class": "ui-icon " + element.attr( "class" ) - }); - $( "", { - text: item.label, - href: "#" - }) - .append( span ) - .appendTo( li ); + style: item.element.attr( "style" ), + "class": "ui-icon " + item.element.attr( "class" ) + }).appendTo( a ); } return li.appendTo( ul ); -- cgit v1.2.3