From ceaacdf1a490bb929d59d49f832ada6e7b60d20e Mon Sep 17 00:00:00 2001 From: Felix Nagel Date: Wed, 3 Aug 2011 00:56:16 +0200 Subject: [PATCH] changed: li element creation, thx to @lephyrius, see selectOptionData[ i ].disabled --- ui/jquery.ui.selectmenu.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index 5e7848eff..463a33cab 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -270,7 +270,7 @@ $.widget("ui.selectmenu", { var opt = $(this); selectOptionData.push({ value: opt.attr('value'), - text: self._formatText($(this).text()), + text: self._formatText(opt.text()), selected: opt.attr('selected'), disabled: opt.attr('disabled'), classes: opt.attr('class'), @@ -289,7 +289,26 @@ $.widget("ui.selectmenu", { // write li's if (selectOptionData.length) { for (var i = 0; i < selectOptionData.length; i++) { - var thisLi = $('') + var thisLiAttr = { role : 'presentation' }; + if ( selectOptionData[ i ].disabled ) { + thisLiAttr[ 'class' ] = this.namespace + '-state-disabled'; + } + var thisAAttr = { + html: selectOptionData[i].text, + href : '#', + tabindex : -1, + role : 'option', + 'aria-selected' : false + }; + if ( selectOptionData[ i ].disabled ) { + thisAAttr[ 'aria-disabled' ] = selectOptionData[ i ].disabled; + } + if ( selectOptionData[ i ].typeahead ) { + thisAAttr[ 'typeahead' ] = selectOptionData[ i ].typeahead; + } + var thisA = $('', thisAAttr); + var thisLi = $('
  • ', thisLiAttr) + .append(thisA) .data('index', i) .addClass(selectOptionData[i].classes) .data('optionClasses', selectOptionData[i].classes || '') -- 2.39.5