|
@@ -9,19 +9,33 @@
|
|
if (typeof define === 'function' && define.amd) {
|
|
if (typeof define === 'function' && define.amd) {
|
|
// AMD. Register as an anonymous module.
|
|
// AMD. Register as an anonymous module.
|
|
define(['jquery'], factory);
|
|
define(['jquery'], factory);
|
|
- } else if (typeof exports === 'object') {
|
|
|
|
|
|
+ } else if (typeof module === 'object' && module.exports) {
|
|
// Node/CommonJS
|
|
// Node/CommonJS
|
|
- factory(require('jquery'));
|
|
|
|
|
|
+ module.exports = function (root, jQuery) {
|
|
|
|
+ if (jQuery === undefined) {
|
|
|
|
+ // require('jQuery') returns a factory that requires window to
|
|
|
|
+ // build a jQuery instance, we normalize how we use modules
|
|
|
|
+ // that require this pattern but the window provided is a noop
|
|
|
|
+ // if it's defined (how jquery works)
|
|
|
|
+ if (typeof window !== 'undefined') {
|
|
|
|
+ jQuery = require('jquery');
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ jQuery = require('jquery')(root);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ factory(jQuery);
|
|
|
|
+ return jQuery;
|
|
|
|
+ };
|
|
} else {
|
|
} else {
|
|
// Browser globals
|
|
// Browser globals
|
|
factory(jQuery);
|
|
factory(jQuery);
|
|
}
|
|
}
|
|
-}(function (jQuery) {
|
|
|
|
|
|
+} (function (jQuery) {
|
|
// This is needed so we can catch the AMD loader configuration and use it
|
|
// This is needed so we can catch the AMD loader configuration and use it
|
|
// The inner file should be wrapped (by `banner.start.js`) in a function that
|
|
// The inner file should be wrapped (by `banner.start.js`) in a function that
|
|
// returns the AMD loader references.
|
|
// returns the AMD loader references.
|
|
- var S2 =
|
|
|
|
-(function () {
|
|
|
|
|
|
+ var S2 =(function () {
|
|
// Restore the Select2 AMD loader so it can be used
|
|
// Restore the Select2 AMD loader so it can be used
|
|
// Needed mostly in the language files, where the loader is not inserted
|
|
// Needed mostly in the language files, where the loader is not inserted
|
|
if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {
|
|
if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {
|
|
@@ -3191,7 +3205,7 @@ S2.define('select2/data/select',[
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if (data.id) {
|
|
|
|
|
|
+ if (data.id !== undefined) {
|
|
option.value = data.id;
|
|
option.value = data.id;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -3550,7 +3564,10 @@ S2.define('select2/data/tags',[
|
|
}, true)
|
|
}, true)
|
|
);
|
|
);
|
|
|
|
|
|
- var checkText = option.text === params.term;
|
|
|
|
|
|
+ var optionText = (option.text || '').toUpperCase();
|
|
|
|
+ var paramsTerm = (params.term || '').toUpperCase();
|
|
|
|
+
|
|
|
|
+ var checkText = optionText === paramsTerm;
|
|
|
|
|
|
if (checkText || checkChildren) {
|
|
if (checkText || checkChildren) {
|
|
if (child) {
|
|
if (child) {
|