d1e8a6fdad
Now we do not have separate AMD builds, instead we use a UMD wrapper to support both AMD and CommonJS environments along with the browser. This has been tested with RequireJS and it correctly imports Select2 and hooks into jQuery. This means that all builds will include the Almond AMD loader, but this isn't that much of an issue when you consider the file sizes. The loader is namespaced so RequireJS and other AMD builders don't complain about `require` and `define` existing. This is also done so AMD loaders don't conflict, as Select2's AMD loader should operate independently of others. There are now two layers of wrappers that are applied to files, only one of which is used for the translation files. This allows us to only load in the internal Select2 modules once, and in general makes most things cleaner. These have also been pulled out into individual JS files instead of being stored in JSON files, allowing us to add comments and make things look readable. Because we use a few hacks, these files are heavily commented as well. This closes https://github.com/select2/select2/issues/2945. This closes https://github.com/select2/select2/issues/2946.
7 lines
259 B
JavaScript
7 lines
259 B
JavaScript
(function () {
|
|
// Restore the Select2 AMD loader so it can be used
|
|
// Needed mostly in the language files, where the loader is not inserted
|
|
if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {
|
|
var S2 = jQuery.fn.select2.amd;
|
|
}
|