11 /*
2- * jQuery UI selectmenu dev version
2+ * jQuery UI selectmenu dev version * jQuery UI selectmenu 1.2.1 version
33 *
44 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
55 * Dual licensed under the MIT (MIT-LICENSE.txt)
@@ -40,7 +40,7 @@ $.widget("ui.selectmenu", {
4040
4141 // set a default id value, generate a new random one if not set by developer
4242 var selectmenuId = ( this . element . attr ( 'id' ) || 'ui-selectmenu-' + Math . random ( ) . toString ( 16 ) . slice ( 2 , 10 ) ) . replace ( ':' , '\\:' ) ;
43-
43+
4444 // quick array of button and menu id's
4545 this . ids = [ selectmenuId , selectmenuId + '-button' , selectmenuId + '-menu' ] ;
4646
@@ -61,7 +61,7 @@ $.widget("ui.selectmenu", {
6161 this . newelementWrap = $ ( "<span />" )
6262 . append ( this . newelement )
6363 . insertAfter ( this . element ) ;
64-
64+
6565 // transfer tabindex
6666 var tabindex = this . element . attr ( 'tabindex' ) ;
6767 if ( tabindex ) {
@@ -85,7 +85,7 @@ $.widget("ui.selectmenu", {
8585 event . preventDefault ( ) ;
8686 }
8787 } ) ;
88-
88+
8989 // click toggle for menu visibility
9090 this . newelement
9191 . bind ( 'mousedown.selectmenu' , function ( event ) {
@@ -194,7 +194,7 @@ $.widget("ui.selectmenu", {
194194 // hide original selectmenu element
195195 this . element . hide ( ) ;
196196
197- // create menu portion, append to body
197+ // create menu portion, append to body
198198 this . list = $ ( '<ul />' , {
199199 'class' : 'ui-widget ui-widget-content' ,
200200 'aria-hidden' : true ,
@@ -205,7 +205,7 @@ $.widget("ui.selectmenu", {
205205 this . listWrap = $ ( "<div />" , {
206206 'class' : self . widgetBaseClass + '-menu'
207207 } ) . append ( this . list ) . appendTo ( o . appendTo ) ;
208-
208+
209209 // transfer menu click to menu button
210210 this . list
211211 . bind ( "keydown.selectmenu" , function ( event ) {
@@ -305,7 +305,7 @@ $.widget("ui.selectmenu", {
305305 var thisLiAttr = { role : 'presentation' } ;
306306 if ( selectOptionData [ i ] . disabled ) {
307307 thisLiAttr [ 'class' ] = this . namespace + '-state-disabled' ;
308- }
308+ }
309309 var thisAAttr = {
310310 html : selectOptionData [ i ] . text || ' ' ,
311311 href : '#nogo' ,
@@ -318,10 +318,10 @@ $.widget("ui.selectmenu", {
318318 }
319319 if ( selectOptionData [ i ] . typeahead ) {
320320 thisAAttr [ 'typeahead' ] = selectOptionData [ i ] . typeahead ;
321- }
321+ }
322322 var thisA = $ ( '<a/>' , thisAAttr ) ;
323- var thisLi = $ ( '<li/>' , thisLiAttr )
324- . append ( thisA )
323+ var thisLi = $ ( '<li/>' , thisLiAttr )
324+ . append ( thisA )
325325 . data ( 'index' , i )
326326 . addClass ( selectOptionData [ i ] . classes )
327327 . data ( 'optionClasses' , selectOptionData [ i ] . classes || '' )
@@ -425,10 +425,10 @@ $.widget("ui.selectmenu", {
425425 this . list . css ( 'height' , 'auto' ) ;
426426 var listH = this . listWrap . height ( ) ;
427427 var winH = $ ( window ) . height ( ) ;
428- // calculate default max height
428+ // calculate default max height
429429 var maxH = o . maxHeight ? Math . min ( o . maxHeight , winH ) : winH / 3 ;
430- if ( listH > maxH ) this . list . height ( maxH ) ;
431-
430+ if ( listH > maxH ) this . list . height ( maxH ) ;
431+
432432 // save reference to actionable li's (not group label li's)
433433 this . _optionLis = this . list . find ( 'li:not(.' + self . widgetBaseClass + '-group)' ) ;
434434
@@ -438,10 +438,10 @@ $.widget("ui.selectmenu", {
438438 } else {
439439 this . enable ( ) ;
440440 }
441-
441+
442442 // update value
443443 this . index ( this . _selectedIndex ( ) ) ;
444-
444+
445445 // set selected item so movefocus has intial state
446446 this . _selectedOptionLi ( ) . addClass ( this . widgetBaseClass + '-item-focus' ) ;
447447
@@ -460,10 +460,10 @@ $.widget("ui.selectmenu", {
460460
461461 $ ( window ) . unbind ( ".selectmenu-" + this . ids [ 0 ] ) ;
462462 $ ( document ) . unbind ( ".selectmenu-" + this . ids [ 0 ] ) ;
463-
463+
464464 this . newelementWrap . remove ( ) ;
465465 this . listWrap . remove ( ) ;
466-
466+
467467 // unbind click event and show original select
468468 this . element
469469 . unbind ( ".selectmenu" )
@@ -561,26 +561,25 @@ $.widget("ui.selectmenu", {
561561 if ( self . newelement . attr ( "aria-disabled" ) != 'true' ) {
562562 self . _closeOthers ( event ) ;
563563 self . newelement . addClass ( 'ui-state-active' ) ;
564-
565- self . list . attr ( 'aria-hidden' , false ) ;
564+ self . list . attr ( 'aria-hidden' , false ) ;
566565 self . listWrap . addClass ( self . widgetBaseClass + '-open' ) ;
567-
566+
568567 var selected = this . _selectedOptionLi ( ) ;
569568 if ( o . style == "dropdown" ) {
570569 self . newelement . removeClass ( 'ui-corner-all' ) . addClass ( 'ui-corner-top' ) ;
571- } else {
570+ } else {
572571 // center overflow and avoid flickering
573572 this . list
574573 . css ( "left" , - 5000 )
575574 . scrollTop ( this . list . scrollTop ( ) + selected . position ( ) . top - this . list . outerHeight ( ) / 2 + selected . outerHeight ( ) / 2 )
576575 . css ( "left" , "auto" ) ;
577576 }
578-
579- self . _refreshPosition ( ) ;
580-
577+
578+ self . _refreshPosition ( ) ;
579+
581580 var link = selected . find ( "a" ) ;
582- if ( link . length ) link [ 0 ] . focus ( ) ;
583-
581+ if ( link . length ) link [ 0 ] . focus ( ) ;
582+
584583 self . isOpen = true ;
585584 self . _trigger ( "open" , event , self . _uiHash ( ) ) ;
586585 }
@@ -612,7 +611,7 @@ $.widget("ui.selectmenu", {
612611 if ( this . _disabled ( event . currentTarget ) ) { return false ; }
613612 this . _trigger ( "select" , event , this . _uiHash ( ) ) ;
614613 } ,
615-
614+
616615 widget : function ( ) {
617616 return this . listWrap . add ( this . newelementWrap ) ;
618617 } ,
@@ -631,7 +630,7 @@ $.widget("ui.selectmenu", {
631630 this . open ( event ) ;
632631 }
633632 } ,
634-
633+
635634 _formatText : function ( text ) {
636635 if ( this . options . format ) {
637636 text = this . options . format ( text ) ;
0 commit comments