* Update dev dependencies
* Adjust dependencies versions to avoid unmet peer dependency error
* Update Travis CI node version to 8
* Recompile dist
This updates all of the minified files to use the latest uglifyjs version, which results in better compression (by a small margin).
This adds back the `dropdownAutoWidth` option, so the dropdown can
have a width that is automatically determined by the browser. This
works best for smaller dropdowns that contain options with large
amounts of text.
This closes https://github.com/select2/select2/issues/3103.
This closes https://github.com/select2/select2/pull/3113.
Signed-off-by: Kevin Brown <kevin@kevin-brown.com>
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.
We don't need to update the dates on these every time that grunt
is called. This gives it a much more basic banner that is similar
to the minified version.
As we have established already, jQuery 1.x does not correctly handle
`data-*` attributes where there are multiple dashes. This makes it
so we can still handle nested options when working with jQuery 1.x
by using the `.dataset` option that is supported by all major
browsers as well as IE 11+.
Browser support tables for the `.dataset` attributes can be found at
http://caniuse.com/dataset
A notice was already added to the documentation about this in
caeb0ec9b7.
The related ticket in the jQuery repository about this issue is
https://github.com/jquery/jquery/issues/2070.
This closes https://github.com/select2/select2/issues/2969.
There were a few undefined variables being referenced within the
Select2 code. The JSHint configuration has been modified to fail
if there are undefined variables being referenced, including any
global variables.
There is an exception that is being made for the jQuery shim, as it
must try to find the global jQuery references.
An exception is made for the test helpers, as the SauceLabs reporting
variables are not camelCase, and would normally trigger warnings.
This closes https://github.com/select2/select2/pull/3028.
This adds a check that triggers an error if Select2 was not able
to detect a copy of jQuery on the page. This should help users when
they are setting up Select2.
**Breaking change:** The full build no longer includes jQuery.
Previously, the full build included all requirements for Select2,
including jQuery, which meant that anyone looking for the optional
requirements had to possibly include multiple versions of jQuery
on their page. This means that anyone requiring Select2 to also
bundle jQuery will now need to include jQuery on their pages
alongside Select2. A copy of jQuery is included in the repository.
**Breaking change:** The AMD build of Select2 will now correctly
wrap the code in a `define` block. It will still create the named
blocks inside of the code, which should be valid in most AMD build
systems, so now Select2 is compatible with cases where the file
does not have the same name as the Select2 module name.
**Breaking change:** Select2 will re-use the AMD methods if they
are available on the page, but it will not longer leak the included
AMD loader to the global scope. The AMD methods will still be
available on the `jQuery.fn.select2.amd` namespace.
The `mock.js` test file has been renamed to `helpers.js` and will
handle the escalation of the `require` and `define` variables to
the global scope. It should be included in all test files, or the
tests will fail.
This closes https://github.com/select2/select2/issues/2946.
When `jQuery.noConflict` is called, the global `$` variable is not
defined. We cannot assume in the code that the variable is defined,
and instead should always make sure to import the `jquery` module
when we need jQuery.
This fixes all of the issues where we are assuming that `$` is
defined globally when we are not importing the module. This also
fixes the issues when defining the `jQuery.fn.select2.amd` modules
where we were always attaching to the `$` object instead of the
`jQuery` object.
This closes https://github.com/select2/select2/issues/2947.