1
0
mirror of synced 2024-11-24 22:06:07 +03:00
Commit Graph

825 Commits

Author SHA1 Message Date
Vasily Kazantsev
7c1ceb8fd9 filter 229 keyCodes (input method editor is processing key input) 2014-06-22 19:07:36 +03:00
Siegfried Bilstein
2690053010 Fixes #2434 Tagging support allows creation of tags that are only whitespace 2014-06-21 11:37:53 -07:00
Kevin Brown
a73d1b2b52 Merge pull request #2465 from rvitaliy/patch-1
fixed destroy
2014-06-17 21:00:51 -04:00
tjperovich
c0cc6c9f94 Fix there/their typo 2014-06-17 10:11:09 -04:00
Vitaliy Ryaboy
78526a3860 Update select2.js
fixed destroy
2014-06-17 13:47:31 +02:00
Kevin Brown
5a7d250071 Merge pull request #2444 from surgeforward/undefined-top
Fix error: Cannot read property 'top' of undefined
2014-06-15 16:22:04 -04:00
Kevin Brown
3fee8fc7e6 Detect classes separated by multiple spaces
This detects classes separated by multiple spaces and will trim
extra spaces surrounding the class attribute.

This closes the following issue: https://github.com/ivaynberg/select2/issues/2358
2014-06-11 20:08:57 -04:00
Kevin Brown
9e17f63013 Normalized select2-selecting event
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
2014-06-11 20:02:23 -04:00
Kevin Brown
b13c9b474d Small formatMatches change for single results
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
2014-06-11 19:52:08 -04:00
Cameron Spear
0675805621 Fix error: Cannot read property 'top' of undefined
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.
2014-06-06 19:04:14 -07:00
Santi Albo
db86f19552 Remove added line 2014-05-28 18:17:31 +01:00
Santi Albo
b8ce36a65e Add text function for formatResult and formatSelection 2014-05-28 18:13:26 +01:00
Kevin Brown
d487fc58a8 Merge pull request #2360 from ycdtosa/master
changes on updateResults, populate by @cervengoc on #781
2014-05-27 19:09:38 -04:00
Kevin Brown
f544f9d9ab Merge pull request #2367 from gschizas/master
Added Greek accented characters to ignorable diacritics
2014-05-27 18:56:07 -04:00
Kevin Brown
fba74e3ccd Merge pull request #2363 from thereloaded/master
query as third parameter to ajax results callback
2014-05-27 16:50:52 -04:00
Braden M. Kelley
88c6a63937 IE8 does not support Array.prototype.forEach #2339 2014-05-23 10:29:25 -07:00
Cyril Nicodème
02d6e88747 Update select2.js
Fix an exception when called "destroy" on a still opened dropdown.
2014-05-20 09:30:35 +02:00
TheSisb
e2cd841fe8 Handling mousemove more delicately
Mousemove fires very frequently and is a sure way of killing any app's FPS.  This tweak makes sure it is only bound when it is in fact needed.
2014-05-14 15:25:05 -07:00
George Schizas
827a549ba8 Reverted formatting of diacritics variable, now is again in one line 2014-05-13 17:11:14 +03:00
George Schizas
68c64a1129 Enabled Greek for diacritics ignoring 2014-05-13 17:05:46 +03:00
George Schizas
df43e1a1ec fixed word wrapping for DIACRITICS variable 2014-05-13 16:59:41 +03:00
ycdtosa
0f8a85b994 update populate at formatResults to use bulk append of nodes
this will make a small (25%) improvement on speed.
2014-05-13 12:27:52 +02:00
ycdtosa
c14f45cb6c Revert "changes on updateResults, populate by @cervengoc on #781"
This reverts commit 12e0de21ae.
2014-05-13 09:54:00 +02:00
thereloaded
49a86e21ed added query to function head jsdoc block 2014-05-13 09:34:16 +02:00
Joshua Jonah
64256f27f2 Stopped refresh to top when closeOnSelect: false
Not really sure how the noHighlightUpdate variable is supposed to work, it is undefined all the time so it appears to be broken. I just referred to `this.opts.closeOnSelect` to get the status directly.
2014-05-12 21:44:27 -04:00
thereloaded
f07bab5a6b query as third parameter to ajax results callback
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
2014-05-12 19:35:59 +02:00
ycdtosa
12e0de21ae changes on updateResults, populate by @cervengoc on #781
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
2014-05-12 11:39:54 +02:00
Kevin Brown
c864392ffb Merge pull request #2326 from dawnhammond/feature/2084
Fix issue with dropdown menu getting stuck in IE when using multiselect
2014-05-05 19:23:36 -04:00
Braden M. Kelley
2133129a74 keyword this inside closures referring to wrong object 2014-05-01 08:54:32 -07:00
Kevin Brown
ea3c6766a2 Merge pull request #2164 from colemanw/evaluateFix
Provide context for evaluated functions
2014-05-01 10:08:42 -04:00
Kevin Brown
988eccb557 Merge pull request #2332 from FallSe7en/master
Unbind onpropertychange event handler on destroy for IE8-10
2014-05-01 10:05:20 -04:00
Kevin Brown
fb6ef71ba0 Merge pull request #2337 from snrmwg/master
Query term in tags function in select2 3.4 #2141
2014-05-01 09:44:34 -04:00
Marc Schneider
ca859e4e42 Query term in tags function in select2 3.4 #2141 2014-05-01 15:35:32 +02:00
Justin Lei
0313630c57 Unbind onpropertychange event handler on destroy for IE8-10 2014-04-29 17:08:23 -07:00
Dawn Hammond
796661a11d change condition to use length 2014-04-28 16:49:08 -05:00
Dawn Hammond
e3751422f0 Fix focus issue when select-input has placeholder 2014-04-28 14:15:50 -05:00
marek
97b897abe0 Set id in unescaped version. 2014-04-28 13:12:28 +02:00
marek
3c1482ae45 Replace dots with underscores in event handler names. Dots are processed in special way in jQuery on/off. 2014-04-28 12:59:17 +02:00
Kevin Brown
8b463bff14 Merge pull request #2287 from eduardojmatos/master
Testing if the dropdown is opened before call positionDropdown
2014-04-26 19:28:59 -04:00
Kevin Brown
1c7706ad9e Merge pull request #2307 from IFours/master
Recalculation dropdown height if dropdownAutoWidth is true
2014-04-26 16:16:45 -04:00
Kevin Brown
9e505cdf27 Merge pull request #2313 from FallSe7en/master
Cleanup jQuery DOM elements on destroy
2014-04-26 15:59:47 -04:00
Kevin Brown
6b689fc4e0 Merge pull request #2302 from ivaynberg/issue_1541
Only disable keyboard focusing for touch devices
2014-04-26 15:46:26 -04:00
Justin Lei
f9be3c039c Issue 234368 for the Chromium project is fixed now (Issue #1099) 2014-04-23 17:22:58 -07:00
Justin Lei
6156abc2a8 Cleanup jQuery DOM elements on destroy 2014-04-23 17:14:13 -07:00
Kevin Brown
2e79f5eb4f Only disable keyboard focusing for touch devices [Fixes #1541]
This fixes the issue [1] by first checking to see if the current
device is a touch device.  The other issue [2] that occured because
of the original fix [3] is now fixed, because the hidden inputs
are always focused by default on non-touch devices.

The code used for detecting touch devices was pulled from
StackOverflow [4].  Information on the reasoning behind this fix
can be found on GitHub [5].

[1]: https://github.com/ivaynberg/select2/issues/1541
[2]: https://github.com/ivaynberg/select2/issues/2223
[3]: d87e93dd45
[4]: http://stackoverflow.com/a/15439809/359284
[5]: https://github.com/ivaynberg/select2/issues/1541#issuecomment-39805859
2014-04-22 20:25:19 -04:00
IliaFours
ffddc48a24 Recalculation dropdown height if dropdownAutoWidth is true 2014-04-22 14:54:36 +03:00
Marc Schneider
42f2acd0aa Query term in tags function in select2 3.4 #2141 2014-04-21 00:18:19 +02:00
Kevin Brown
79e031fbdf Merge pull request #2241 from zocoi/master
Trap touch events within container
2014-04-18 18:52:40 -04:00
jorupp
632595f530 Fix issue syncing CSS classes in IE9/10 2014-04-15 16:36:24 -05:00
Eduardo Matos
22d503f846 Avoid call 'positionDropdown' function if the container it's closed 2014-04-15 10:51:23 -03:00
interestincode
7c9c9612b5 Update select2.js
As suggested in https://github.com/ivaynberg/select2/issues/781#issuecomment-38979100, significantly improves search speed, going from unusable to snappy on IE on a list of almost 10,000 items with a custom query limiting it to 25 results. Uses 'uni range + named function' from http://jsperf.com/diacritics/18
2014-04-15 02:08:16 -07:00
Kevin Brown
24f4bbfefb Merge pull request #2257 from mkurz/title_fix
Copy title attribute from original element
2014-04-14 22:05:37 -04:00
Kevin Brown
f48df6f369 Merge pull request #2153 from 2color/patch-1
Fix a typo in the docs.
2014-04-14 21:30:47 -04:00
Eduardo Matos
3f43f459e9 Testing if the dropdown is opened before call positionDropdown, on events by resize, scroll and orientation 2014-04-11 14:02:11 -03:00
Kevin Brown
60d74da872 Merge pull request #2225 from davidfstr/fix_empty_placeholder
Allow an empty string to be used as the placeholder title.
2014-04-09 10:59:10 -04:00
Matthias Kurz
bdb8840fb4 Copy title attribute from original element 2014-04-09 12:36:43 +02:00
Matthias Kurz
47005ede3a xhtml compatibility 2014-04-09 11:56:31 +02:00
Hung Dao
534bbff06f trap touchstart touchend events within container 2014-04-03 17:06:08 -07:00
Anthony Dmitriyev
c77e159178 Another solution for clicks triggered on underlying elements 2014-04-03 17:28:13 +03:00
Kevin Brown
0d06066331 Merge pull request #2238 from mkurz/focus-fix
Prevent the cursor from setting it to initial position in IE
2014-04-03 09:01:30 -04:00
Kevin Brown
e801573328 Merge pull request #2236 from mkurz/destroy_fix
.destroy() should destroy all selected select2
2014-04-03 08:47:46 -04:00
Kevin Brown
43a598b372 Merge pull request #2216 from lboynton/fix-search-focus-on-mobile
Fix search focus on mobile
2014-04-03 08:44:45 -04:00
Matthias Kurz
dcabde40c3 Prevent the cursor from setting it to initial position in IE 2014-04-03 12:19:37 +02:00
Matthias Kurz
ddcb61585a .destroy() should destroy all selected select2 2014-04-03 10:59:21 +02:00
Fabrice Daugan
dd6198a3fa Ignore focus and error on IE7 for disabled select2
For disabled components, focus event was triggered.
On modern browser this error was ignored but not on IE7.

This PR save weird focus event and IE7 JS error.
2014-04-02 14:03:01 +02:00
David Foster
3ce3ad7fb0 Allow an empty string to be used as the placeholder title. 2014-04-01 14:22:41 -07:00
Lee Boynton
2d6b74c2ac Also check if search input should be focussed for multiselects 2014-03-31 21:01:06 +01:00
Lee Boynton
ed0bae39c9 Check if search should be focused when the dropdown is activated 2014-03-28 14:56:45 +00:00
Lee Boynton
ad21d01693 Check if search input should be focussed when opening 2014-03-28 14:46:41 +00:00
pineapple-thief
70873abe9d Update select2.js
Fixes unpleasant glitch where initializing select2 on select where first input option tag has non-breakable space in innerText causes selected option to be displayed as "undefined" until user changes selection. (i.e. HTML was like <option value>&nbsp;</option>, that's what Rails 3 f.select helper generate by default).
2014-03-28 15:45:38 +11:00
Kevin Brown
2752563c80 Merge pull request #2096 from springboardretail/mobile-fixes
make selection on iOS more intuitive
2014-03-21 20:36:40 -04:00
Kevin Brown
63f342a12f Revert "Add hideSelectionFromResult function"
This reverts commit 84cf134a4e.

New problems found in:
https://github.com/ivaynberg/select2/issues/2196

Original issue:
https://github.com/ivaynberg/select2/issues/1538

Pull request:
https://github.com/ivaynberg/select2/pull/2032
2014-03-21 19:50:30 -04:00
Diogo Trentini
6c731f4181 Fix method to get space above the dropdown
It's better to get the scrollTop value from window rather than body
to update enoughRoomAbove variable. This method is supported by
the main browsers.
2014-03-20 21:45:41 -03:00
Adam Schepis
eb09dfcce0 make selection on iOS more intuitive
allow touchend to cause selection of touched item.
Detect touchmove events so that selection of touched item can be canceled
2014-03-13 22:24:19 -04:00
Matt Slocum
2342d91925 Fix Focus war with modals
Bootstrap modal (and maybe others) require focus to maintain in the modal (because that what a modal is). The dropdown is outside of the modal, so we need to stopPropagation on the event so the modal doesn't know.
2014-03-11 12:14:17 -06:00
Kevin Brown
2d906ee10f Merge pull request #2140 from ivaynberg/issue_1541
Add `shouldFocusInput` option [Fix #1541]
2014-03-07 10:14:32 -05:00
Kevin Brown
51e5d436ff Merge pull request #2160 from s7anley/bugfix/2073-select2-removing
Multiselect items are not removed when event is prevented
2014-03-07 10:12:01 -05:00
Coleman Watts
43e381ed37 Provide context for evaluated functions 2014-03-05 21:02:06 -05:00
Kevin Brown
e6fbfcd101 Merge pull request #2125 from colemanw/evaluateFix
Fix evaluation of formatLoadMore
2014-03-05 20:57:43 -05:00
Ján Koščo
f3c6d6d51f After prevented removing of item in multiselect, proper item is focused 2014-03-05 11:27:08 +01:00
Ján Koščo
86a9c79b04 Removed unnecessary animation during unseint multiselect by close button 2014-03-05 11:27:03 +01:00
Ján Koščo
2059b5d4d3 Unselected item is returned as options only if event isn't prevented 2014-03-05 11:26:50 +01:00
Daniel Norman
660643ae87 Fix a typo in the docs. 2014-02-28 11:21:53 +01:00
dhardtke
60359f9d43 fix select2 csp errors / warnings 2014-02-27 20:07:57 +01:00
Kevin Brown
d87e93dd45 Add shouldFocusInput option [Fix #1541]
This adds a `shouldFocusInput` option that determines whether or
not the focusser should be automatically focused.  By default, the
focusser will always be focused, unless `minimumResultsForSearch`
is less than zero.

`close` on single selects took an option `params` argument which
at one point was used to tell the focusser to not automatically
focus.  This was added at one point when tweaking the mask [1]
and later reverted to fix a bug that came as a result [2].  The
leftovers of this code has been removed in this commit.

[1]: e162a4802c
[2]: 9bc68f089e
2014-02-21 20:06:21 -05:00
Pete Campbell
2a4e026b49 Bugfix - only selected options that are not disabled should be used when initializing the dropdown 2014-02-17 21:16:26 -05:00
Coleman Watts
9460b0c9b6 Fix evaluation of formatLoadMore 2014-02-14 17:14:12 -08:00
Kevin Brown
3c28c35503 Merge pull request #2095 from mkurz/readonly_chaining
Allow chaining for .select2('readonly', ...)
2014-02-03 15:46:53 -08:00
Matthias Kurz
bd3bd55719 Allow chaining for .select2('readonly', ...) 2014-02-03 16:07:23 +01:00
Coleman Watts
175c78441f Accept strings as well as functions for localization 2014-01-31 21:04:36 -08:00
Jeanmonod David
ed77cab7d5 Allow to display item created by createSearchChoice at the end of the list
ref #595
2014-01-24 18:54:56 +01:00
jdecuyper
c87615f14c The function hideSelectionFromResult was tested against undefined as a property and not as a function 2014-01-21 11:45:13 -06:00
Kevin Brown
0f1372ce72 Merge pull request #1733 from flyerhzm/append-label-only-when-formatted-defined
append label only when formatted is not undefined
2014-01-21 05:49:36 -08:00
Marchenko Alexandr
89ae701691 merge 2014-01-21 12:17:58 +02:00
Marchenko Alexandr
2e901f79a1 merge 2014-01-21 11:54:48 +02:00
Kevin Brown
e559f92c35 Merge pull request #2001 from arendjr/master
Don't rely on :visible and :not(..., ...) selectors which only work with Sizzle
2014-01-20 16:48:27 -08:00
Marchenko Alexandr
f4886a0afa Optional Search Input Placeholder parameter added 2014-01-20 11:38:33 +02:00
jdecuyper
84cf134a4e Add hideSelectionFromResult function 2014-01-19 21:12:39 -06:00
Tim Robertson
eaf09c7f76 Accessibility updates based on jQuery UI Autocomplete 2014-01-19 18:52:56 -05:00
Sebastian Kather
48d392635f singleSelect: setting nextSearchTerm in initSelection
For single select the nextSearchTerm callback is called when
initSelection returned data
2014-01-16 16:12:00 +01:00