1
0
mirror of synced 2024-11-28 15:46:03 +03:00
Commit Graph

522 Commits

Author SHA1 Message Date
milupo
5a7f832f12 Create dsb.js 2017-06-10 17:03:53 +02:00
milupo
3bc4522200 Create hsb.js 2017-06-10 17:03:05 +02:00
milupo
25fdc6bef4 Delete hsb.js 2017-06-10 17:02:15 +02:00
milupo
53c4c97411 Delete dsb.js 2017-06-10 17:01:36 +02:00
milupo
32ba6d7573 Create dsb.js 2017-06-10 16:04:48 +02:00
milupo
a4a095bda8 Create hsb.js 2017-06-10 16:02:59 +02:00
depesr
5bb7446d24 Update sk.js 2017-05-23 07:22:18 +02:00
depesr
e43a1f2165 Updated sk.js localisation 2017-05-23 07:18:15 +02:00
Frederic G. Østby
f38d84df71 Fixed norwegian inputTooShort message. 2017-05-05 13:02:43 +02:00
Ettienne Louw
2b3dd18d35 Create af.js
Added afrikaans language file
2017-03-29 18:07:49 +02:00
Børge Antonsen
946149277e Simplified Norwegian(nb) translation to a more correct text 2017-03-02 10:13:57 +01:00
Josef Šimánek
cd7d4be576 correct typo in pt.js 2016-12-30 18:22:49 +01:00
Kevin Brown
751b36767f Corrected linting issue in Turkish translation 2016-12-30 12:15:56 -05:00
mhamlet
f6fa52dcc0 Added Armenian Localization
This closes https://github.com/select2/select2/pull/3993.
2016-12-30 12:15:25 -05:00
osman orhan
fd4a082531 Add missing errorLoading to Turkish translation
This closes https://github.com/select2/select2/pull/4650.
2016-12-30 11:50:58 -05:00
Kevin Brown
3b8a5d3660 Merge pull request #4730 from quantus/master
Add missing finnish translations
2016-12-30 11:44:28 -05:00
Derrick Hammer
45a8773454 Fix UMD commonjs support
This is based on the UMDJS jQuery template available at
95563fd6b4/templates/jqueryPlugin.js

This closes https://github.com/select2/select2/issues/4557.
This closes https://github.com/select2/select2/pull/4558.
2016-12-29 19:40:09 -05:00
Mike Dearman
16b4840c0e Support selecting options with falsy values
Previously you could not select an option which had the number 0
as its value, because there was a check which would detect it as
an option without a value. There was a similar issue with selecting
options which had a blank string as the value.

This closes https://github.com/select2/select2/issues/4604.
This closes https://github.com/select2/select2/issues/4516.
This closes https://github.com/select2/select2/issues/3252.
This closes https://github.com/select2/select2/issues/3519.

This closes https://github.com/select2/select2/pull/4605.
This closes https://github.com/select2/select2/pull/4517.
2016-12-29 19:23:48 -05:00
Nimit Suwannagate
625fc78ee6 Add errorLoading translation of Thai language.
This closes https://github.com/select2/select2/pull/4521.
2016-12-29 19:01:37 -05:00
Leandro Regueiro
f3788e2cda Simplify Danish and Arabic translations
This closes https://github.com/select2/select2/pull/4547.
2016-12-29 18:59:44 -05:00
Leandro Regueiro
8fcc6202c3 Update Galician translation 2016-12-29 18:59:15 -05:00
mitja-p
8e6422c570 Add Slovene translation
This closes https://github.com/select2/select2/pull/4576.
2016-12-29 18:55:49 -05:00
niki7har
4df965219e Update de.js
The german errorLoading message was missing.

This closes https://github.com/select2/select2/pull/4711.
This closes https://github.com/select2/select2/pull/4591.
2016-12-29 18:48:18 -05:00
Sági György
7d1d133523 i18n hu.js update. Added errorLoading property.
This closes https://github.com/select2/select2/pull/4724.
2016-12-29 18:46:29 -05:00
Yaron Uliel
cb9a904578 Make tags matching case insensitive
This closes https://github.com/select2/select2/issues/3566
This closes https://github.com/select2/select2/pull/4509
2016-12-29 18:26:19 -05:00
Pekka Pöyry
124087ae2a Add missing finnish translations 2016-12-22 15:03:12 +02:00
Nino Schoch
294e7e664d Fixed form focus lost 2016-06-16 13:45:21 +02:00
Harry
7eab29e271 Added Greek (el) translation
Translated English (en) language file to Greek (el).

This closes https://github.com/select2/select2/pull/4139
This closes https://github.com/select2/select2/pull/4146
2016-05-26 20:36:22 -04:00
Kevin Brown
ea79a197e0 Select2 now detects added and removed options
Select2 will now automatically update the selection if there are options
added to or removed from the DOM within the `<select>` element. This is
supported in all browsers except for Internet Explorer 8. Internet
Explorer 8 does not support the DOM mutation events which were added in
Internet Explorer 9, and it does not support mutation observers which
are the recommended way of handling this in modern browsers.

DOM mutation events also trigger for the `<select>` itself when it is
pulled from the DOM, so we need to filter these out within the event
handler.

Despite supporting mutation observers, we cannot accurately detect if
the removed option was selected at one time or another, so we need to
always re-pull the selection when an element is deleted.

This closes https://github.com/select2/select2/issues/4248
This builds upon https://github.com/select2/select2/pull/4249
2016-05-23 23:31:17 -04:00
Kevin Brown
4b9e02f022 Corrected check for opening the dropdown
This corrects the check that was used when the dropdown was opened, so
the results would be immediately rendered instead of delaying the
loading. Previously it would delay the immediate load but immediately
load the results when the search term was emptied.

This closes https://github.com/select2/select2/issues/4191
This closes https://github.com/select2/select2/pull/4192
This closes https://github.com/select2/select2/pull/4202
2016-05-14 22:26:56 -04:00
Kevin Brown
481c43883e selectOnClose now properly works with closeOnSelect
Previously we hacked around the infinite loop between closeOnSelect and
selectOnClose by attempting to detect what event was being triggered
without knowing what event triggered it. Now we properly relay the
Select2 event and the jQuery event that triggered the select or unselect

This closes https://github.com/select2/select2/issues/4012
2016-05-14 22:14:20 -04:00
Kevin Brown
ad8447cc35 Add a new _type parameter for the first event argument
This will include the event type in the _type property, so it can be
accessed within the event handlers if it's not normally passed in. This
should not conflict with any existing handlers, and this should not be
considered a public property on event arguments.
2016-05-14 22:01:42 -04:00
Kevin Brown
9f581285d8 Renamed focusFirstItem method
This renames the `focusFirstItem` method to `highlightFirstItem`, which
better reflects what is actually happening. This also ensures that the
highlight is visible when it is moved by calling
`ensureHighlightVisible`.

This closes https://github.com/select2/select2/issues/3479
This closes https://github.com/select2/select2/pull/4238
2016-05-14 21:05:14 -04:00
Alexander Leonov
e897d008a6 Fixed infinite scrolling issue using down key. 2016-05-14 21:04:31 -04:00
Nadim Afana
fba261c670 Fixed EOL to Unix format. 2016-05-06 14:54:13 -07:00
Nadim Afana
16e26310e1 Fixed more indentation issues. 2016-05-06 12:28:49 -07:00
Nadim Afana
6e9657105b Fixed indentation. 2016-05-06 12:23:58 -07:00
Nadim Afana
a1dc7f23d1 Fixed unit tests and updated source code to handle HTML5 attribs. 2016-05-05 21:41:20 -07:00
Nadim Afana
95b1f8b409 Reverted a line in base.js regarding tab index. 2016-05-05 18:38:38 -07:00
Nadim Afana
76298267f9 Updated inputData.js 2016-05-05 18:12:51 -07:00
Nadim Afana
54e126a664 Fixed bug #4014 2016-05-05 15:38:31 -07:00
Damien Finck
b1ea28bb7d Add missing French translation 2016-05-04 19:55:01 +02:00
Maarten Brouwers
89dcfef94b linting fix for lt i18n file 2016-05-03 00:08:06 +02:00
Aurelijus Rožėnas
5b5eddd183 Fixed broken lithuanian translation
This closes https://github.com/select2/select2/issues/4301.

Signed-off-by: Kevin Brown <kevin@kevin-brown.com>
2016-04-23 22:33:22 -04:00
Kevin Brown
31e7a1d4c5 Support the focus event on the <select> element
This adds basic support for focusing the Select2 element by triggering
the `focus` event on the underlying <select> element.  This implicitly
adds support for <label> elements, which will trigger the `focus` event
on the `<select>` if it is clicked.

This also fixes the focus issue that previously existed if Select2 was
opened while in a <label>. The focus would be transferred to the search
dropdown, and then immediately pulled away to the <select> element. This
happened because the <label> element triggers the `focus` event when a
`click` event propagates its way up, and we do not stop the propagation
of the `click` event when it is triggered on the selection.

This closes https://github.com/select2/select2/issues/2311.
This closes https://github.com/select2/select2/issues/4203.
This closes https://github.com/select2/select2/pull/4235.
2016-04-23 19:58:04 -04:00
Ryan Cousart
ecdc416635 Fixing bug with non-static parents for dropdowns
The offset of the parent was only being subtracted if the dropdown was
facing down, this now subtracts it if the dropdown is facing up as well.
This more or less applies the same fix as
e260860789,
but when calculating the position of the dropdown when it is facing up.

This closes https://github.com/select2/select2/issues/3303
This closes https://github.com/select2/select2/pull/4267
2016-04-17 16:58:01 -04:00
Kevin Brown
c099755012 Merge pull request #4246 from somethvictory/master
add Khmer translation
2016-04-14 17:54:48 -04:00
Kevin Brown
3b8cd2e369 Create an option when tokenizing if needed
Previously the tokenizer only worked when creating multiple options
at once if all of the options existed. It always worked when creating
a single option, because all of the special cases were handled by the
tagging module. When working with multiple options, the tagging
module does not kick in until after the query has been run, which
is when the tokenizer does its magic.

This fixes the issue by automatically creating the option tags that
the tagging module would normally create. It only does this if the
options do not already exist, so we don't need to worry about the
tokenizer creating duplicates of existing options.

This closes https://github.com/select2/select2/issues/3458
2016-03-27 18:29:01 -04:00
Kevin Brown
cfb66f5e4f Attempt to detect aborted requests
The error handler should not be raised if a request is aborted while
another one is sent out. This attempts to detect those cases by
handling the case where the error was raised and the request has a
status code of 0, which should either mean we're in offline mode or
the request was aborted.

This closes https://github.com/select2/select2/issues/4205
2016-03-27 15:44:40 -04:00
Kevin Brown
fe26b083eb Fix dropdownAutoWidth so it actually works
Previously the `dropdownAutoWidth` option didn't work because the
dropdown was being absolutely positioned, so setting the width to
`auto` didn't actually have an effect. This cannot be solved by
just setting the width on the container, because that is also
absolutely positioned.

This closes https://github.com/select2/select2/issues/3101
2016-03-27 15:24:37 -04:00
Kevin Brown
c2c1aeef31 Fix calling select2('', args) on multiple elements
This fixes an issue that has existed since Select2 4.0.1 where the
arguments passed into each `<select>` were mutated. This no longer
mutates the arguments for each element, and instead only drops the
first argument once.

This closes https://github.com/select2/select2/issues/4245
2016-03-27 14:59:44 -04:00
jpic
8869b170b1 Set list-style further down the DOM
This closes https://github.com/select2/select2/issues/4225
This closes https://github.com/select2/select2/pull/4226
2016-03-27 14:55:21 -04:00
Sondre Eikanger Kvalø
0212edda95 Added missing Norwegian bokmaal label used for errors 2016-03-16 15:51:39 +01:00
Someth Victory
a7738c4517 fix jshint: Line is too long 2016-03-10 16:45:27 +07:00
Someth Victory
a797833e10 add Khmer translation 2016-03-10 16:35:09 +07:00
Radu Ungureanu
72d905f9e0 Romanian localization
- updated transaltions
- added translation for errorLoading
- issue fixes - compare characters length instead of message when adding terminal character

This closes https://github.com/select2/select2/pull/4208
2016-03-08 19:54:01 -05:00
Vasyl Zuzyak
e3f9466d8b Reuse result of previous calcualtion
This closes https://github.com/select2/select2/pull/4155.
2016-02-14 14:03:49 -05:00
Bruno Sampaio
983cd8e765 Recursively apply defaults
This closes https://github.com/select2/select2/pull/4130.
2016-02-14 13:58:14 -05:00
Ben
65179f16de Santize automatically generated ids
This closes https://github.com/select2/select2/issues/3618.
This closes https://github.com/select2/select2/pull/4123.
2016-02-14 13:48:19 -05:00
Kevin Brown
69ef214c92 Display error message on AJAX errors
This display the `errorLoading` translation when there is an error
during the AJAX cycle. Previously we were just throwing these errors
out, now we are actually displaying an error message.

This closes https://github.com/select2/select2/issues/3501
2016-01-04 20:07:37 -05:00
Stretch
e842797aaf Added insertTag to control the tag position
This adds an option called `insertTag` that controls the location within
the results where the tag is inserted. The function should take in the
results array and the tag, and should modify the array in-place to add
the tag to the results.

This closes https://github.com/select2/select2/issues/3420
This closes https://github.com/select2/select2/pull/4008
2016-01-03 19:08:59 -05:00
Kevin Brown
f3b9693ad9 Fixed existing selections not being respected with array data
This fixes an edge case that occurred pretty much whenever anyone would
use array data with existing selections along with a placeholder. This
caused the existing selections to be discarded, because the `selected`
property was not being transferred over to the new option. This was
based the new data was being preferred over the data that could be
inferred from the option, and the new data typically did not include the
selected state. As a result, the option was assumed to not be selected.

This was not cause by existing tests because all of the existing tests
only covered cases where the selected option was the first option, and
that was not affected by this bug.
2016-01-03 18:34:59 -05:00
Kevin Brown
09ecd3cdb9 Remove dead code
This call to `$.fn.position` was causing an error in IE 8 because the
`offsetParent` was null on the container for some reason. It's not
needed, so this line of code has been removed.

This should fix the test failures in IE 8.
2016-01-01 18:16:51 -05:00
Kevin Brown
e260860789 Correct positioning issues for statically positioned elements
There was a commit that landed in 4.0.1 that fixed positioning for
non-static elements, which are commonly used for the custom
`dropdownParent` option, but broke positioning for statically positioned
elements, commonly used in almost every other case. That commit was
c9216b4b96

This fixes the positioning issues caused by that commit by properly
calculating the offsets for statically positioned parents. Statically
positioned parents are unique, because the offset for the dropdown must
be calculated based on the closest element that is non-statically
positioned. Otherwise, the offset for any statically positioned parent
other than the body will be considerably higher than it should be,
resulting in the dropdown being offset by a large amount.

The offset parent for the body element is the html element, which is why
this works for both the body element and any custom parents for the
dropdown. This would not be needed if the parent wasn't customizable (as
seen in Select2 3.x) because you will never need to offset the body
element if it is statically positioned, because the html element almost
never has an offset.

This also fixes JSHint issues within the tests added in the last commit.

This closes https://github.com/select2/select2/issues/3970
This closes https://github.com/select2/select2/issues/3639
2016-01-01 17:15:00 -05:00
Kevin Brown
c9216b4b96 Fixed positioning with non-static parents
This fixes an issue with non-static parents (ones that were relatively
or absolutely positioned) where the dropdown would be offset by the
offset of the parent, so it would almost never line up. This fixes the
problem by removing the offset when the parent is not statically
positioned, which is what we used to do in older versions of Select2.

This closes https://github.com/select2/select2/issues/3303.
This closes https://github.com/select2/select2/issues/3614.
This closes https://github.com/select2/select2/issues/3672.
2015-11-27 17:58:08 -05:00
Kevin Brown
393ca4cf7f Fix selectOnBlur and closeOnSelect combination
This fixes an infinite loop that used to be caused when both
`closeOnSelect` and `selectOnClose` used to be combined, because they
both were listening to events triggered by the other one. The problem
was that `selectOnClose` was triggering `select` events for data objects
which had already been selected. This problem was solved by checking if
the data object was already selected before trying to select it again.

This closes https://github.com/select2/select2/pull/3751.
This closes https://github.com/select2/select2/issues/3169.
2015-11-27 17:32:54 -05:00
Kevin Brown
32b6eae54b Explicitly require jquery-mousewheel now
This fixes the implicit requirement of jquery-mousewheel that previously
existed. This was not allowed, as pointed out in
https://github.com/select2/select2/issues/3287#issuecomment-120408092

Now the requirement is more explicit, so everything should work as it
was before.
2015-11-27 16:07:07 -05:00
Kevin Brown
5ca76fda61 Merge pull request #3782 from nopash/patch-1
Correct Typo in noResults
2015-11-27 15:42:51 -05:00
Kevin Brown
3c8366e876 Fixed deep cloning options
In
f1e86470ca
we tried to fix the issue where multiple instances created in a single
call would share the same options, and this worked for the most common
cases. Unfortunately it did not work for the case where data attributes
were also used with an options object, and as a result data attributes
would be copied to all instances. Data attributes are supposed to be
specific to a single instance.

This was fixed by moving the `true` for the deep copy to the start of
the `$.extend` call, as this is where jQuery looks for the deep copy
flag.

This closes https://github.com/select2/select2/issues/3485
2015-11-23 18:55:31 -05:00
Kevin Brown
dc516e7073 Add container to templateResult
This closes https://github.com/select2/select2/issues/3222.
2015-11-23 18:40:50 -05:00
Jono Mingard
9fae3d74e3 Speak results on selection
This closes https://github.com/select2/select2/issues/3735
This closes https://github.com/select2/select2/pull/3821
2015-11-23 18:34:37 -05:00
Kevin Brown
5f80c5d9f8 Resize search after removing a choice
This fixes a previous bug with the backspace handler on the multiple
select search box where unselecting a choice through the keyboard would
not properly size the search box. As a result, most of the text would be
cut off and it was very clear that there was an issue.

In addition, a blank space was automatically being added to the end of
the search query. This blank space would not be removed at all, so the
user had to manually remove it.

Additionally, a query would be triggered for the last used search term
instead of the new search term that would be loaded in. This caused
incorrect results to be displayed most of the time.

All of these issues have been fixed by triggering a new search query
after an option has been removed through the keyboard. This will resize
the search box automatically, which fixes the main issue, and it will
trigger a search with the correct query.

This closes https://github.com/select2/select2/issues/3297
This closes https://github.com/select2/select2/pull/3398
2015-11-23 18:22:33 -05:00
Kevin Brown
8763a87779 Merge pull request #3946 from manuel-alvarez-alvarez/master
Add the decorator parameter to the handlers for the attach and detach of the dropdown
2015-11-23 16:49:59 -05:00
Limon Monte
410916510d Add errorLoading error message to sr, sr-Latin and hr languages. 2015-11-20 11:39:35 +01:00
Limon Monte
1c8d1f8e0d Add sr-Cyrl language. 2015-11-20 11:38:13 +01:00
Manuel Alvarez Alvarez
a06a08a028 Fixed jshint errors due to too long lines on the attachBody adapter 2015-11-19 15:49:52 +01:00
Manuel Alvarez Alvarez
eae4d01158 Add the decorator parameter to the handlers for the attach and detach the dropdown (otherwise the container is undefined) 2015-11-19 15:39:28 +01:00
KahWee Teng
31a329eb6d Fix inline search in Safari
This closes https://github.com/select2/select2/issues/3459
This closes https://github.com/select2/select2/pull/3476
2015-11-09 19:28:58 -05:00
Quentin Pradet
878bb3ab07 Fix select2('') calls on multiple elements
This fixes an issue when any of Select2's special options are called on
multiple elements, it would only affect the first option in the group.
This was because Select2 was only applying any changes to the first
element in the group (as chosen by jQuery) instead of applying changes
on each and every element within the list.

This has the new side effect of special options like `select2('data')`
returning the results for the last element in the list instead of the
first element. Because the previous functionality was considered
unspecified behaviour, this is not being treated as a breaking change.

This closes https://github.com/select2/select2/issues/3413
This closes https://github.com/select2/select2/pull/3495
2015-11-09 19:03:22 -05:00
Kevin Brown
7c47912b73 Set all AJAX parameters as query string parameters
This will now pass all of the AJAX parameters into the AJAX request as
query string parameters, so now the page number (and other variables)
will be set automatically. This can still be overridden in `ajax.data`
to pass anything else, but this should make it easier for the most
common case.

This closes https://github.com/select2/select2/issues/3548
This closes https://github.com/select2/select2/pull/3552
2015-11-09 18:49:40 -05:00
Lars Holm Jensen
ef508db161 Corrected Danish translation for results errors
This closes https://github.com/select2/select2/pull/3870
2015-11-09 18:28:59 -05:00
Kevin Brown
d0ce218c0b Merge pull request #3544 from fk/3306-clear-button-appears-under-long-text
#3306: Position clear button before the inline content of `.select2-selection__rendered`
2015-11-09 18:15:12 -05:00
Kevin Brown
c53b2dcf11 Fixed incorrect classes on "Loading more results" message
This fixes an issue where the old `option` and `load-more` classes were
not switched over to the newer BEM style of class names. Unfortunately
this is a breaking change, but this is also a bug given that it doesn't
follow the proper prefixing and is likely to conflict with larger
applications.

https://github.com/select2/select2/issues/3889
2015-11-09 18:13:02 -05:00
SilverFire - Dima Naumenko
3037b933e2 Correct reference for this in AJAX callbacks
Previously `this` would point to the AjaxAdapter that was being used to
process the AJAX, or sometimes the JS object holding the AJAX options,
instead of the jQuery element that Select2 was attached to. This fixes
the issue so `this` will consistently point to the jQuery element, just
like in past versions of Select2.

This closes https://github.com/select2/select2/issues/3361
This closes https://github.com/select2/select2/pull/3410
2015-11-09 18:00:39 -05:00
Kevin Brown
71cc891b83 Merge pull request #3859 from ahmadhussain/master
Added arabic language
2015-11-09 17:49:22 -05:00
Meir Cohen
7974fd1662 Corrected a few Hebrew translations
About  `errorLoading`:
Before the correction, the translation was: "התוצאות לא נטענו בהלכה".
The word "בהלכה" is wrong and should be spelled "כהלכה", but besides that, this translations means "The results were loaded improperly", while my corrected translation means "Error while loading results", which is what needed.

About `inputTooLong`, `inputTooShort`, `maximumSelected`:
In Hebrew, it's not acceptable to have the digit 1 for representing a single object. You should use the actual word "one", which is "אחד" in Hebrew together with the singular noun (e.g. "one item" / "one character", instead of "1 item" / "1 character").
**These 3 parts needed a critical fix anyway**, because they were addind the English letter 's' to the end of the Hebrew string.

About `loadingMore`:
The translation was "טען תוצאות נוספות" which means "Load more results", as an instruction, probably a typo.
I changed "טען" to "טוען" so now it means "loading more results", which is the correct form.

This closes https://github.com/select2/select2/pull/3911
2015-11-09 17:43:53 -05:00
Kevin Brown
ca0fd7c195 Properly disable input handlers in IE
Previously we were only disabling the `input` handler when it was
triggered, which caused a race condition within the `keyup` handlers
which also was triggered by the `input` event. This fixes the issue by
also unbinding the `input` handlers within the `keyup` handler, to avoid
running into the race condition.

Thanks to @Eckankar for pointing out the race condition that still
existed in
66ae2ad1d5

This closes https://github.com/select2/select2/issues/3300
2015-11-09 17:33:30 -05:00
Ahmad Hussain
09d825dd31 added arabic language 2015-10-22 12:01:26 +03:00
Shawn
f3a29b87e1 Fixes and issue where If args are not present script terminates 2015-10-19 15:34:44 -07:00
Nopachat Kalayanapan
9b020edd80 Correct Typo in noResults 2015-09-18 17:57:43 +07:00
Chris Rodgers
441fbc2d73 Method called using apply to avoid translating multiple args into single arg. Fixes #3756 2015-09-10 12:05:25 +01:00
Kevin Brown
eb47f638d3 Merge pull request #3698 from jbrown/patch-1
Fix typo
2015-08-25 11:35:09 -04:00
Kevin Brown
89858c418d Implement Dropdown.bind
This closes https://github.com/select2/select2/issues/3239
2015-08-21 20:51:42 -04:00
Kevin Brown
73e50ae92c Hide messages when loading results
This closes https://github.com/select2/select2/issues/3343
2015-08-21 20:49:01 -04:00
Kevin Brown
49589611ee Handle null being returned from createTag
The `createTag` option does allow for `null` to be returned if a
tag should not be created. The tokenizer previously didn't support
this, so the tokenizer should be able to handle this case. Previously
it would trigger an exception, because the tokenizer would pass back
a null value to the select function.

This also fixes what would have been a potential bug where even if a
tag was not created, the term would still have been sliced at the
location of the token. This allows for tokenizers to have special
cases when tokenizing the term, such as not splittting a token
if it is in the middle of a quoted string.

This closes https://github.com/select2/select2/issues/3593
This closes https://github.com/select2/select2/pull/3591
2015-08-21 19:12:13 -04:00
Stretch
d08cb874f9 Trigger the select event in the tokenizer
This closes https://github.com/select2/select2/issues/3325.
This closes https://github.com/select2/select2/pull/3453.
2015-08-21 18:30:35 -04:00
Kevin Brown
7166935958 Always pass in a blank object for arguments
This fixes an issue where preventing the default behaviour on some
events would trigger an exception. This was bacause the event relay
was expecting there to always be an object passed in for arguments,
and this wasn't always the case.

This closes https://github.com/select2/select2/issues/3431.
2015-08-21 17:43:50 -04:00
Kevin Brown
66ae2ad1d5 Fix input event in IE
This closes https://github.com/select2/select2/issues/3300
This closes https://github.com/select2/select2/pull/3677
2015-08-21 14:46:50 -04:00
Justin Brown
dac09005ad Fix typo 2015-08-20 13:15:57 -04:00
Bart Pelle
eee70fd9af Fix improper grammar in Dutch i18n file
Grammar is incorrect when maximum is 1, 'kunnen' should be 'kan' in that case.
2015-08-20 09:21:52 +02:00
Kevin Brown
1587708826 Merge pull request #3507 from RyanDale/issue-3503
Fixes #3503: Removes redundant 'open' event trigger
2015-08-19 22:44:30 -04:00
Kevin Brown
ea538819c3 Merge pull request #3605 from molily/master
Multiple select, search field: Removes padding on mobile Safari.
2015-08-19 21:25:01 -04:00
Kevin Brown
68d068f1d2 Prevent selections from being removed when disabled
This prevents selections from being removed when the container is
disabled. This stops any click events that are triggered on the
remove button, so the remove handler won't be triggered at all.

This closes https://github.com/select2/select2/pull/3636.
2015-08-19 21:01:19 -04:00
Kevin Brown
671f5a2ce2 Fix memory leak in AttachBody
The `$dropdownContainer` variable wasn't being cleaned up when
Select2 was destroyed, which was causing a memory leak.

This closes https://github.com/select2/select2/issues/3559.
This closes https://github.com/select2/select2/pull/3603.
2015-08-19 20:07:51 -04:00
Kevin Brown
700f7908fc Merge pull request #3654 from wdietz/master
Fix IE 8-11 not showing Chinese characters
2015-08-19 10:26:10 -04:00
Kevin Brown
47895b1e45 Merge pull request #3565 from rockshandy/issue-3564
use merged data instead of existingData for ArrayAdapter
2015-08-11 18:22:40 -04:00
Wayne Dietz
d37d6d6cac Fix issue in IE 8-11 that prevents typing characters that require multiple key presses to produce a single glyph. 2015-08-06 10:17:03 -05:00
Salahuddin Hairai
fd9ab0665d Updated Indonesian translation 2015-08-01 15:36:45 +08:00
Salahuddin Hairai
00e98e8afc Add Malay translation 2015-08-01 15:34:36 +08:00
Mathias Schaefer (molily)
a1bcd3a7ac Multiple select, search field: Removes padding on iOS. 2015-07-23 13:11:43 +02:00
Michał Zalewski
74bb22939a Fixed typo in maximum selected message 2015-07-18 10:19:10 +02:00
Phil Eberhardt
f5593e12e4 use merged newData in case where an option already exists when using ArrayAdapter 2015-07-09 18:40:56 -04:00
Florian Kissling
80630c42ec Render .select2-selection__clear before the inline content of .select2-selection__rendered.
As suggested by @njakobsen in https://github.com/select2/select2/issues/3306#issuecomment-109372777, this uses `position: relative` to alter the stacking level of `.select2-selection__clear`.
See http://www.w3.org/TR/CSS2/zindex.html#painting-order and https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Understanding_z_index/Stacking_without_z-index.

Styles are added to the default Sass for `.select2-selection--single`.
Does not include the recompiled distribution CSS.

References https://github.com/select2/select2/issues/3306.
Tested in Google Chrome v43.0.2357.130 only.
2015-07-02 03:00:21 +02:00
Stretch
698fe7b9e1 Focus is lost when the change event is triggered
This closes https://github.com/select2/select2/issues/3332.
2015-06-21 21:40:50 -04:00
Ryan Dale
d2346cc331 Change ALT + UP to close the dropdown instead of opening it
This closes https://github.com/select2/select2/issues/3471.
2015-06-21 20:47:05 -04:00
Kevin Brown
79cdcc0956 Fix focus wars in multiple selects
In the previous commit (02cca7b) support was added for multiple
selects to automatically focus when they were tabbed into. While
this did actually work, it caused a few bugs with the focus that
prevented users from tabbing out of the container, effectively
trapping keyboard users in Select2.

This makes a few major changes to how things work in Select2, but
should not break any backwards compatibility.

 - The internal `focus` event is now proxied through a `focus`
   method on the core object. This allows for two important things

   1. The `focus` event will only be triggered if Select2 was in an
      unfocused state.
   2. Select2 now (unofficially) supports the `select2('focus')`
      method again.

   But that does mean that it is possible to trigger the `focus`
   event now and not have it propagate throughout the widget. As
   it would previously trigger multiple times, even when Select2
   had not actually lost focus, this is considered a fix to a bug
   instead of a breaking change.

 - The internal `blur` event in selections is only triggered when
   the focus is moved off of all elements within the selection. This
   allows for better tracking of where the focus is within Select2,
   but as a result of the asynchronous approach it does mean that the
   `blur` event is not necessarily synchronous and may be more
   difficult to trace.

 - On multiple selects, the standard selection container is never
   visually focused. Instead, the focus is always shifted over to
   the search box when it is requested. The tab index of the selection
   container is also always copied to the search box, so the search
   will always be in the tab order instead of the selection container.

It's important to note that these changes to the tab order and how
the focus is shifted do not apply to multiple selects that do not
have a search box. Those changes also do not apply to single select
boxes, which will still have the same focus and tabbing behaviours
as they previously did.
2015-06-21 20:07:35 -04:00
Ryan Dale
c5a54ed706 Fixes #3503: Removes redundant 'open' event trigger 2015-06-21 16:30:20 -04:00
Ryan Wallace
02cca7baa7 Allow immediate typing when tabbing to multiple select. 2015-06-21 14:16:31 -04:00
Itai Nathaniel
4811ff2c59 Fixed direction bug in RTL mode of the text input 2015-06-19 18:09:25 +03:00
Quentin Pradet
5efdc35aeb Replace tabs with spaces for consistency 2015-06-18 10:19:56 +02:00
Seigo ISHINO
2dcc9ef18b Add Japanese translation 2015-06-15 14:30:08 +09:00
Kevin Brown
d7e137f8a8 Merge pull request #3464 from molily/issues/3446
ContainerCss: Remove magic `:all:` correctly. Fixes #3446.
2015-06-11 09:44:22 -04:00
Mathias Schaefer (molily)
d130bd4fa7 DropdownCSS: Remove magic :all: correctly. 2015-06-11 12:09:02 +02:00
Kevin Brown
04a4e41504 Merge pull request #3324 from stretch4x4/MultiSelectStyling
Adding container support issue #3222
2015-06-10 20:09:28 -04:00
Mathias Schaefer (molily)
62b2391972 ContainerCss: Remove magic :all: correctly. Fixes #3446. 2015-06-10 23:15:43 +02:00
Stretch
e60ab22a85 Adding single select support and testing 2015-06-10 20:05:07 +10:00
Jason
da5a72c3ac Fixed AjaxAdapter's super constructor call
Replaced ArrayAdapter super constructor call with correct AjaxAdapter super constructor call. This will allow users to initialize an Ajax select with data.
2015-05-19 16:10:16 -07:00
Stretch
13cead0bd0 Adding container support #3222
Fixes issue #3222
Now templateSelection can have access to the parent container so that
classes can be added for styling
2015-05-07 21:59:51 +10:00
Kevin Brown
ac1680d81d Merge pull request #3290 from Sopamo/master
Improving Foundation Zurb compatibility
2015-05-03 10:45:29 -04:00
Florian Kissling
73fb9a1367 Fix indention to match Select2's (and Bootstrap Sass') style. 2015-05-02 22:40:44 +02:00
Florian Kissling
a9beac83c3 Update Sass vertical gradient mixin to latest version from Bootstrap.
As described in https://github.com/select2/select2/issues/3304#issuecomment-98395238, this updates the mixin to the latest stable version from Bootstrap Sass which adds Sass' http://sass-lang.com/documentation/Sass/Script/Functions.html#ie_hex_str-instance_method to ensure that colors are converted "into the format understood by IE filters".
2015-05-02 22:38:18 +02:00
Florian Kissling
31830c7b32 Add !important to .select2-hidden-accessible.
`.select2-hidden-accessible` is the CSS class that is added to the original `<select>` element (that Select2 is initialized on) to hide it.
In cases where the original `<select>` has other style declarations assigned which conflict with those of `.select2-hidden-accessible`, the latter styles may be overridden, possibly resulting in the original `<select>` element not being properly hidden.

Similar to what https://github.com/select2/select2/pull/1549 did for Select2 v3's CSS, this adds the `!important` rule to all style declarations for `.select2-hidden-accessible` to make it exponentially harder to override them.
2015-04-30 19:09:18 +02:00
Aitor García Rey
42075c6233 Swap inputTooLong and inputTooShort error messages
"Engada"  in galician is "to add" and therefore should be the base text used for the inputTooShort method, asking the use to add more chars. It seems to be mistakenly defined exactly the opposite it should be (as inputTooLong was containing the right text).
2015-04-27 17:20:03 +00:00
Paul Mohr
d4b1247640 Improved Zurb Foundation compatibility
The input fields have a slight box shadow which we want to remove here.
2015-04-27 16:40:41 +02:00
Paul Mohr
6a551dfe74 Improved Zurb Foundation compatibility
The input fields have a slight box shadow which we want to remove here.
2015-04-27 16:38:43 +02:00
nath
e416e47356 Added back dropdownAutoWidth option
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>
2015-04-26 16:55:22 -04:00
Andrew Ognistyi
d6886fe6dd added translation for errorLoading 2015-04-22 19:32:45 +03:00
Kevin Brown
f3f1b31958 Add back *css* options through an adapter
The old functionality where classes were directly copied to the
container can be done by setting `dropdownCssClass: ':all:'` when
initializing Select2.

This closes https://github.com/select2/select2/issues/2879.
2015-04-05 21:58:02 -04:00
Kevin Brown
4fc874a3ae Improve jQuery performance issues
This improves a regression added in b9b55cec44
that reduced performance for large number of options when using a
jQuery collection object to append multiple options instead of
using a bare array containing the jQuery elements.

As `$.fn.add` is only required for jQuery 1.7.x, we can use a
utility function that only falls back to it for that specific
version of jQuery, and uses `$.fn.append` with an array for all
other versions.

This closes https://github.com/select2/select2/issues/3230.
2015-04-05 20:08:33 -04:00
penihel
c24293f2ba Render native select out of screen
This closes https://github.com/select2/select2/issues/3065.

Signed-off-by: Kevin Brown <kevin@kevinbrown.in>
2015-04-02 12:01:32 -04:00
Kevin Brown
a993ed9ca9 Warn when Select2 is called without being initalized
Since Select2 methods should not be called on an element where
Select2 has not yet been initialized, this raises an error when it
happens.  This does not silence the original error, but it does
provide the user with some more context about why they are seeing
a TypeError.

This closes https://github.com/select2/select2/issues/3173.
2015-04-02 11:41:18 -04:00
Kevin Brown
e7498987a5 Fix abort with JSONP
We now check that the `abort` method actually exists before aborting
the request, as JSONP does not include the `abort` method because
a JSONP request technically cannot be aborted.

This closes https://github.com/select2/select2/issues/3217.
2015-04-02 11:26:23 -04:00
Kevin Brown
a8e6cbc0c9 Add back keyboard support within allowClear
This adds back keyboard support, so you can now clear a selected
item using either the backspace or delete key.  This only work when
the container is closed, to prevent issues with the selection being
clear while a user is searching.

This was a regression in accessibility from 3.x.

This closes https://github.com/select2/select2/issues/3224.
2015-04-02 11:21:10 -04:00
Kevin Brown
00a78bdb1e Allow for a partial dictionary in language
This closes https://github.com/select2/select2/issues/3202.
2015-04-02 10:52:31 -04:00
Kevin Brown
01160f29d8 Allow chaining of .select2()
`.select2("open")`, `.select2("close")`, and `.select2("destroy")`
can now be safely chained.

This closes https://github.com/select2/select2/issues/3221.
2015-04-02 10:34:30 -04:00
jongwoo Yoo
da1ec4e028 fix error: "Uncaught ReferenceError: require is not defined"
Signed-off-by: Kevin Brown <kevin@kevinbrown.in>
2015-04-02 10:29:22 -04:00
Brankub
010cf29902 switched back to this instead of self 2015-03-25 10:07:55 +02:00
Brankub
2b9c8b00a7 remove evt 2015-03-24 15:14:32 +02:00
Brankub
e10f3b7dae fixes #3169 2015-03-24 14:44:23 +02:00
Kevin Brown
54154c3df6 Selected property of the element, not object
Slight revision to the changes made in
9d359c9b38.
2015-03-18 11:55:47 -04:00