diff options
-rw-r--r-- | themes/base/jquery.ui.selectmenu.css | 4 | ||||
-rw-r--r-- | ui/jquery.ui.selectmenu.js | 36 |
2 files changed, 16 insertions, 24 deletions
diff --git a/themes/base/jquery.ui.selectmenu.css b/themes/base/jquery.ui.selectmenu.css index ff45c11cf..d2c65bc77 100644 --- a/themes/base/jquery.ui.selectmenu.css +++ b/themes/base/jquery.ui.selectmenu.css @@ -6,7 +6,6 @@ .ui-selectmenu-menu ul { padding:0; margin:0; list-style:none; position: relative; overflow: auto; overflow-y: auto ; overflow-x: hidden; } .ui-selectmenu-open { display: block; } .ui-selectmenu-menu-popup { margin-top: -1px; } -.ui-selectmenu-menu-dropdown { } .ui-selectmenu-menu li { padding:0; margin:0; display: block; border-top: 1px dotted transparent; border-bottom: 1px dotted transparent; border-right-width: 0 !important; border-left-width: 0 !important; font-weight: normal !important; } .ui-selectmenu-menu li a,.ui-selectmenu-status { line-height: 1.4em; display: block; padding: .405em 2.1em .405em 1em; outline:none; text-decoration:none; } .ui-selectmenu-menu li.ui-state-disabled a, .ui-state-disabled { cursor: default; } @@ -14,11 +13,8 @@ .ui-selectmenu-hasIcon .ui-selectmenu-status { padding-left: 20px; position: relative; margin-left: 5px; } .ui-selectmenu-menu li .ui-icon, .ui-selectmenu-status .ui-icon { position: absolute; top: 1em; margin-top: -8px; left: 0; } .ui-selectmenu-status { line-height: 1.4em; } -.ui-selectmenu-open li.ui-selectmenu-item-focus a { } -.ui-selectmenu-open li.ui-selectmenu-item-selected { } .ui-selectmenu-menu li span,.ui-selectmenu-status span { display:block; margin-bottom: .2em; } .ui-selectmenu-menu li .ui-selectmenu-item-header { font-weight: bold; } -.ui-selectmenu-menu li .ui-selectmenu-item-content { } .ui-selectmenu-menu li .ui-selectmenu-item-footer { opacity: .8; } /* for optgroups */ .ui-selectmenu-menu .ui-selectmenu-group { font-size: 1em; } diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index ea96869cb..14ff857b6 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -280,21 +280,19 @@ $.widget("ui.selectmenu", { // serialize selectmenu element options var selectOptionData = []; - this.element - .find('option') - .each(function() { - var opt = $(this); - selectOptionData.push({ - value: opt.attr('value'), - text: self._formatText(opt.text()), - selected: opt.attr('selected'), - disabled: opt.attr('disabled'), - classes: opt.attr('class'), - typeahead: opt.attr('typeahead'), - parentOptGroup: opt.parent('optgroup'), - bgImage: o.bgImage.call(opt) - }); + this.element.find('option').each(function() { + var opt = $(this); + selectOptionData.push({ + value: opt.attr('value'), + text: self._formatText(opt.text()), + selected: opt.attr('selected'), + disabled: opt.attr('disabled'), + classes: opt.attr('class'), + typeahead: opt.attr('typeahead'), + parentOptGroup: opt.parent('optgroup'), + bgImage: o.bgImage.call(opt) }); + }); // active state class is only used in popup style var activeClass = (self.options.style == "popup") ? " ui-state-active" : ""; @@ -478,7 +476,6 @@ $.widget("ui.selectmenu", { _typeAhead: function( code, eventType ) { var self = this, c = String.fromCharCode(code).toLowerCase(), - items = this.list.find( 'li a' ), matchee = null, nextIndex = null; @@ -516,11 +513,10 @@ $.widget("ui.selectmenu", { this._selectedOptionLi().data('index') : this._focusedOptionLi().data('index')) || 0; - for (var i = 0; i < items.length; i++) { - var thisText = items.eq(i).text().substr(0, matchee.length).toLowerCase(); + for (var i = 0; i < this._optionLis.length; i++) { + var thisText = this._optionLis.eq(i).text().substr(0, matchee.length).toLowerCase(); if ( thisText === matchee ) { - if ( self._typeAhead_cycling ) { if ( nextIndex === null ) nextIndex = i; @@ -540,7 +536,7 @@ $.widget("ui.selectmenu", { // index? Because we don't what is the exact action to do, it // depends if the user is typing on the element or on the popped // up menu - items.eq(nextIndex).trigger( eventType ); + this._optionLis.eq(nextIndex).find("a").trigger( eventType ); } self._typeAhead_timer = window.setTimeout(function() { @@ -714,7 +710,7 @@ $.widget("ui.selectmenu", { }, _scrollPage: function(direction) { - var numPerPage = Math.floor(this.list.outerHeight() / this.list.find('li:first').outerHeight()); + var numPerPage = Math.floor(this.list.outerHeight() / this._optionLis.first().outerHeight()); numPerPage = (direction == 'up' ? -numPerPage : numPerPage); this._moveFocus(numPerPage); }, |