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.
Add optional parameter transformVal that allows the user to define transformation for splitVal
Example demos:
(Infinite spaces, default transformVal):
http://jsfiddle.net/DV23t/9/
(No infinite spaces, transformVal = function (x) { return x; }):
http://jsfiddle.net/DV23t/12/
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.
Redirect the focus of original input to the "focus" event of Select2.
this way, we get back the accessible label for feature of previous Select2 versions.
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.