diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000000..99bd4e2c09 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,203 @@ +# Guidelines for Getting Help with Select2 + +**Before** you open a new issue, you must **read these guidelines.** If it is evident from your issue that you failed to research your question properly, **your issue may be closed** without being answered. + +## Troubleshooting + +There are some common problems that developers may encounter when using working with Select2 for the first time. **If you are new to Select2**, please consult the [common problems](https://select2.org/troubleshooting/common-problems) section of the documentation first. + +If you don't find what you're looking for there, then please check the the [forums](https://forums.select2.org), [Stack Overflow](https://stackoverflow.com/questions/tagged/jquery-select2) and [existing issues](https://github.com/select2/select2/issues?utf8=%E2%9C%93&q=is%3Aissue), both opened and closed. Your question may have already been asked and answered before! + +## Asking for Help + +In general, the Github issue tracker should **only** be used for **bug reports** and **feature requests**. If you're just having trouble getting something to work, you should ask in the [forums](https://forums.select2.org) or on [Stack Overflow](https://stackoverflow.com) instead. + +### Rules for all community platforms + +1. Be polite, civil and respectful. Select2 is built and maintained entirely by volunteers. +2. If you are not conversationally proficient in English, **do not just post a machine translation** (e.g. Google Translate). Post in your native language, so that others who speak your language can help. You may post a machine translation below it for the general community to decipher. +3. Any code snippets should be formatted using [Markdown code fences](https://learn.userfrosting.com/troubleshooting/getting-help#use-markdown-to-format-blocks-of-code) and properly indented. Poorly formatted code is difficult to read and reflects badly on you as a programmer. +4. Check what you write for spelling and grammar issues. If you want others to take the time to read your question carefully, you must write your question carefully. +5. When possible create and link to a [minimal, complete, and verifiable](https://stackoverflow.com/help/mcve) example by cloning our [JSBin template](http://jsbin.com/goqagokoye/edit?html,js,output). Code dumps, zip files, etc are NOT acceptable. +6. Include relevant screenshots or animations, if possible. Drag your screenshots directly into the forums or issue tracker text box. They will automatically be uploaded and the Markdown to display them will be generated. Avoid third-party image hosts, or links which require extra clicks to view the image (except IRC, where this is unavoidable). + +### Stack Overflow + +Tag your question with the `jquery-select2` tag, and optionally with tags relevant to other technologies involved, such as `jquery` or another client-side framework. You should also mention the version of Select2 that you are using. + +### GitHub Issue Tracker + +We really appreciate clear bug reports that _consistently_ show an issue _within Select2_. If you are reporting a bug, you **must** follow these steps: + +1. Make sure that your issue is a bug or feature request. General usage and troubleshooting questions should be directed to the [forums](https://forums.select2.org) or [Stack Overflow](https://stackoverflow.com/questions/tagged/jquery-select2). Issues asking for general support WILL BE CLOSED automatically. +2. Search the current issues, both open and closed, for a similar issue. If the bug is still present but the relevant issue has been closed, you may ask us to reopen the issue. Duplicate issues will be closed automatically. +3. Make sure that you are using the latest stable version of Select2 (see the [release history](https://github.com/select2/select2/releases)). Old minor/patch versions will not be supported. +4. State the steps needed to reproduce the problem. +5. Report any errors in detail. Vague issues like "it doesn't work when I do this" are not helpful. Show that you have put some effort into identifying the cause of the error. Check your [browser console](https://learn.userfrosting.com/troubleshooting/debugging#client-side-debugging) for any Javascript error messages. +6. Mention your version of Select2, as well as the browser(s) and operating system(s) in which the problem occurs. + +Requesting features in Select2 +------------------------------ +Select2 is a large library that carries with it a lot of functionality. Because +of this, many feature requests will not be implemented in the core library. + +Before starting work on a major feature for Select2, **post to the [forums](https://forums.select2.org) first** or you may risk spending a considerable amount of +time on something which the project developers are not interested in bringing +into the project. + +# Contributing to Select2 + +Select2 is made up of multiple submodules that all come together to make the +standard and extended builds that are available to users. The build system uses +Node.js to manage and compile the submodules, all of which is done using the +Grunt build system. + +### Installing development dependencies + +Select2 can be built and developed on any system which supports Node.js. You can download Node.js at +[their website][nodejs]. + +All other required Node.js packages can be installed using [npm][npm], which comes bundled alongside Node.js. + +```bash +cd /path/to/select2/repo +npm install +``` + +You may need to install `libsass` on your system if it is not already available in order to build the SASS files which generate the CSS for themes and the main component. + +### Building the Select2 component + +Select2 uses the [Grunt][grunt] build task system and defines a few custom +tasks for common routines. One of them is the `compile` task, which compiles +the JavaScript and CSS and produces the final files. + +```bash +cd /path/to/select2/repo +grunt compile +``` + +You can also generate the minified versions (`.min.js` files) by executing the +`minify` task after compiling. + +```bash +cd /path/to/select2/repo +grunt minify +``` + +### Running tests + +Select2 uses the QUnit test system to test individual components. + +```bash +cd /path/to/selct2/repo +grunt test +``` + +### Setting up the documentation repo + +The documentation for Select2 is maintained in a [separate repository](https://github.com/select2/docs). Select2.org is built with the flat-file CMS [Grav](http://getgrav.org), using their [RTFM skeleton](https://github.com/getgrav/grav-skeleton-rtfm-site#rtfm-skeleton). + +The documentation files themselves are written in Markdown, and can be found in the `pages/` subdirectory. You can submit pull requests to the `develop` branch of the repo. + +If you'd like to set up a local instance of the entire documentation website, you must first have a web server (Nginx, Apache, etc) and PHP installed locally. Then, follow these steps: + +#### Step 1 - Install Grav + +This application uses the [Grav](https://learn.getgrav.org/) CMS. This repository does not contain a full Grav installation - rather, it just contains the contents of Grav's `user` directory, which is where all of our content, themes, and assets live. This was done as per the [recommendation on Grav's blog](https://getgrav.org/blog/developing-with-github-part-2), to make it easier to deploy changes to the live server. + +To install this website on your computer, first [install grav core](https://getgrav.org/downloads) in a project folder called `select2-docs` under your webserver's document root folder. Then, find the `user` folder inside of your project folder. Delete the contents of the `user` folder and clone this repository directly into the user folder. + +When you're done it might look something like this: + +``` +htdocs/ +└── select2-docs/ + ├── assets/ + ├── ... + ├── user/ + ├── .git + ├── accounts/ + ├── assets/ + ├── config/ + └── ... + └── ... + +``` + +#### Step 2 + +Grav needs your webserver to be able to write to certain directories. Make sure that `backup/`, `cache/`, `images/`, `logs/`, and `tmp/` are all writeable by the user account under which your webserver runs. + +#### Step 3 + +Visit the local installation in your browser! For example, [http://localhost/select2-docs](http://localhost/select2-docs). + +### Submitting a pull request + +We use GitHub's pull request system for submitting patches. Here are some +guidelines to follow when creating the pull request for your fix. + +1. Make sure to create a ticket for your pull request. This will serve as the +bug ticket, and any discussion about the bug will take place there. Your pull +request will be focused on the specific changes that fix the bug. +2. Make sure to reference the ticket you are fixing within your pull request. +This will allow us to close off the ticket once we merge the pull request, or +follow up on the ticket if there are any related blocking issues. +3. Explain why the specific change was made. Not everyone who is reviewing your +pull request will be familiar with the problem it is fixing. +4. Run your tests first. If your tests aren't passing, the pull request won't +be able to be merged. If you're breaking existing tests, make sure that you +aren't causing any breaking changes. +5. Only include source changes (`src/`). Do not make changes directly to files in the `dist` +directory. + +By following these steps, you will make it easier for your pull request to be +reviewed and eventually merged. + +Triaging issues and pull requests +--------------------------------- +Anyone can help the project maintainers triage issues and review pull requests. + +### Handling new issues + +Select2 regularly receives new issues which need to be tested and organized. + +When a new issue that comes in that is similar to another existing issue, it +should be checked to make sure it is not a duplicate. Duplicates issues should +be marked by replying to the issue with "Duplicate of #[issue number]" where +`[issue number]` is the url or issue number for the existing issue. This will +allow the project maintainers to quickly close off additional issues and keep +the discussion focused within a single issue. + +If you can test issues that are reported to Select2 that contain test cases and +confirm under what conditions bugs happen, that will allow others to identify +what causes a bug quicker. + +### Reviewing pull requests + +It is very common for pull requests to be opened for issues that contain a clear +solution to the problem. These pull requests should be rigorously reviewed by +the community before being accepted. If you are not sure about a piece of +submitted code, or know of a better way to do something, do not hesitate to make +a comment on the pull request. + +### Reviving old tickets + +If you come across tickets which have not been updated for a while, you are encouraged to revive them. If you do, please include more information in your comment on the issue. Common bugs and feature requests are more likely to be fixed, whether it is by the community or the +developers, so keeping tickets up to date is encouraged. + +Licensing +--------- + +It should also be made clear that **all code contributed to Select** must be +licensable under the [MIT license][licensing]. Code that cannot be released +under this license **cannot be accepted** into the project. + +[grunt]: http://gruntjs.com/ +[isolated-case]: http://css-tricks.com/6263-reduced-test-cases/ +[issue-search]: https://github.com/select2/select2/search?q=&type=Issues +[issue-tracker]: https://github.com/select2/select2/issues +[licensing]: https://github.com/select2/select2/blob/master/LICENSE.md +[nodejs]: https://nodejs.org/ +[npm]: https://www.npmjs.com/ diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000000..013004a479 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,20 @@ + +STOP! + +Before you open an issue: + +1. Make sure that your issue is a BUG or FEATURE REQUEST. General usage and troubleshooting questions should be directed to the [forums](https://forums.select2.org) or [Stack Overflow](https://stackoverflow.com/questions/tagged/jquery-select2). Issues asking for general support WILL BE CLOSED automatically. +2. Search the current issues, both open and closed, for a similar issue. If the bug is still present but the relevant issue has been closed, you may ask us to reopen the issue. Duplicate issues will be closed automatically. +3. Make sure that you are using the latest stable version of Select2 (see the [release history](https://github.com/select2/select2/releases)). Old minor/patch versions will not be supported. + +If you are CERTAIN that it is appropriate to open a new issue, you must: + +1. Create and link to a [minimal, complete, and verifiable](https://stackoverflow.com/help/mcve) example by cloning our [JSBin template](http://jsbin.com/goqagokoye/edit?html,js,output). Code dumps, zip files, etc are NOT acceptable. +2. Any additional code snippets should be formatted using [Markdown code fences](https://learn.userfrosting.com/troubleshooting/getting-help#use-markdown-to-format-blocks-of-code) and properly indented. Poorly formatted code is difficult to read and reflects badly on you as a programmer. +3. Include relevant screenshots or animations, if possible. Drag your screenshots directly into this text box. They will automatically be uploaded and the Markdown to display them will be generated. Avoid third-party image hosts, or links which require extra clicks to view the image. +4. If you are not conversationally proficient in English, do NOT just post a machine translation (e.g. Google Translate) to GitHub. Get help in crafting your question, either via the [forums](https://forums.select2.org) or in [chat](https://webchat.freenode.net/?channels=select2). If all else fails, you may post your bug report or feature request in your native language, with a machine translation below that. We will tag it with `translation-needed` so that others who speak your language can find it. +5. State the steps needed to reproduce the problem. +6. Mention your version of Select2, as well as the browser(s) and operating system(s) in which the problem occurs. +7. Clear out this placeholder text. + +Issues that ignore these rules will be closed without further comment! diff --git a/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md similarity index 100% rename from PULL_REQUEST_TEMPLATE.md rename to .github/PULL_REQUEST_TEMPLATE.md diff --git a/.jshintrc b/.jshintrc index 60c0a3b8ab..9429926877 100644 --- a/.jshintrc +++ b/.jshintrc @@ -9,9 +9,9 @@ "console": false, "define": false, "document": false, - "expect": false, "MockContainer": false, "module": false, + "QUnit": false, "require": false, "test": false, "window": false diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000000..5391021f45 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,272 @@ +# Change Log + +## 4.0.5 + +### Bug fixes +- Replace `autocapitalize=off` with `autocapitalize=none` (#4994) + +### Translations +- Vietnamese: remove an unnecessary quote mark (#5059) +- Czech: Add missing commas and periods (#5052) +- Spanish: Update the 'errorLoading' message (#5032) +- Fix typo in Romanian (#5005) +- Improve French translation (#4988) +- Add Pashto translation (`ps`) (#4960) +- Add translations for lower and upper Sorbian (`dsb` and `hsb`) (#4949) +- Updates to Slovak (#4915) +- Fixed Norwegian `inputTooShort` message (#4817, 4896) +- Add Afrikaans translation (`af`) (#4850) +- Add Bosnian translation (`bs`) (#4504) + +## 4.0.4 + +### New features / Improvements +- Make tag matching case insensitive [https://github.com/select2/select2/commit/cb9a90457867ffb14c7b1550bb67e872e0a5c2dd, https://github.com/select2/select2/commit/1167bace78cd3b1a918c1b04f3bac54674eab62b] +- Support selecting options with blank or `0` option values [https://github.com/select2/select2/commit/16b4840c0e2df0461998e3b464ee0a546173950d, https://github.com/select2/select2/commit/0358ee528765157234643d289bce6b8ca5889c72] + +### Bug fixes +- Fix issue with entire form losing focus when tabbing away from a Select2 control (#4419) +- Fix UMD support for CommonJS [https://github.com/select2/select2/commit/45a877345482956021161203ac789c25f40a7d5e] + +### Documentation +- Github Pages documentation has been deprecated, replaced with https://github.com/select2/docs +- Add django-autocomplete-light to integrations [https://github.com/select2/select2/pull/4597] +- Correct typo in options page [https://github.com/select2/select2/pull/4389] +- Correct misspelling in AJAX query parameters example [https://github.com/select2/select2/pull/4435] +- "highlight" should be "focus" in focus example [https://github.com/select2/select2/pull/4441] +- Correct misspelling in `` is now handled [https://github.com/select2/select2/commit/31e7a1d4c52ed7477769fcad5d15166ae3c9b4d0] +- Adding and removing options now refreshes the selection automatically [https://github.com/select2/select2/commit/ea79a197e0ffe55aa600eed6d18cbd1c804c3176] + +### Bug fixes +- `select2('option')` no longer mutate the arguments when working on multiple elements [https://github.com/select2/select2/commit/c2c1aeef31c95c6df5545c900a4e1782d712497c] +- Better detect aborted requests [https://github.com/select2/select2/commit/cfb66f5e4f71a56c46a6890c5dde4b7f24f11fa8] +- New options are now properly created during tokenization [https://github.com/select2/select2/commit/3b8cd2e36990e695e4cb4b966c8658e7ca1574dc] +- Fix positioning bug with non-static parents for the dropdown [https://github.com/select2/select2/pull/4267] +- Infinite scrolling no longer resets the keyboard focus [https://github.com/select2/select2/commit/e897d008a672da262ba84cee2a144578696ada29, https://github.com/select2/select2/commit/9f581285d88128b29a01fc1e5fd2d445d610b553] +- `selectOnClose` now works properly with `closeOnSelect` [https://github.com/select2/select2/commit/481c43883e23874e9c35879d173eb8cc5b994b12] +- Apply `ajax.delay` to empty search terms as well [https://github.com/select2/select2/commit/4b9e02f02211248be25ac4c16d4635cf38237bb9] + +### Documentation +- Added example for attaching event listeners [https://github.com/select2/select2/commit/84d6b5d840f7f4e6b7a2fb3f08424bf5495c876d] +- Correct link to the [Select2 Bootstrap Theme](https://github.com/select2/select2-bootstrap-theme) [https://github.com/select2/select2/pull/4318] +- Added example for using a `