@@ -1733,10 +1733,13 @@ the specific language governing permissions and limitations under the Apache Lic
17331733
17341734 // single
17351735 clear : function ( ) {
1736+ var data = this . selection . data ( "select2-data" ) ;
17361737 this . opts . element . val ( "" ) ;
17371738 this . selection . find ( "span" ) . empty ( ) ;
17381739 this . selection . removeData ( "select2-data" ) ;
17391740 this . setPlaceholder ( ) ;
1741+
1742+ this . opts . element . trigger ( { type : "removed" , val : this . id ( data ) , choice : data } ) ;
17401743 } ,
17411744
17421745 /**
@@ -1848,6 +1851,8 @@ the specific language governing permissions and limitations under the Apache Lic
18481851 if ( ! options || ! options . noFocus )
18491852 this . selection . focus ( ) ;
18501853
1854+ this . opts . element . trigger ( { type : "selected" , val : this . id ( data ) , choice : data } ) ;
1855+
18511856 if ( ! equal ( old , this . id ( data ) ) ) { this . triggerChange ( ) ; }
18521857 } ,
18531858
@@ -2250,6 +2255,8 @@ the specific language governing permissions and limitations under the Apache Lic
22502255 }
22512256 }
22522257
2258+ this . opts . element . trigger ( { type : "selected" , val : this . id ( data ) , choice : data } ) ;
2259+
22532260 // since its not possible to select an element that has already been
22542261 // added we do not need to check if this is a new element before firing change
22552262 this . triggerChange ( { added : data } ) ;
@@ -2340,6 +2347,9 @@ the specific language governing permissions and limitations under the Apache Lic
23402347 if ( this . select ) this . postprocessResults ( ) ;
23412348 }
23422349 selected . remove ( ) ;
2350+
2351+ this . opts . element . trigger ( { type : "removed" , val : this . id ( data ) , choice : data } ) ;
2352+
23432353 this . triggerChange ( { removed : data } ) ;
23442354 } ,
23452355
0 commit comments