@@ -280,21 +280,19 @@ $.widget("ui.selectmenu", {
280
280
281
281
// serialize selectmenu element options
282
282
var selectOptionData = [ ] ;
283
- this . element
284
- . find ( 'option' )
285
- . each ( function ( ) {
286
- var opt = $ ( this ) ;
287
- selectOptionData . push ( {
288
- value : opt . attr ( 'value' ) ,
289
- text : self . _formatText ( opt . text ( ) ) ,
290
- selected : opt . attr ( 'selected' ) ,
291
- disabled : opt . attr ( 'disabled' ) ,
292
- classes : opt . attr ( 'class' ) ,
293
- typeahead : opt . attr ( 'typeahead' ) ,
294
- parentOptGroup : opt . parent ( 'optgroup' ) ,
295
- bgImage : o . bgImage . call ( opt )
296
- } ) ;
283
+ this . element . find ( 'option' ) . each ( function ( ) {
284
+ var opt = $ ( this ) ;
285
+ selectOptionData . push ( {
286
+ value : opt . attr ( 'value' ) ,
287
+ text : self . _formatText ( opt . text ( ) ) ,
288
+ selected : opt . attr ( 'selected' ) ,
289
+ disabled : opt . attr ( 'disabled' ) ,
290
+ classes : opt . attr ( 'class' ) ,
291
+ typeahead : opt . attr ( 'typeahead' ) ,
292
+ parentOptGroup : opt . parent ( 'optgroup' ) ,
293
+ bgImage : o . bgImage . call ( opt )
297
294
} ) ;
295
+ } ) ;
298
296
299
297
// active state class is only used in popup style
300
298
var activeClass = ( self . options . style == "popup" ) ? " ui-state-active" : "" ;
@@ -478,7 +476,6 @@ $.widget("ui.selectmenu", {
478
476
_typeAhead : function ( code , eventType ) {
479
477
var self = this ,
480
478
c = String . fromCharCode ( code ) . toLowerCase ( ) ,
481
- items = this . list . find ( 'li a' ) ,
482
479
matchee = null ,
483
480
nextIndex = null ;
484
481
@@ -516,11 +513,10 @@ $.widget("ui.selectmenu", {
516
513
this . _selectedOptionLi ( ) . data ( 'index' ) :
517
514
this . _focusedOptionLi ( ) . data ( 'index' ) ) || 0 ;
518
515
519
- for ( var i = 0 ; i < items . length ; i ++ ) {
520
- var thisText = items . eq ( i ) . text ( ) . substr ( 0 , matchee . length ) . toLowerCase ( ) ;
516
+ for ( var i = 0 ; i < this . _optionLis . length ; i ++ ) {
517
+ var thisText = this . _optionLis . eq ( i ) . text ( ) . substr ( 0 , matchee . length ) . toLowerCase ( ) ;
521
518
522
519
if ( thisText === matchee ) {
523
-
524
520
if ( self . _typeAhead_cycling ) {
525
521
if ( nextIndex === null )
526
522
nextIndex = i ;
@@ -540,7 +536,7 @@ $.widget("ui.selectmenu", {
540
536
// index? Because we don't what is the exact action to do, it
541
537
// depends if the user is typing on the element or on the popped
542
538
// up menu
543
- items . eq ( nextIndex ) . trigger ( eventType ) ;
539
+ this . _optionLis . eq ( nextIndex ) . find ( "a" ) . trigger ( eventType ) ;
544
540
}
545
541
546
542
self . _typeAhead_timer = window . setTimeout ( function ( ) {
@@ -714,7 +710,7 @@ $.widget("ui.selectmenu", {
714
710
} ,
715
711
716
712
_scrollPage : function ( direction ) {
717
- var numPerPage = Math . floor ( this . list . outerHeight ( ) / this . list . find ( 'li: first' ) . outerHeight ( ) ) ;
713
+ var numPerPage = Math . floor ( this . list . outerHeight ( ) / this . _optionLis . first ( ) . outerHeight ( ) ) ;
718
714
numPerPage = ( direction == 'up' ? - numPerPage : numPerPage ) ;
719
715
this . _moveFocus ( numPerPage ) ;
720
716
} ,
0 commit comments