Maybe the fix is a bit ugly, but what it does is to make sure that we don't already have a select2-hidden-accessible span before we create a new one. Tested in several scenarios in our application and has solved the issue for us.
Instead of instantly applying the translations, add them to an array.
That way users can include the language files that their site supports
and apply the required language using $.extend($.fn.select2.defaults,
$.fn.select2.locales["nl"]);
Signed-off-by: Kevin Brown <kevin@kevinbrown.in>
This normalizes the `select2-selecting` event so the object is
returned as `choice` in the event data. While the documentation
points to the name being `object`, all other events return the
affected data object as `choice`.
This closes the following issue: https://github.com/ivaynberg/select2/issues/2340
This changes `formatMatches` to notify the user that they can
select the single result. This is a more clear result compared to
the previous one.
This closes the following issue: https://github.com/ivaynberg/select2/issues/2329
Lines [1499](d487fc58a8/select2.js (L1499)) and [1509](d487fc58a8/select2.js (L1509)) make a call to `child.offset().top`. I don't know what's causing `child.offset()` to return undefined, but it is and it's breaking Select2 so that I can't select the last item in the list (this error occurs when I try hovering over or clicking on the last item in a list).
I can try and create a reduced case, but this fix is 100% backward compatibe, passes all the tests you have for the project and has a 0% chance of breaking anyone's working code. With this patch, my dropdown works just fine. At worst, this does *nothing* for people, at best, it fixes a rare edge case. Like my edge case. And I'm a pretty important person to me.
for e.g. proper cache implementation it is necessary to have the complete query in the results callback of the ajax function. to not break backwards compatibility i added it as third parameter and did not replace query.page parameter
use string concatenation instead of DOM manipulation at populate. This
does gives about a 45% speed boost as measured with chrome v35. Code by
@cervengoc on #781