File tree 3 files changed +31
-1
lines changed
3 files changed +31
-1
lines changed Original file line number Diff line number Diff line change
1
+ * Output friendly error message when Microplguin is missing (#1137 ).
2
+ Special thanks to @styxxx for proposing the improvement.
3
+
4
+ * Jonathan Allard* (@joallard )
5
+
1
6
* Fix open keyboard bug under iOS after closing selection (#1127 )
2
7
3
8
* @zeitiger *
Original file line number Diff line number Diff line change @@ -86,7 +86,18 @@ var Selectize = function($input, settings) {
86
86
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
87
87
88
88
MicroEvent . mixin ( Selectize ) ;
89
- MicroPlugin . mixin ( Selectize ) ;
89
+
90
+ if ( typeof MicroPlugin !== "undefined" ) {
91
+ MicroPlugin . mixin ( Selectize ) ;
92
+ } else {
93
+ logError ( "Dependency MicroPlugin is missing" ,
94
+ { explanation :
95
+ "Make sure you either: (1) are using the \"standalone\" " +
96
+ "version of Selectize, or (2) require MicroPlugin before you " +
97
+ "load Selectize." }
98
+ ) ;
99
+ }
100
+
90
101
91
102
// methods
92
103
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Original file line number Diff line number Diff line change @@ -331,3 +331,17 @@ var domToString = function(d) {
331
331
332
332
return tmp . innerHTML ;
333
333
} ;
334
+
335
+ var logError = function ( message , options ) {
336
+ if ( ! options ) options = { } ;
337
+ var component = "Selectize" ;
338
+
339
+ console . error ( component + ": " + message )
340
+
341
+ if ( options . explanation ) {
342
+ // console.group is undefined in <IE11
343
+ if ( console . group ) console . group ( ) ;
344
+ console . error ( options . explanation ) ;
345
+ if ( console . group ) console . groupEnd ( ) ;
346
+ }
347
+ }
You can’t perform that action at this time.
0 commit comments