1
0
mirror of synced 2024-11-22 04:56:08 +03:00
Commit Graph

2569 Commits

Author SHA1 Message Date
Kevin Brown
bbd320d75e Convert source and tests to unix newlines 2019-07-20 23:01:38 -04:00
Kevin Brown
1b5a962819
Revert change to focusing behaviour in 4.0.6 (#5576)
This behaviour, where the focus was happening on a small asynchronous
delay, was added in commit 933189b92 late last year in a commit with
no supporting tickets or commit message explaining what the change
was trying to accomplish. This commit has effectly been reverted within
this commit, since it caused a regression in how focus was being
assigned that made it inconsistent with a standard `<select>`.

A test was added for this which ensures that we won't see that
regression again.

Fixes #5532
Fixes #5185
Closes #5552
2019-07-20 22:44:28 -04:00
Kevin Brown
d9260254c1
Fix infinite scroll when the scrollbar is not visible (#5575)
Ever since the 4.0.0 release of Select2, there has been a bug where
if you enabled infinite scrolling but did not return enough results
on the first load of AJAX to show a scrollbar, then infinite
scrolling would not be enabled and you could not view anything other
than the first page of results. The solution for this was first
proposed in #3888 but it was closed off because of inactivity and
missing tests.

This fixes the issue by performing the check to see if more results
should be loaded both on scroll and also when the results are first
loaded. This solves the issue that we were seeing before, because
the plugin knows it needs to load in more results, just it did not
receive the scroll event before and thus was not able to actually
load in the new results.

This has the potential to trigger multiple AJAX requests to load in
multiple pages of results if the user has the ability to see many
options, but only a few are being loaded at a time.

This also adds tests for infinite scrolling, both to ensure that
it will attempt to load additional pages, even without the scrollbar,
and to ensure that the regular behaviour of not loading additional
pages when the scrollbar is visible is preserved.

Fixes #3088
2019-07-20 18:09:17 -04:00
kevin-j-morse
8a5aeabcce Remove deprecated jQuery shorthand (#5564) 2019-07-20 16:05:48 -04:00
Min ho Kim
9c4f0c86a1 Fix typos (#5574) 2019-07-20 12:42:18 -04:00
Kevin Brown
1f79acbe5f Fix XSS issue in AJAX example 2019-07-10 00:25:40 -04:00
Kevin Brown
1c394a421b Fix XSS issue in templating example 2019-07-10 00:00:02 -04:00
Kevin Brown
03e1b69751 Merge branch 'master' into develop 2019-07-09 23:24:30 -04:00
Kevin Brown
bd7ac9df03
Results respect disabled state of <option> (#5560)
This check is in place in most other places, mostly because we have
run into widespread issues under similar circumstances and we like to
avoid those, but it was forgotten here. There also were no tests
covering this, so it was never caught.

This adds tests that ensure that the option in the results list will
be generated with the correct "disabled" state based on whether or
not it, or a parent element, is marked as disabled.

This should have been easy: just check `element.disabled`

Unfortunately the `disabled` property is not inherited within the
option chain, so if an `<optgroup>` is disabled, the `<option>`
elements or other `<optgroup>` elements held within it do not have
their `disabled` property set to `true`. As a result, we needed to
use the `matches` method to check if the `:disabled` state is
present for the element. The `matches` method is part of the official
standard, but it was not implemented under that name for a while and
as a result Internet Explorer only supports it under the prefixed
`msMatchesSelector` method and older versions of Webkit have it
implemented as `webkitMatchesSelector`. But once we use this method,
it appears to consistently return the expected results.

This `matches` method and prefixed predecessors are not supported in
IE 8, but they are supported in IE 9 and any browsers newer than
that. Instead of buulding a very hacky solution using
`querySelectorAll` that was brittle, I have chosen to act like
everyone else and pretend IE 8 no longer exists.

Fixes #3347
Closes #4818
2019-07-09 20:58:13 -04:00
Kevin Brown
b5f136ff72
Add computedstyle option for calculating the width (#5559)
This allows for more accurate resolution of the width when compared
to the `resolve` method. This is more relevant for jQuery 1.x, where
the `resolve` method cannot find the width of a hidden select box,
but it also applies to newer versions of jQuery where the `width()`
method provided by jQuery doesn't fully match `getComputedStyle()`.

Fixes #3278
Fixes #5502
Closes #5259
2019-07-09 19:44:33 -04:00
Kevin Brown
f9decd6094
Fix tag creation being broken in 4.0.7 (#5558)
* Add test for losing focus when searching tag entries

* Revert unknown unit test fix

Removing this no longer breaks a unit test, and having it in here
results in the select box receiving focus unexpectedly. It's not
clear what problem this was solving, since it was manually applied
from a series of pull requests.

It claims to be fixing an issue that was specific to IE11, and I'm
willing to re-introduce that bug because there doesn't appear to be
a regression test for it, and it's breaking some critical use cases.

The goal should be to focus the search box if it would have normally
lost focus when the selection was updated.

Fixes #5485
Fixes #5516
Closes #5550
2019-07-09 19:13:03 -04:00
Kevin Brown
9491e1aae2
Test against jQuery 3.4.1 (#5531)
* Update tests to be compatible with jQuery 3.0.0

There was a change in jQuery 3 that ensures that the return value of `.val()` on a multiple select is always an array. This is a breaking change from previous versions, where `null` or `undefined` were returned in these scenarios. Because we cannot `assert.equal` on a list of possible values, these assertions were switched to `assert.ok` which should be good enough.

* Properly strip out units in positioning tests

Before we were assuming that there were no units, and only were we stripping them out if we were expecting 3 digits. Now we just strip out all non-digit characters, so that should do the job and get us what we want.

There was a change in jQuery 3.2.0 that caused the units to be returned in these specific calls. They were not previously being returned, so this was not actually an issue.

* Add automated testing against jQuery 3.4.1

No tests appear to be currently failing.
2019-06-25 22:05:15 -04:00
Waseem Ahmad
d66e55dd9e removed select2-selection__placeholder from _multiple.scss (#5508) 2019-06-25 21:59:56 -04:00
Kevin Brown
5d2fdd75b5
Update grunt-contrib-qunit to latest version (#5530)
We needed to define the `qunit` module in the unit tests because there was a change in grunt-contrib-qunit 0.6.0 that breaks when you define an AMD loader. It expects that the AMD loader is also used to load QUnit, instead of just being used to support the tests, so if you don't define the qunit module it will just hang and do nothing. Luckily we have the helpers file to help us out here, since it allows us to globally define this module.
2019-06-04 22:43:52 -04:00
Kevin Brown
70ca392a43
Update dev dependencies (#5529)
* Update dev dependencies

* Adjust dependencies versions to avoid unmet peer dependency error

* Update Travis CI node version to 8

* Recompile dist

This updates all of the minified files to use the latest uglifyjs version, which results in better compression (by a small margin).
2019-06-04 21:18:37 -04:00
bufferUnderrun
36b226d509 Improve French Translation (#5521)
better translation of the english word "items" to "éléments"
2019-06-04 20:47:35 -04:00
Kevin Brown
d53958ad2b
Clean up docs (#5528)
* Remove SauceLabs credentials

SauceLabs is no longer used during builds, so we no longer need to include these encrypted credentials.

* Clean up badges

* Remove SauceLabs from the README

* Misc README fixes

* Disable Travis email notifications

Looks like we accidentally re-enabled these when removing IRC.
2019-06-04 20:46:45 -04:00
Kevin Brown
0a612f92e1
Automatically deploy to NPM (#5527)
* Added deployments to NPM on tagged releases

Previously this was being done manually after each release, which resulted in a few releases not showing up on NPM for  a significant amount of time. Now the builds should be automatically pushed, which should hopefully improve a lot of the issues we were seeing.

* Drop IRC notifications

We no longer use this IRC channel.

* Clean up .travis.yml

* Remove grunt ci

This is no longer needed now that we don't do anything special for CI builds. This also allows us to minify during CI builds, which will be useful for the tagged builds which depend on these minified files being up to date (so they can get released as well).
2019-06-04 20:26:11 -04:00
Patrizio Bekerle
ad0451d2fd Fix a typo (#34) 2019-06-04 19:54:11 -04:00
Kevin Brown
8020724bd2 Bump versions for Select2 4.0.7 release 2019-05-07 16:22:31 -04:00
Kevin Brown
04fce55967
Merge pull request #5507 from select2/develop
Release Select2 4.0.7
2019-05-07 16:14:21 -04:00
Kevin Brown
f8193c6c82
Merge pull request #5506 from select2/release/4.0.7
[Release] 4.0.7
2019-05-07 16:08:47 -04:00
Kevin Brown
5285eef7b5 Recompile dist for 4.0.7 2019-05-07 16:05:00 -04:00
Kevin Brown
20ffd1296a Bump versions for 4.0.7 release 2019-05-07 16:02:59 -04:00
Kevin Brown
d0ddab6ceb
Merge pull request #5494 from select2/develop
Release Select2 4.0.7-rc.0
2019-04-30 23:44:31 -04:00
Kevin Brown
df3c343490
Merge pull request #5493 from select2/release/4.0.7-rc.0
[Release] 4.0.7-rc.0
2019-04-30 23:41:42 -04:00
Kevin Brown
2596f2ab9c Update changelog for 4.0.7-rc.0 release 2019-04-30 23:37:24 -04:00
Kevin Brown
647533e981 Recompile dist for 4.0.7-rc.0 release 2019-04-30 23:37:08 -04:00
Kevin Brown
48e2f56fea Bump versions for 4.0.7-rc.0 release 2019-04-30 23:33:21 -04:00
Carlos Abalde
f6c455cea9 Do not close on select if Ctrl or Meta (Cmd) keys are being held as described in #3400 (#5222)
Fixes #3400
2019-04-30 23:29:11 -04:00
Kevin Brown
2a5f46bcc4
Move almost and jquery-mousewheel to devDependencies (#5489)
These two are required at build time to generate the full builds
of Select2 (for jQuery Mousewheel) and to inject the AMD loader
(for Almond.js). They are not required for anyone who depends on
Select2, since jQuery Mousewheel is an optional dependency.

This may result in some people needing to add jQuery Mousewheel to
their projects as a required dependency, if they were expecting
it to be added by Select2 before.
2019-04-30 23:15:22 -04:00
Austin S. Hemmelgarn
39bfabd94b Revert PR #5356. (#5492)
It doesn't really do what it says it does, and it introduces other
issues (single select elements re-open after selection).

Fixes #5490
2019-04-30 23:13:50 -04:00
Kevin Brown
a1bd03c408 Bump versions for Select2 4.0.6 release 2019-04-28 04:06:35 -04:00
Geoffroy ARNOUD
3c26bd0ebd Update docs.md (#29)
Fixed "paginate" into "pagination" in optgroups formmat
2019-04-28 14:39:26 -04:00
Takashi Kanemoto
6009970b10 docs: add link to @ttskch/select2-bootstrap4-theme to README.md (#5487) 2019-04-28 00:06:02 -04:00
Kevin Brown
5dcc1022bf
Merge pull request #5488 from select2/develop
Release Select2 4.0.6
2019-04-27 23:14:15 -04:00
Kevin Brown
3e9809d715 Update changelog for 4.0.6 release 2019-04-27 23:02:30 -04:00
Kevin Brown
a2bfa6c867 Recompile dist for 4.0.6 release 2019-04-27 22:43:33 -04:00
Kevin Brown
a8ea4cc3e3 Bump versions for 4.0.6 release 2019-04-27 22:42:34 -04:00
Kevin Brown
b4aa3529f3 Removed unused files
* select2.jquery.json - This was previously used by the jQuery Plugin
  Registry which was shut down and put into read-only mode a few
  years ago. Since nobody else appears to use this file, it doesn't
  make sense for us to keep bumping the version in it and keeping it
  up to date.
* vendor/ - This was needed back when the full version of Select2
  actually bundled its own version of jQuery. Since we never actually
  did this, we no longer need to keep the copy of jQuery around.
2019-04-24 17:25:35 -04:00
Kevin Brown
650035cf38
Restore compatibility with data-* attributes in jQuery 2.x (#5486)
* Start running tests against jQuery 2.x

We were only running tests against jQuery 1.x before and they were
all passing. This was a problem because apparently all of the data-*
attribute tests fail in jQuery 2.x.  We are now running both the
integration and unit tests against both jQuery 1.x and jQuery 2.x.

Right now this resulted in a complete duplication of the test files
because there wasn't an obvious way to run the tests against both
versions. We're going to look into removing this duplication in the
future once the current issues are fixed.

We are also going to look into testing against jQuery 3.x in the
future, since that is also a supported line of jQuery.

* Force the data-* attributes to be parsed

There was a change made that switched us from using `$.data` and
`$.fn.data` internally to using an internal data store (managed
through internal utilities). This had the unfortunate side effect
of breaking the automatic loading of data-* options in versions of
jQuery other than 1.x, which included anything that would be
considered modern jQuery. While the change was made and approved
in good faith, all of the tests passed and the docs pages appeared
to be working, the tests really failed when running on newer versions
of jQuery. This was confirmed when we started running automated tests
against both versions, which confirmed the bug that others have been
seeing for a while.

The change was made becuase calling `$.fn.data` on an element which
contains a reference to itself in the internal jQuery data cache
would cause a stack overflow. This bug was well documented at the
following GitHub ticket and was resolved by no longer using
`$.fn.data`: https://github.com/select2/select2/issues/4014

Unfortunately because `$.fn.data` was no longer being called in a
way such that all of the data attributes would be dumped out, we
needed to find a replacement. The substitute that was given in the
original bug fix worked when the data cache was fully primed, but
we never primed it anywhere so it actually failed in the general
case. That meant we needed to find a way to manually prime it,
which is exactly what this change does.

* Clean up select2/utils
2019-04-27 22:20:56 -04:00
Kevin Brown
9f8b6fff40
[WIP] Get Grunt consistently working again (#5466)
Get Grunt consistently working again
2019-03-19 23:16:01 -04:00
Anastasios Gogos
5977856d81 minor fix (greek omega used has no diacritic) (#5464)
replaced \u03C9 (GREEK SMALL LETTER OMEGA: ω)
with \u03CE (GREEK SMALL LETTER OMEGA WITH TONOS: ώ)
2019-03-18 23:19:52 -04:00
Rodrigo
a9c1b617fa Update composer to remove deprecated dependency (#5165) 2019-03-18 22:36:26 -04:00
MaximAL
9032705e2a More suitable spelling ещё instead of еще (#5401) 2019-03-12 22:13:49 -04:00
Thanh Phan
97c5304518 Update Vietnamese (vi) translation (#5387) 2019-03-12 22:10:00 -04:00
Kevin Brown
b3705b13be Enable the Stale integration
Right now we have a ton of old, stale tickets and this should allow us to get a hold of the problem and try to get ahead of it.
2019-03-12 22:07:42 -04:00
niftylettuce
d86894d890 Added documentation example for BS3 modal shown event binding (#12)
* Added documentation example for https://github.com/select2/select2/issues/5189

* Update docs.md
2018-09-17 13:51:04 -03:00
Nisha Kaushik
14a059d7ee #4530 Add tooltip (title) to the 'remove all' 'X' icon. (#5291)
* #4530 Add tooltip (title) to the 'remove all' 'X' icon.

* #4530 Add tooltip (title) to the 'remove all' 'X' icon.

* #4530 Add tooltip (title) to the 'remove all'

* Revert dist folder.

* add tk.js from pull request.
2018-09-15 16:22:54 -03:00
Pedro Felipe de Azevedo Furtado
933189b92e
Update base.js 2018-09-15 01:14:25 -03:00