@@ -49,8 +49,8 @@ $.widget( "mobile.selectmenu", $.mobile.selectmenu, {
49
49
} ,
50
50
51
51
_handleSelectFocus : function ( ) {
52
- this . element . blur ( ) ;
53
- this . button . focus ( ) ;
52
+ // this.element.blur();
53
+ // this.button.focus();
54
54
} ,
55
55
56
56
_handleKeydown : function ( event ) {
@@ -64,15 +64,54 @@ $.widget( "mobile.selectmenu", $.mobile.selectmenu, {
64
64
}
65
65
66
66
if ( event . type === "vclick" ||
67
- event . keyCode && ( event . keyCode === $ . mobile . keyCode . ENTER || event . keyCode === $ . mobile . keyCode . SPACE ) ) {
67
+ event . keyCode && ( event . keyCode === $ . mobile . keyCode . ENTER ||
68
+ event . keyCode === $ . mobile . keyCode . SPACE ) ) {
68
69
69
70
this . _decideFormat ( ) ;
70
71
if ( this . menuType === "overlay" ) {
71
72
this . button . attr ( "href" , "#" + this . popupId ) . attr ( "data-" + ( $ . mobile . ns || "" ) + "rel" , "popup" ) ;
73
+ this . isOpen = true ;
74
+ } else if ( this . element [ 0 ] . multiple ) {
75
+ this . element . css ( {
76
+ "height" : "auto" ,
77
+ "max-height" : "10000px" ,
78
+ "min-height" : "0"
79
+ } )
80
+ var isSoft = ( this . element . height ( ) < 40 ) ;
81
+ if ( ! isSoft ) {
82
+ this . element . css ( {
83
+ "opacity" : "1" ,
84
+ } ) ;
85
+ //this.element.attr( "size", "5" );
86
+ this . element . appendTo ( this . button ) ;
87
+ this . button . innerHeight ( this . element . height ( ) ) ;
88
+ this . element . focus ( ) ;
89
+ this . _on ( this . document , {
90
+ "click" : function ( event ) {
91
+ if ( event . target . nodeName !== "OPTION" ) {
92
+ this . element . css ( {
93
+ "opacity" :"0" ,
94
+ "height" :"auto" ,
95
+ "max-height" : "100%"
96
+ } )
97
+ this . button . height ( "auto" ) ;
98
+ this . _off ( this . document , "click" ) ;
99
+ }
100
+ }
101
+ } )
102
+
103
+ } else {
104
+ this . _destroy ( ) ;
105
+ this . options . nativeMenu = true ;
106
+ this . _create ( ) ;
107
+ }
72
108
} else {
73
- this . button . attr ( "href" , "#" + this . dialogId ) . attr ( "data-" + ( $ . mobile . ns || "" ) + "rel" , "dialog" ) ;
109
+ this . _destroy ( ) ;
110
+ this . options . nativeMenu = true ;
111
+ this . _create ( ) ;
112
+ //return false;
113
+ //this.button.attr( "href", "#" + this.dialogId ).attr( "data-" + ( $.mobile.ns || "" ) + "rel", "dialog" );
74
114
}
75
- this . isOpen = true ;
76
115
// Do not prevent default, so the navigation may have a chance to actually open the chosen format
77
116
}
78
117
} ,
@@ -364,40 +403,15 @@ $.widget( "mobile.selectmenu", $.mobile.selectmenu, {
364
403
} ,
365
404
366
405
_decideFormat : function ( ) {
367
- var self = this ,
406
+ var self = this , options , iconpos ,
368
407
$window = this . window ,
369
408
selfListParent = self . list . parent ( ) ,
370
409
menuHeight = selfListParent . outerHeight ( ) ,
371
- scrollTop = $window . scrollTop ( ) ,
372
- btnOffset = self . button . offset ( ) . top ,
373
410
screenHeight = $window . height ( ) ;
374
411
375
412
if ( menuHeight > screenHeight - 80 || ! $ . support . scrollTop ) {
376
-
377
- self . menuPage . appendTo ( $ . mobile . pageContainer ) . page ( ) ;
378
- self . menuPageContent = self . menuPage . find ( ".ui-content" ) ;
379
- self . menuPageClose = self . menuPage . find ( ".ui-header a" ) ;
380
-
381
- // prevent the parent page from being removed from the DOM,
382
- // otherwise the results of selecting a list item in the dialog
383
- // fall into a black hole
384
- self . thisPage . unbind ( "pagehide.remove" ) ;
385
-
386
- //for WebOS/Opera Mini (set lastscroll using button offset)
387
- if ( scrollTop === 0 && btnOffset > screenHeight ) {
388
- self . thisPage . one ( "pagehide" , function ( ) {
389
- $ ( this ) . jqmData ( "lastScroll" , btnOffset ) ;
390
- } ) ;
391
- }
392
-
393
- self . menuPage . one ( {
394
- pageshow : $ . proxy ( this , "_focusMenuItem" ) ,
395
- pagehide : $ . proxy ( this , "close" )
396
- } ) ;
397
-
398
- self . menuType = "page" ;
399
- self . menuPageContent . append ( self . list ) ;
400
- self . menuPage . find ( "div .ui-title" ) . text ( self . label . text ( ) ) ;
413
+ this . menuType = "native" ;
414
+ this . options . nativeMenu = true ;
401
415
} else {
402
416
self . menuType = "overlay" ;
403
417
@@ -531,6 +545,8 @@ $.widget( "mobile.selectmenu", $.mobile.selectmenu, {
531
545
_destroy : function ( ) {
532
546
533
547
if ( ! this . options . nativeMenu ) {
548
+ this . _off ( this . button , "vclick" ) ;
549
+ this . _off ( this . select , "focus" ) ;
534
550
this . close ( ) ;
535
551
536
552
// Restore the tabindex attribute to its original value
0 commit comments