- Simplify nationalMode option. Previously, when nationalMode was set to false, the plugin was needlessly creating a worse UX for users who typed a valid national number in 2 situations: (1) it wouldn't update the flag between NANP countries if you typed a different area code (in national format), and (2) isValidNumber would return false for a valid national number.
- Remove autoHideDialCode option in favour of new autoInsertDialCode option
- Allow nationalMode to be used with separateDialCode
- Update validationError enum in utils.js to match latest version of libphonenumber
- Change ID attributes to be unique (both within the dropdown e.g. dupe countries in preferred section, AND across multiple instances of the plugin)
Breaking changes
- Switched CSS class names to use BEM, so you shouldn't get any more clashes with generic class names like "highlight"
- All NANP countries now have just +1 as their dialCode, when some used to include the area code e.g. Barbados used to have dial code +1246 and now has just +1.
- Accessibility: focus highlighted list item
Change behaviour of autoHideDialCode option
It still clears the input on blur/submit if it just contains a dial code, but now it no longer re-adds it on focus. This is due to a bug (#847): when submitting the form with an empty (but required) input, the browser displayed an error on the input and also focusing it, which caused the plugin to automatically add the dial code which then triggered the browser to remove the error again instantly, so it could actually never be seen. I have also just come to believe more generally that injecting a value on focus is unexpected and dangerous, and so should be avoided.
- added
getInstance
static method
We finally removed the jQuery dependency! This changes how you initialise and use the plugin - see readme for details. All of the tests are currently passing on Chrome/Firefox/Safari/IE11.
- You can no longer initialise the plugin on multiple inputs at once, but other than that AFAICS it should be feature complete
- Instead of jQuery deferred objects we now use ES6 promises (if available)
dropdownContainer
option has changed from taking a jQuery selector string, to a node e.g.document.body
I also simplified the CSS media queries in this release, so let me know if you notice any problems with that.
- changed how hiddenInput option works, to make it compatible with initialising the plugin on multiple inputs at once (so now if your input name contains square brackets then it will give the hidden input the same name, replacing the contents of the brackets with the given name)
- removed an undocumented
utilsScriptDeferred
argument to static methodloadUtils
which is no longer needed - lots of bug fixes
- added new setPlaceholderNumberType public method
- added new hiddenInput option
- trigger new open/close dropdown events
- now triggers
close:countrydropdown
event
- Drop support for IE8 (see readme). There are no actual changes in this release, it just marks a line in the sand where future changes will no longer consider IE8.
- rename numberType option to placeholderNumberType
- rename formatOnInit to formatOnDisplay
- separate
allowDropdown
andseparateDialCode
options - make defaults object accessible from outside
- bug fixes
- updated autoPlaceholder option to accept "off", "polite" and "aggressive"
- BREAKING CHANGE: removed 2nd arg from setNumber
- optimize PNGs
- update libphonenumber to v7.3.2
- remove cookie stuff (easy to do yourself)
- added support for jquery 3
- added kosovo
- autoHideDialCode now works on submit as well
- added formatOnInit option (defaults to true)
- bug fixes (along with lots more tests)
- re-added getExtension method, which now uses libphonenumber internally for more reliable results
- added separateDialCode option
- added allowDropdown option (defaults to true)