28 KiB
		
	
	
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			28 KiB
		
	
	
	
	
		
			Executable File
		
	
	
	
	
Change Log
4.1.0 (unreleased)
Breaking changes
- The minimum jQuery version supported is the latest version in the 1.x, 2.x, and 3.x series (#5525, #5955)
- Removed support for legacy Internet Explorer (versions older than IE 11) (#5834)
- Removed modules deprecated in 4.0.0 (#5815)
- Removed legacy support for <input />tags
- Removed legacy support for initSelection
- Removed legacy support for query
- Removed old select2/compat/matchermodule
 
- Removed legacy support for 
- Removed undocumented CSS-related options (#5815)
- Removed dropdownCssoption
- Removed adaptDropdownCssoption
- Removed containerCssoption
- Removed adaptContainerCssoption
 
- Removed 
- The containerCssClassoption has been renamed toselectionCssClass(#5815, #5847)
- Significant changes to the HTML/CSS for the selection area impacting custom themes (#5842)
- New CSS classes for the dropdown results to better target highlighted / selected results (#5841)
- The search box in the selection area for multiple selects has been changed from an <input />to a<textarea>to support pasting multiple lines (#5806)
- Change tab key to select the currently highlighted option instead of just closing (#5759)
- Tags will be highlighted first in the results even if other options have been selected (#5812)
New features / improvements
- dropdownCssClassand- selectionCssClassare now available in all builds of Select2 (#5815)
- Calls to get the currently selected options are now considerably faster on large datasets (#5775)
- Selected results in the dropdown should now be properly announced to screen readers (#5841)
- Significant improvements were made to make the selection area accessible (#5824, #5842, #5916, #5942, #5973)
- Allow pasting multiple lines into the search field for tokenization (#5806)
Bug fixes
- Resize the selection search on close to properly display the placeholder (#5766)
- Change internal data ID generation to be more unique and prevent conflicts with numeric IDs (#5840)
- Internet Explorer 11 no longer steals focus of search box while tagging (#5842)
- Fix slow memory leak caused by not clearing cache on destroy (#5965)
Translations
- Add Esperanto translation (eo) (#5823)
- Add Punjabi translations (pa) (#5831)
- Add Telugu translations (te) (#5881)
- Updated Hungarian translations (hu) for 4.1.0 changes (#5970)
Miscellaneous
- The amdLanguageBaseoption no longer has an effect because the full build does not include any dynamically loaded modules (#5815)
4.0.13
New features / improvements
- Trigger inputevent beforechangeevents (#4649)
- Feed back the keypress code that was responsible for the 'close' event (#5513)
- Only trigger selection:updateonce on DOM change events (#5734)
Bug fixes
- Prevent opening of disabled elements (#5751)
Documentation
- Fix "edit this page" links in docs (#5689)
Miscellaneous
- Registered Select2 on Open Collective (#5700, #5721, #5741)
4.0.12
Bug fixes
- Fixes incorrect offset when using the Shadow DOM and styling the <html>element (#5682)
Miscellaneous
- Replace cdnjs with jsDelivr in the documentation (#5687)
- Fix incorrect provider for the automated NPM deployment (#5686)
4.0.11
Bug fixes
- Fixes jQuery migrate error when getting offset when dropdownParent not in document (#5584)
Miscellaneous
- Enable GitHub actions for CI (#5591)
- Documentation has been moved into and is deployed from the code repository (#5638)
- Remove Travis CI integration (#5665)
4.0.10
New features / improvements
- Support passing in a selector for dropdownParentoption (#5622)
Bug fixes
- Fix bug where dropdowns pointing upwards were incorrectly positioned (#5621)
4.0.9
New features / improvements
- Mirror disabled state through aria-disabled on selection (#5579)
- Select2 now clears the internal ID when it is destroyed (#5587)
- Set the main ARIA 1.1 roles and properties for comboboxes (#5582)
- The languageoption now has a clearly defined fallback chain (#5602)
Bug fixes
- Do not propagate click when search box is not empty (#5580)
- Fix maximumSelectionLengthbeing ignored bycloseOnSelect(#5581)
- Fix generated options not receiving result IDs (#5586)
- Remove selection title attribute if text is empty (#5589)
- Reposition dropdown whenever items are selected (#5590)
- Fix dropdown positioning when displayed above with messages (#5592)
- Fix search box expanding width of container (#5595)
- allowClearno longer shifts selections to a new line (#5603)
Translations
- Fix error in German translations (#5604)
Miscellaneous
- Updated development grunt version so it no longer shows as vulnerable (#5597)
- Remove unused variables (#5554)
4.0.8
New features / improvements
- Test against and fix compatibility with jQuery 3.4.1 (#5531)
- Results respect disabled state of <option>(#5560)
- Add computedstyleoption for calculating the width (#5559)
Bug fixes
- Fix tag creation being broken in 4.0.7 (#5558)
- Fix infinite scroll when the scrollbar is not visible (#5575)
- Revert change to focusing behaviour in 4.0.6 (#5576)
Translations
- Fix wording in French translations (#5521)
Miscellaneous
- Update grunt-contrib-qunit to latest version (#5530)
- Removed unused .select2-selection__placeholderCSS definitions for multiple selects (#5508)
- Remove deprecated jQuery shorthand (#5564)
4.0.7
New features/improvements
- Do not close on select if Ctrl or Meta (Cmd) keys being held (#5222)
Bug fixes
- Fixed issue where single select boxes would automatically reopen when they were closed (#5490, #5492)
Miscellaneous
- Move almost and jquery-mousewheel to devDependencies (#5489)
4.0.6
New features/improvements
- Add style property to package.json (#5019)
- Implement clearandclearingevents (#5058)
- Add scrollAfterSelectoption (#5150)
- Add missing diacritics (#4118, #4337, #5464)
Bug fixes
- Fix up arrow error when there are no options in dropdown (#5127)
- Add ;before beginning of factory wrapper (#5089)
- Fix IE11 issue with select losing focus after selecting an item (#4860)
- Clear tooltip from select2-selection__renderedwhen selection is cleared (#4640, #4746)
- Fix keyboard not closing when closing dropdown on iOS 10 (#4680)
- User-defined types not normalized properly when passed in as data (#4632)
- Perform deep merge for Defaults.set()(#4364)
- Fix "the results could not be loaded" displaying during AJAX request (#4356)
- Cache objects in Utils.__cacheinstead of using$.data(#4346, #5486)
- Removing the double event binding registration of selection:update(#4306)
Accessibility
- Improve .select2-hidden-accessible(#4908)
- Add role and aria-readonly attributes to single selection dropdown value (#4881)
Translations
- Add Turkmen translations (tk) (#5125)
- Fix error in French translations (#5122)
- Add Albanian translation (sq) (#5199)
- Add Georgian translation (ka) (#5179)
- Add Nepali translation (ne) (#5295)
- Add Bangla translation (bn) (#5248)
- Add removeAllItemstranslation for clear "x" title (#5291)
- Fix wording in Vietnamese translations (#5387)
- Fix error in Russian translation (#5401)
Miscellaneous
- Remove duplicate CSS selector in classic theme (#5115)
4.0.5
Bug fixes
- Replace autocapitalize=offwithautocapitalize=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 (dsbandhsb) (#4949)
- Updates to Slovak (#4915)
- Fixed Norwegian inputTooShortmessage (#4817, 4896)
- Add Afrikaans translation (af) (#4850)
- Add Bosnian translation (bs) (#4504)
4.0.4
New features / Improvements
- Make tag matching case insensitive [cb9a904578,1167bace78]
- Support selecting options with blank or 0option values [16b4840c0e,0358ee5287]
Bug fixes
- Fix issue with entire form losing focus when tabbing away from a Select2 control (#4419)
- Fix UMD support for CommonJS [45a8773454]
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 <select>serialization example [https://github.com/select2/select2/pull/4538]
- Correct typos in documentation [https://github.com/select2/select2/pull/4663]
Translations
- Add errorLoadingHungarian translation [7d1d133523]
- Add errorLoadingGerman translation [4df965219e]
- Add Slovene language [8e6422c570]
- Add errorLoadingGalician translation [8fcc6202c3]
- Add errorLoadingThai translation [625fc78ee6]
- Add searchinganderrorLoadingFinnish translations [https://github.com/select2/select2/pull/4730]
- Add errorLoadingTurkish translation [fd4a082531,751b36767f]
- Add Armenian language [f6fa52dcc0]
4.0.3
This is the third bugfix release of Select2 4.0.0. It builds upon the second bugfix release and fixes many common issues.
New features / Improvements
- The old dropdownAutoWidthoption now properly works [fe26b083eb]
- A focusevent on the original<select>is now handled [31e7a1d4c5]
- Adding and removing options now refreshes the selection automatically [ea79a197e0]
Bug fixes
- select2('option')no longer mutate the arguments when working on multiple elements [- c2c1aeef31]
- Better detect aborted requests [cfb66f5e4f]
- New options are now properly created during tokenization [3b8cd2e369]
- 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 [e897d008a6,9f581285d8]
- selectOnClosenow works properly with- closeOnSelect[- 481c43883e]
- Apply ajax.delayto empty search terms as well [4b9e02f022]
Documentation
- Added example for attaching event listeners [84d6b5d840]
- Correct link to the Select2 Bootstrap Theme [https://github.com/select2/select2/pull/4318]
- Added example for using a <label>[3bc7f4ac78]
- Add documentation for ajax.url[5a831afb9a]
- Added favicon [https://github.com/select2/select2/pull/4379]
Translations
- Add Khmer translation [https://github.com/select2/select2/pull/4246]
- Added Norwegian bokmaal for errorLoading[https://github.com/select2/select2/pull/4259]
- Fixed pluralization in Lithuanian translation [5b5eddd183]
- Add French translation for errorLoading[b1ea28bb7d]
- Add Greek translation [https://github.com/select2/select2/pull/4139]
4.0.2
This is the second bugfix release of Select2 4.0.0. It builds upon the first release candidate of Select2 4.0.2 with some minor improvements.
New features / Improvements
- Added insertTagoption to control the placement of thetagsoption [https://github.com/select2/select2/pull/4008]
- Added handler for AJAX errors [https://github.com/select2/select2/issues/3501]
- Added insertTag to control the tag position [https://github.com/select2/select2/pull/4008]
Bug fixes
- Fixed positioning issues with static dropdown parents [https://github.com/select2/select2/issues/3970]
- Fixed existing selections not always being respected with array data [https://github.com/select2/select2/issues/3990]
- Sanitize automatically generated ids so CSS identifiers can be used [https://github.com/select2/select2/issues/3618]
- Recursively apply defaults so AJAX defaults can be set [983cd8e765]
- No need to recalculate the top of the dropdown twice [https://github.com/select2/select2/pull/4155]
Documentation
- Updated Bootstrap and Font Awesome dependencies [a5e539b509,81a4a68b11,6369f5f173]
- Use Jekyll's highlighting instead of prettify [54441e6a22,74387b9863,a126b53b4c,75163d67cb]
- Corrected responsive width example to properly show it working [63d531a9c0]
- Replaced protocol-relative URLs with HTTPS protocol [https://github.com/select2/select2/pull/4127]
- Code snippets for mapping idandtext[https://github.com/select2/select2/issues/4086]
- Document how to trigger changejust for Select2 [https://github.com/select2/select2/issues/3620]
- Added notes about DOM events [37dbe059fc]
Translations
- Correct Romanian translation [72d905f9e0]
4.0.1
This is the first bugfix release of Select2 4.0.0. It builds upon the first release candidate of Select2 4.0.1 with some minor improvements.
New features / improvements
- The option container is now passed in as the second argument when templating selections using templateResult[dc516e7073]
- The option container is now passed in as the second argument when templating selections using templateSelection[https://github.com/select2/select2/pull/3324]
- You can immediately start typing to search when tabbing into a multiple select [02cca7baa7, https://github.com/select2/select2/commit/79cdcc0956e242c1ce642bbaa93e538c54f4be0]
- All parameters passed in for AJAX requests are now set as query string parameters by default [https://github.com/select2/select2/issues/3548]
Bug fixes
- The search box will now be properly sized after removing a selection [5f80c5d9f8]
- Dropdown results will now be spoken by screen readers [9fae3d74e3]
- Options are now properly cloned when initializing multiple instances at once [3c8366e876]
- selectOnCloseand now be used with- closeOnSelectwithout getting a stack overflow [- 393ca4cf7f]
- Fixed positioning with non-static parents [c9216b4b96]
- Fixed bug where multiple selects with placeholders were buggy in IE [https://github.com/select2/select2/issues/3300]
- Fixed bug where AJAX selects could not be initialized with array data [https://github.com/select2/select2/pull/3375]
- :all:is now correctly removed when used in- containerCssand- dropdownCssoptions [https://github.com/select2/select2/pull/3464]
- Fixed bug where the multiple select search box would appear on the left in RTL mode [https://github.com/select2/select2/pull/3502]
- Change ALT + UP to close the dropdown instead of opening it [d2346cc331]
- Fix focus issue with the multiple select search box when the changeevent was triggered [698fe7b9e1,88503d2c67,dd2990adea]
- Fix bug in ArrayAdapterwhere the existing<option>data would be used instead of the array data [https://github.com/select2/select2/pull/3565]
- Remove random call to $dropdownContainer.width()in theAttachBodydecorator [https://github.com/select2/select2/pull/3654]
- Fix memory leak in AttachBodydecorator [671f5a2ce2]
- Selections can no longer be removed when Select2 is in a disabled state [68d068f1d2,7d8f86cbf8]
- Remove redundant openevent trigger [https://github.com/select2/select2/pull/3507]
- Correct references to thisinajax.dataandajax.urlcallback functions [https://github.com/select2/select2/issues/3361]
- Apply select2('option') calls on all elements [https://github.com/select2/select2/pull/3495]
Design
- Fixed original <select>not always being hidden correctly in some cases [https://github.com/select2/select2/pull/3301]
- Fix potential issue with Bootstrap's gradients in Internet Explorer [https://github.com/select2/select2/pull/3307]
- Improve compatibility with Zurb Foundation [https://github.com/select2/select2/pull/3290]
- Remove padding on mobile safari search field in multiple selects [https://github.com/select2/select2/pull/3605]
- Fix the clear button appearing beneath long text [https://github.com/select2/select2/issues/3306]
- Migrate the CSS classes for the "Loading more results" message to BEM [https://github.com/select2/select2/issues/3889]
- Fix inline search not displaying properly in Safari [https://github.com/select2/select2/issues/3459]
Documentation
- New documentation theme designed by @fk [https://github.com/select2/select2/pull/3376, https://github.com/select2/select2/pull/3467, https://github.com/select2/select2/pull/3488]
- Update ajax example to reflect pagination [https://github.com/select2/select2/pull/3357]
- Fix incorrect option name in maxiumSelectionLengthexample [https://github.com/select2/select2/pull/3454]
- Fix typos in the disabled mode/results examples [https://github.com/select2/select2/pull/3665]
- Fix Optionparameters in the 4.0 announcement [https://github.com/select2/select2/pull/3547]
- Fix invalid JSON in the tags example within the 4.0 announcement [https://github.com/select2/select2/pull/3637]
Translations
- Added Cyrillic variant of the Serbian language [https://github.com/select2/select2/pull/3943]
- Corrected Thai "no results found" translation [https://github.com/select2/select2/pull/3782]
- Swapped the inputTooLongandinputTooShortmessages in the Galician translation [https://github.com/select2/select2/pull/3291]
- Fix improper grammar in Dutch translation [https://github.com/select2/select2/pull/3692]
- Add Japanese translation [https://github.com/select2/select2/pull/3477]
- Polish translation: Fixed typo in maximum selected message [https://github.com/select2/select2/pull/3587]
- Add Malay translation [https://github.com/select2/select2/pull/3635]
- Add errorLoadingfor Indonesian translation [https://github.com/select2/select2/pull/3635]
- Correct grammar issues in Hebrew translation [https://github.com/select2/select2/pull/3911]
- Add errorLoadingfor Danish translation [https://github.com/select2/select2/pull/3870]
- Add Arabic translation [https://github.com/select2/select2/pull/3859]
4.0.0
This builds upon the second release candidate, so review all previous release notes before upgrading from previous versions of Select2.
Supported environments
- jQuery 1.7.2+
- Modern browsers (Chrome, Firefox, Safari)
- Internet Explorer 8+
New features
- Fully compatible with AMD and UMD based loaders.
- Advanced plugin system that uses custom adapters.
- Full support for jQuery.noConflict.
- A <select>is the recommended element and can be used for all options. There is limited backwards-compatible support for the<input>element in full builds.
- Declarative configuration through data-*attributes
- Easy to configure theme system and new default theme
- You can use more specific locales (like en-US) and Select2 will be able to determine what translation files to load.
Breaking changes
- Select2 now uses the MIT license
- The full build of Select2 no longer includes jQuery - You must include jQuery separately on your page.
- Select2 will prevent the inner scrolling of modals (and other scrollable containers) when it is open to prevent the UI from breaking. Read more at the commit.
- jQuery is no longer listed as a dependency in the bower.json/component.jsonfiles.
- <select>has replaced- <input type="hidden" />for all options (including remote data)
- The matcherhas been revamped to include full context, a compatibility module (select2/compat/matcher) has been created
- The display always reflects the order data is sent to the server
- The click mask is no longer the default (again). You can get back the old functionality by wrapping your selectionAdapterwith theClickMask(select2/selection/clickMask) decorator.
- Select2 no longer stops the propagation of events happening within the dropdown and selection. You can use the StopPropagationmodules available in the full builds to prevent this. [8f8140e3b0]
- The enter key no longer toggles the state of multiple select items in the results, but instead will only select them. Use CTRL + Space instead to toggle the state. [017c201094]
- Warnings will now be triggered in the developer console if Select2 detects an unsupported configuration.
Options
- The default value of the widthoption has been changed fromstyletoresolve.
- The copyvalue for thewidthoption has been renamed tostyle.
Renamed
- formatSelection->- templateSelection
- formatResult->- templateResult
- sortResults->- sorter
- createSearchChoice->- createTag
- selectOnBlur->- selectOnClose
- ajax.jsonpCallback->- ajax.jsonp
- ajax.results->- ajax.processResults
- tags: [array,of,data]->- data: [array,of,data], tags: true
- placeholderOptionhas been replaced by- placeholder.id(- placeholder->- placeholder.text)
Internationalization
- formatNoMatches->- language.noMatches
- formatSearching->- language.searching
- formatInputTooShort->- language.inputTooShort
- formatInputTooLong->- language.inputTooLong
- formatAjaxError->- language.errorLoading
- formatLoading->- language.loadingMore
- formatSelectionTooBig->- language.maximumSelected
Deprecated/Removed
- initSelection- This is no longer needed with- <select>tags. Limited backwards compatibility in the full build.
- id- Data objects should now always have- idand- textattributes that are strings, use- $.mapwhen migrating
- query- Use a custom data adapter instead. Limited backwards compatibility in the full build.
- ajax.params- All parameters passed to- ajaxwill be passed to the AJAX data transport function
Methods
Renamed
- .select2("val", [value])->- .val([value])
- .select2("enable", !disabled)->- .prop("disabled", disabled)
Removed
- .select2("onSortStart")and- .select2("onSortEnd")- A custom selection adapter should be created instead
- .select2("data", data)- Create the- <option>tags for the objects that you would like to set, and set the- .valto select them
- .select2("readonly")- There is no way to make a- <select>element read-only, disable it instead
Events
New
- select2:closingis triggered before the dropdown is closed
- select2:selectis triggered when an option is selected
Renamed
- select2-closeis now- select2:close
- select2-openis now- select2:open
- select2-openingis now- select2:opening
- select2-selectingis now- select2:selecting
- select2-removedis now- select2:unselect
- select2-removingis now- select2:unselecting
Removed
- select2-clearinghas been removed in favor of- select2:unselecting
- select2-highlight
- select2-loaded
- select2-focus- Use the native- focusevent instead
- select2-blur- Use the native- blurevent instead
- All extra properties from the changeevent were removed- valcan be retrieved with- $element.val()instead
- addedcan be retrieved by listening to- select2:select
- removedcan be retrieved by listening to- select2:unselect
 
