File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1747,16 +1747,18 @@ the specific language governing permissions and limitations under the Apache Lic
17471747 } ,
17481748
17491749 // single
1750- clear : function ( ) {
1750+ clear : function ( triggerChange ) {
17511751 var data = this . selection . data ( "select2-data" ) ;
17521752 if ( data ) { // guard against queued quick consecutive clicks
17531753 this . opts . element . val ( "" ) ;
17541754 this . selection . find ( "span" ) . empty ( ) ;
17551755 this . selection . removeData ( "select2-data" ) ;
17561756 this . setPlaceholder ( ) ;
17571757
1758- this . opts . element . trigger ( { type : "removed" , val : this . id ( data ) , choice : data } ) ;
1759- this . triggerChange ( { removed :data } ) ;
1758+ if ( triggerChange !== false ) {
1759+ this . opts . element . trigger ( { type : "removed" , val : this . id ( data ) , choice : data } ) ;
1760+ this . triggerChange ( { removed :data } ) ;
1761+ }
17601762 }
17611763 } ,
17621764
@@ -1946,7 +1948,7 @@ the specific language governing permissions and limitations under the Apache Lic
19461948 }
19471949 // val is an id. !val is true for [undefined,null,'',0] - 0 is legal
19481950 if ( ! val && val !== 0 ) {
1949- this . clear ( ) ;
1951+ this . clear ( triggerChange ) ;
19501952 if ( triggerChange ) {
19511953 this . triggerChange ( ) ;
19521954 }
You can’t perform that action at this time.
0 commit comments