File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1749,13 +1749,15 @@ the specific language governing permissions and limitations under the Apache Lic
17491749 // single
17501750 clear : function ( ) {
17511751 var data = this . selection . data ( "select2-data" ) ;
1752- this . opts . element . val ( "" ) ;
1753- this . selection . find ( "span" ) . empty ( ) ;
1754- this . selection . removeData ( "select2-data" ) ;
1755- this . setPlaceholder ( ) ;
1752+ if ( data ) { // guard against queued quick consecutive clicks
1753+ this . opts . element . val ( "" ) ;
1754+ this . selection . find ( "span" ) . empty ( ) ;
1755+ this . selection . removeData ( "select2-data" ) ;
1756+ this . setPlaceholder ( ) ;
17561757
1757- this . opts . element . trigger ( { type : "removed" , val : this . id ( data ) , choice : data } ) ;
1758- this . triggerChange ( { removed :data } ) ;
1758+ this . opts . element . trigger ( { type : "removed" , val : this . id ( data ) , choice : data } ) ;
1759+ this . triggerChange ( { removed :data } ) ;
1760+ }
17591761 } ,
17601762
17611763 /**
You can’t perform that action at this time.
0 commit comments