File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 356356
357357 this . container . addClass ( "select2-dropdown-open" ) . addClass ( "select2-container-active" ) ;
358358
359+ this . updateResults ( ) ;
360+ this . ensureHighlightVisible ( ) ;
359361 this . alignDropdown ( ) ;
360362 this . dropdown . show ( ) ;
363+ this . focusSearch ( ) ;
361364 } ;
362365
363366 AbstractSelect2 . prototype . close = function ( ) {
364367 if ( ! this . opened ( ) ) return ;
365368
366369 this . dropdown . hide ( ) ;
367370 this . container . removeClass ( "select2-dropdown-open" ) ;
368-
369- if ( this . select ) {
370- // TODO see if we can always clear here and reset on open
371- this . search . val ( "" ) ; // not using clearSearch() because it may set a placeholder
372- this . updateResults ( ) ; // needed since we just set the search text to ""
373- } else {
374- this . results . empty ( ) ;
375- }
376-
371+ this . results . empty ( ) ;
377372 this . clearSearch ( ) ;
378373 } ;
379374
610605 width -= getSideBorderPadding ( this . container . find ( ".select2-search" ) ) ;
611606 width -= getSideBorderPadding ( this . search ) ;
612607 this . search . css ( { width : width } ) ;
613-
614- if ( ! this . select ) this . updateResults ( ) ;
615-
616- this . ensureHighlightVisible ( ) ;
617-
618- this . focusSearch ( ) ;
619608 } ;
620609
621610 SingleSelect2 . prototype . close = function ( ) {
915904 if ( this . opened ( ) ) return ;
916905 this . parent . open . apply ( this , arguments ) ;
917906 this . resizeSearch ( ) ;
918- this . ensureHighlightVisible ( ) ;
919907 this . focusSearch ( ) ;
920908 } ;
921909
You can’t perform that action at this time.
0 commit comments