File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6565 }
6666 } ;
6767
68+ function indexOf ( value , array ) {
69+ var i = 0 , l = array . length , v ;
70+
71+ if ( value . constructor === String ) {
72+ for ( ; i < l ; i ++ ) if ( value . localeCompare ( array [ i ] ) === 0 ) return i ;
73+ } else {
74+ for ( ; i < l ; i ++ ) {
75+ v = array [ i ] ;
76+ if ( v . constructor === String ) {
77+ if ( v . localeCompare ( value ) === 0 ) return i ;
78+ } else {
79+ if ( v === value ) return i ;
80+ }
81+ }
82+ }
83+ return - 1 ;
84+ }
85+
6886 function getSideBorderPadding ( element ) {
6987 return element . outerWidth ( ) - element . width ( ) ;
7088 }
970988 throw "Invalid argument: " + selected + ". Must be .select2-search-choice" ;
971989 }
972990
973- index = val . indexOf ( selected . data ( "select2-data" ) . id ) ;
991+ index = indexOf ( selected . data ( "select2-data" ) . id , val ) ;
974992
975993 if ( index >= 0 ) {
976994 val . splice ( index , 1 ) ;
You can’t perform that action at this time.
0 commit comments