Only show the "No results found" message when there are no results
visible in the list. This avoid issues when loading more data, and
it returns no results.
Only try to see if the load more button is visible if it is present
in the DOM. This prevents making continuous requests when there are
no more results.
This starts work on the example, which currently uses the GitHub
API.
The `ajax.delay` option has been added that allows for debouncing
requests made within a certain number of milliseconds.
This allows for any control to emit key events, and for the Select2
instance to handle them. So now the search box will allow for
results to be scrolled and selected, bringing back the old expected
functionality. This also stops triggering new queries when the
arrow keys are pressed.
The container will also be automatically focused when the dropdown
is closed, which is consistent with the old Select2.
The results will no longer be queried on initialization, but
instead will be queried when the dropdown is opened. This is more
consistent with the previous version of Select2.
The search box will now be cleared when the dropdown is closed.
The placeholder will not only be automatically hidden if the
results adapter was not already overridden. This will allow users
to override the results adapter to now hide the placeholder, if
they do not want that functionality.
This allows them to be overridden, allowing for things like
attaching the dropdown to a different part of the DOM.
The id is also now generated in a function that can be overridden.
Now we point users to the `LICENSE.md` file for the license,
instead of including it in the README. This also removes the
example integrations, which are no longer officially maintained
by Select2.
The translation section has also been updated.
This was only done to maintain compatibility with labels, back
when we could capture the focus events from the original element.
Now that we handle them in a different way, this is no longer
needed.
This fixes#2769.
This adds a custom r.js build for i18n, which processes each JS
file in the `select2/i18n` directory and builds it.
So far only the "No results found" translation has been added.
Now that `define` and `require` are never made public, we have to
build everything to support `$.fn.select2.amd` while also working
with other AMD loaders.
This will prevent leaking variables, and will remove the possibility
of Select2 not working well with other plugins which support
AMD loaders. The `define` and `require` methods are now aliased
under `$.Select2.amd` for use inside additional files, such as
translations.
This fixes#2769, where Select2 will jump around because of how
focus moves to the original element when selections are made.
Because absolute positioning pushed the original element out of the
viewport, bringing it back into the viewport should be the best
fix.
Tags no longer takes an array, as pre-existing tags should already
exist as options in the data adapter. A compatibility module will
later be added to convert tag data that is passed in to array data.
Tags allow for users to enter their own options, which will be
added to the beginning of the results list.
When using array data, and an option is selected, the data that is
attached to the DOM element will be run through `item` and should
have any private, automatically generated attributes added and
merged with it.