Repository navigation
v11.0.0 RC1
Pre-release
Pre-release
⚠ BREAKING CHANGES
allowHtmlnow defaults to false.- HTML escaping of choice/item labels should no longer double escape depending on allowHTML mode.
- Templates/text functions now escape
'characters for display. addItemText/uniqueItemText/customAddItemTextare now called with thevalueargument already escaped.- Typescript classes for input data vs internal working data have been adjusted resulting in the
Choice/Group/Itemtypescript classes have been renamed, and aliases left as required.
Features
- The original option list for the select is not destroyed, and all loaded choices are serialised to HTML for better compatibility with external javascript.
- New
singleModeForMultiSelectfeature to treat aselect-singleas if it was aselect-multiplewith a max item count of1, and still auto-close the dropdown and swap the active item on selection. - Remove
deepMergedependency. Remove item textcan be localized.- Allow user-created choices for selects. #1117
- User input is escaped by default. At the risk of XSS attacks this can be disabled by
allowHtmlUserInput.
- User input is escaped by default. At the risk of XSS attacks this can be disabled by
- Render options without a group even if groups are present. #615 #1110
- Read
data-labelclass/data-label-descriptionfrom<option>HTML to drive adding a per-choice CSS label and description text whenallowHtml: false. - Add
removeItemButtonAlignLeftoption, to control if the remove item button is at the start or the end of the item. - Add
removeChoicemethod. Removes the choice from thechoices.jsobject and any backing<option>HTML element - Add
refreshmethod. Reloads choices from the backing<select>s options. - Improve rendering performance by batching changes.
escapeForTemplatefunction is passed to the 2nd method of thecallbackOnCreateTemplatescallback.- When
allowHtmlis false, default templates now render escaped html toinnerHtmlwriting toinnerText.- This provides consistent rendering performance as
innerTextis quirky and slower than escaped html intoinnerHtml
- This provides consistent rendering performance as
- Shadow DOM support #938
Bug Fixes
- Replace malicious polyfill with cdnjs. #1161
- Maintain groups in search mode. #1152
- Fix various "first press" bugs on single select dropdowns. #1104
- Fix 'esc' would close the dropdown and also apply to the container resulting in an overlay/modal unexpectedly closing. #1039
- Fix form reset would clear the choices list, but not clear the search bar. #1023
- Fix options would be disabled when choices.js was intialized on a disabled element. Choices-js#1025 Fix a search_term element to appear in form submit data. Choices-js#1049 Fix 'remove item' button would trigger the change event twice due to placeholder value being used (match html single-select). Choices-js#892 Fix optgroups are not preserved when Choices is destroyed Choices-js#1055 Fix placeholder config option would be ignored for select boxes which have blank entries. Fix data-custom-properties attribute did not serialize to created elements as a json blob as expected. Choices-js#840 Choices-js#1155 Choices-js#543 Fix multi-select did not correctly resizing when a select option is selected on choices.js initialization. Fix clearInput function did not clear the last search. Fix addItemFilter would allow empty strings as input to be added for items. Fix various issues with double escaping when displaying items/choices depending on allowHTML mode. Fix aria-label for placeholders was set to the string null Fix searchEnable flag was not respected for select-multiple Choices-js#1042 Fix poor error message when Choices is passed a string selector which fails to find the element for Choices to attach to.