@@ -2278,29 +2278,21 @@ the specific language governing permissions and limitations under the Apache Lic
22782278
22792279 // single
22802280 postprocessResults : function ( data , initial , noHighlightUpdate ) {
2281- var selected = 0 , selectedElm = null , self = this , showSearchInput = true ;
2281+ var selected = 0 , self = this , showSearchInput = true ;
22822282
22832283 // find the selected element in the result list
22842284
22852285 this . findHighlightableChoices ( ) . each2 ( function ( i , elm ) {
22862286 if ( equal ( self . id ( elm . data ( "select2-data" ) ) , self . opts . element . val ( ) ) ) {
22872287 selected = i ;
2288- selectedElm = elm ;
22892288 return false ;
22902289 }
22912290 } ) ;
22922291
22932292 // and highlight it
22942293 if ( noHighlightUpdate !== false ) {
22952294 if ( initial === true && selected >= 0 ) {
2296- // By default, the selected item is displayed inside the result list from a single select
2297- // User can provide an implementation for 'hideSelectionFromResult' and hide it
2298- if ( selectedElm !== null ) {
2299- if ( this . opts . hideSelectionFromResult ( selectedElm ) )
2300- selectedElm . addClass ( "select2-selected" ) ;
2301- }
2302- else
2303- this . highlight ( selected ) ;
2295+ this . highlight ( selected ) ;
23042296 } else {
23052297 this . highlight ( 0 ) ;
23062298 }
@@ -3029,14 +3021,9 @@ the specific language governing permissions and limitations under the Apache Lic
30293021 choices . each2 ( function ( i , choice ) {
30303022 var id = self . id ( choice . data ( "select2-data" ) ) ;
30313023 if ( indexOf ( id , val ) >= 0 ) {
3032- // By default, the selected item is hidden from the result list inside a multi select
3033- // User can provide an implementation for 'hideSelectionFromResult' and allow the same
3034- // element to be selected multiple times.
3035- if ( self . opts . hideSelectionFromResult ( choice ) === undefined || self . opts . hideSelectionFromResult ( choice ) ) {
3036- choice . addClass ( "select2-selected" ) ;
3037- // mark all children of the selected parent as selected
3038- choice . find ( ".select2-result-selectable" ) . addClass ( "select2-selected" ) ;
3039- }
3024+ choice . addClass ( "select2-selected" ) ;
3025+ // mark all children of the selected parent as selected
3026+ choice . find ( ".select2-result-selectable" ) . addClass ( "select2-selected" ) ;
30403027 }
30413028 } ) ;
30423029
@@ -3353,7 +3340,6 @@ the specific language governing permissions and limitations under the Apache Lic
33533340 adaptContainerCssClass : function ( c ) { return c ; } ,
33543341 adaptDropdownCssClass : function ( c ) { return null ; } ,
33553342 nextSearchTerm : function ( selectedObject , currentSearchTerm ) { return undefined ; } ,
3356- hideSelectionFromResult : function ( selectedObject ) { return undefined ; } ,
33573343 searchInputPlaceholder : '' ,
33583344 createSearchChoicePosition : 'top' ,
33593345 shouldFocusInput : function ( instance ) {
0 commit comments