Migrating to v2
Review changes to the Tom Select API to help you migrate from v1 to v2.
Core
- Caret position functionality (using ← and → arrow keys to move between selected items) moved to caret_position plugin
addOption()
no longer treats new options as "user created" (see persist option) by default. UseaddOption(option, true)
for registering user created options.- Closing control via esc key, enter, etc no longer blurs focus to maintain keyboard control
- Added sync() method
- Original <input> or <select> element uses 'hidden-accessible' styling instead of 'hidden'
- controlInput=null instead of controlInput='<input>' for hidden control input
- Deprecated isInvalid. Use isValid instead
- Removed support for
querySelector('option[selected]')
. UsequerySelector('option:checked')
instead - Removed renderCache
CSS
- Renamed
.ts-control
to.ts-wrapper
to align css class with name in JavaScript - Renamed
.ts-input
to.ts-control
to align css class with name in JavaScript - Multiple CSS classes are now toggled on the wrapper element instead of the control element:
.focus
,.disabled
,.required
,.invalid
,.locked
,.full
,.not-full
,.input-active
,.dropdown-active
,.has-options
,.has-items
- Removed bootstrap3 style
Settings
copyClassesToDropdown
defaults to false