diff --git a/CHANGELOG.md b/CHANGELOG.md
index d7d51638..5143f718 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,8 @@
## Changelog for autoNumeric
+### 4.0.3
++ Fix issue #474 `AutoNumeric.format()` and `AutoNumeric.unformat()` do not accept named options
+
### 4.0.2
+ Fix issue #473 Static `format()` and `unformat()` functions ignores the `rawValueDivisor` option
+ Fix `AutoNumeric.unformat()` that used the number of decimal places shown on focus instead of the one for the raw value.
diff --git a/dist/autoNumeric.js b/dist/autoNumeric.js
index 1d4a0776..e2ceb867 100644
--- a/dist/autoNumeric.js
+++ b/dist/autoNumeric.js
@@ -62,7 +62,7 @@ return /******/ (function(modules) { // webpackBootstrap
/* 1 */
/***/ function(module, exports, __webpack_require__) {
- eval("/*** IMPORTS FROM imports-loader ***/\n(function() {\n\n'use strict';\n\nvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**\n * AutoNumeric.js\n *\n * @version 4.0.2\n * @date 2017-08-02 UTC 02:50\n *\n * @authors Bob Knothe, Alexandre Bonneau\n * @contributors Sokolov Yura and others, cf. AUTHORS\n * @copyright 2009 Robert J. Knothe http://www.decorplanit.com/plugin/\n * @since 2009-08-09\n *\n * @summary autoNumeric is a standalone Javascript library\n * that provides live *as-you-type* formatting for\n * international numbers and currencies.\n *\n * Note : Some functions are borrowed from big.js\n * @link https://github.com/MikeMcl/big.js/\n *\n * Please report any bugs to https://github.com/autoNumeric/autoNumeric\n *\n * @license Released under the MIT License\n * @link http://www.opensource.org/licenses/mit-license.php\n *\n * Permission is hereby granted, free of charge, to any person\n * obtaining a copy of this software and associated documentation\n * files (the \"Software\"), to deal in the Software without\n * restriction, including without limitation the rights to use,\n * copy, modify, merge, publish, distribute, sub license, and/or sell\n * copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following\n * conditions:\n *\n * The above copyright notice and this permission notice shall be\n * included in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n * OTHER DEALINGS IN THE SOFTWARE.\n */\n\n/* global module */\n\n//TODO Prevent having to enter relative path in the js files (ie. using `./AutoNumericHelper` instead of just `AutoNumericHelper`) (cf. http://moduscreate.com/es6-es2015-import-no-relative-path-webpack/)\n\n\nvar _AutoNumericHelper = __webpack_require__(3);\n\nvar _AutoNumericHelper2 = _interopRequireDefault(_AutoNumericHelper);\n\nvar _AutoNumericEnum = __webpack_require__(2);\n\nvar _AutoNumericEnum2 = _interopRequireDefault(_AutoNumericEnum);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n/**\n * Class declaration for the AutoNumeric object.\n *\n * An AutoNumeric element is an object wrapper that keeps a reference to the DOM element it manages (usually an one), and provides autoNumeric-specific variables and functions.\n */\nvar AutoNumeric = function () {\n //TODO Use the better notation `export default class` when webpack and babel will allow it (cf. https://github.com/webpack/webpack/issues/706)\n /**\n * Initialize the AutoNumeric object onto the given DOM element, and attach the settings and related event listeners to it.\n * The options passed as a parameter is an object that contains the settings (ie. {digitGroupSeparator: \".\", decimalCharacter: \",\", currencySymbol: '€ '})\n *\n * @example\n * anElement = new AutoNumeric(domElement); // With the default options\n * anElement = new AutoNumeric(domElement, { options }); // With one option object\n * anElement = new AutoNumeric(domElement, 'euroPos'); // With a named pre-defined string\n * anElement = new AutoNumeric(domElement, [{ options1 }, 'euroPos', { options2 }]); // With multiple option objects (the latest option overwriting the previous ones)\n * anElement = new AutoNumeric(domElement, null, { options }); // With one option object, and a failed initial value\n * anElement = new AutoNumeric(domElement).french(); // With one pre-defined language object\n * anElement = new AutoNumeric(domElement).french({ options });// With one pre-defined language object and additional options that will override the defaults\n *\n * // ...or init and set the value in one call :\n * anElement = new AutoNumeric(domElement, 12345.789); // With the default options, and an initial value\n * anElement = new AutoNumeric(domElement, 12345.789, { options });\n * anElement = new AutoNumeric(domElement, '12345.789', { options });\n * anElement = new AutoNumeric(domElement, 12345.789, 'euroPos');\n * anElement = new AutoNumeric(domElement, 12345.789, [{ options1 }, 'euroPos', { options2 }]);\n * anElement = new AutoNumeric(domElement, 12345.789).french({ options });\n * anElement = new AutoNumeric(domElement, 12345.789, { options }).french({ options }); // Not really helpful, but possible\n *\n * // The AutoNumeric constructor class can also accept a string as a css selector. Under the hood this use `QuerySelector` and limit itself to only the first element it finds.\n * anElement = new AutoNumeric('.myCssClass > input');\n * anElement = new AutoNumeric('.myCssClass > input', { options });\n * anElement = new AutoNumeric('.myCssClass > input', 'euroPos');\n * anElement = new AutoNumeric('.myCssClass > input', [{ options1 }, 'euroPos', { options2 }]);\n * anElement = new AutoNumeric('.myCssClass > input', 12345.789);\n * anElement = new AutoNumeric('.myCssClass > input', 12345.789, { options });\n * anElement = new AutoNumeric('.myCssClass > input', 12345.789, 'euroPos');\n * anElement = new AutoNumeric('.myCssClass > input', 12345.789, [{ options1 }, 'euroPos', { options2 }]);\n * anElement = new AutoNumeric('.myCssClass > input', null, { options }); // With a failed initial value\n * anElement = new AutoNumeric('.myCssClass > input', 12345.789).french({ options });\n *\n * @param {object|Array|number|string} arg1\n * @param {object|Array|number|string|null} arg2\n * @param {object|Array|number|string|null} arg3\n * @throws\n */\n function AutoNumeric() {\n var arg1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\n var _this = this;\n\n var arg2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n var arg3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;\n\n _classCallCheck(this, AutoNumeric);\n\n // --------------------------------------------------------\n // -------------- Initialization\n // Initialize the arguments\n var _AutoNumeric$_setArgu = AutoNumeric._setArgumentsValues(arg1, arg2, arg3),\n domElement = _AutoNumeric$_setArgu.domElement,\n initialValue = _AutoNumeric$_setArgu.initialValue,\n userOptions = _AutoNumeric$_setArgu.userOptions;\n\n // Initialize the element\n\n\n this.domElement = domElement;\n\n // Generate the settings\n this.defaultRawValue = ''; // The default raw value to set when initializing an AutoNumeric object\n this._setSettings(userOptions, false);\n //TODO If `styleRules` is not null, add by default a class 'autoNumeric' that adds transition to color, background-color, border-color properties\n // Check if the DOM element is supported\n this._checkElement();\n\n // Store the additional attributes inside the AutoNumeric object\n // Note: This variable is needed and not a duplicate of `initialValueOnKeydown` nor `valueOnFocus` since it serves a different purpose and has a different lifecycle\n this.savedCancellableValue = null;\n\n // Initialize the undo/redo variables\n this.historyTable = []; // Keep track of *all* valid states of the element value\n this.historyTableIndex = -1; // Pointer to the current undo/redo state. This will be set to '0' during initialization since it first adds itself.\n this.onGoingRedo = false; // Variable that keeps track if a 'redo' is ongoing (in order to prevent an 'undo' to be launch when releasing the shift key before the ctrl key after a 'redo' shortcut)\n\n // Initialize the parent form element, if any\n this.parentForm = this._getParentForm();\n\n // Set the initial value if it exists and if the `formatOnPageLoad` option will allow it\n if (!this.runOnce && this.settings.formatOnPageLoad) {\n // Format the element value if needed\n this._formatDefaultValueOnPageLoad(initialValue);\n }\n\n this.runOnce = true;\n\n // Add the events listeners only on input elements\n if (this.isInputElement || this.isContentEditable) {\n if (!this.settings.noEventListeners) {\n //XXX Here we make sure the global list is created after creating the event listeners, to only create the event listeners on `document` once\n this._createEventListeners();\n }\n\n this._setReadOnly();\n }\n\n // Save the initial values (html attribute + element.value) for the pristine test\n this._saveInitialValues(initialValue);\n\n // Setup the data for the persistent storage solution (ie. sessionStorage or cookies)\n this.sessionStorageAvailable = this.constructor._storageTest();\n this.storageNamePrefix = 'AUTO_'; // The prefix for the raw value storage name variable can be modified here\n this._setPersistentStorageName();\n\n // --------------------------------------------------------\n // -------------- Tracking\n // Keep track if the element is currently focused\n this.isFocused = false;\n // Keep track if a mouse wheel event is currently ongoing\n this.isWheelEvent = false;\n // Keep track if a drop event is currently ongoing\n this.isDropEvent = false;\n // Keep track if the user is currently editing the element\n this.isEditing = false;\n\n if (this.settings.createLocalList) {\n // Keep track of every AutoNumeric elements that this object initialized\n this._createLocalList();\n }\n\n // Keep track of all AutoNumeric elements in the current web page\n this.constructor._addToGlobalList(this);\n\n // --------------------------------------------------------\n // -------------- Methods\n // Create the global functions\n this.global = {\n /**\n * Set the same given element value for each elements in the local AutoNumeric element list, and format those elements immediately\n *\n * @param {number|string} newValue The value must be a number or a numeric string\n * @param {object} options A settings object that will override the current settings. Note: the update is done only if the `newValue` is defined.\n */\n set: function set(newValue) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n _this.autoNumericLocalList.forEach(function (aNObject) {\n aNObject.set(newValue, options);\n });\n },\n\n /**\n * Set the value given value directly as the DOM element value, without formatting it beforehand.\n * This sets the same unformatted value for each elements in the local AutoNumeric element list.\n *\n * @param {number|string} value\n * @param {object} options\n */\n setUnformatted: function setUnformatted(value) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n _this.autoNumericLocalList.forEach(function (aNObject) {\n aNObject.setUnformatted(value, options);\n });\n },\n\n /**\n * This is an alias of the `getNumericString()` function, and should not be used anymore.\n *\n * @param {function|null} callback If a callback is passed, then the result is passed to it as its first argument, and the AutoNumeric object has its second\n * @returns {Array}\n * @deprecated\n */\n get: function get() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\n var result = [];\n _this.autoNumericLocalList.forEach(function (aNObject) {\n result.push(aNObject.get());\n });\n _this._executeCallback(result, callback);\n\n return result;\n },\n\n /**\n * Return an array of the unformatted values (as a string) of each AutoNumeric element of the local AutoNumeric element list\n *\n * @param {function|null} callback If a callback is passed, then the result is passed to it as its first argument, and the AutoNumeric object has its second\n * @returns {Array}\n */\n getNumericString: function getNumericString() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\n var result = [];\n _this.autoNumericLocalList.forEach(function (aNObject) {\n result.push(aNObject.getNumericString());\n });\n _this._executeCallback(result, callback);\n\n return result;\n },\n\n /**\n * Return an array of the current formatted values (as a string) of each AutoNumeric element of the local AutoNumeric element list\n *\n * @param {function|null} callback If a callback is passed, then the result is passed to it as its first argument, and the AutoNumeric object has its second\n * @returns {Array}\n */\n getFormatted: function getFormatted() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\n var result = [];\n _this.autoNumericLocalList.forEach(function (aNObject) {\n result.push(aNObject.getFormatted());\n });\n _this._executeCallback(result, callback);\n\n return result;\n },\n\n /**\n * Return an array of the element unformatted values (as a real Javascript number), for each element of the local AutoNumeric element list\n *\n * @param {function|null} callback If a callback is passed, then the result is passed to it as its first argument, and the AutoNumeric object has its second\n * @returns {Array}\n */\n getNumber: function getNumber() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\n var result = [];\n _this.autoNumericLocalList.forEach(function (aNObject) {\n result.push(aNObject.getNumber());\n });\n _this._executeCallback(result, callback);\n\n return result;\n },\n\n /**\n * Returns the unformatted values (following the `outputFormat` setting) of each element of the local AutoNumeric element list into an array\n *\n * @param {function|null} callback If a callback is passed, then the result is passed to it as its first argument, and the AutoNumeric object has its second\n * @returns {Array}\n */\n getLocalized: function getLocalized() {\n var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\n var result = [];\n _this.autoNumericLocalList.forEach(function (aNObject) {\n result.push(aNObject.getLocalized());\n });\n _this._executeCallback(result, callback);\n\n return result;\n },\n\n /**\n * Force each element of the local AutoNumeric element list to reformat its value\n */\n reformat: function reformat() {\n _this.autoNumericLocalList.forEach(function (aNObject) {\n aNObject.reformat();\n });\n },\n\n /**\n * Remove the formatting and keep only the raw unformatted value (as a numericString) in each elements of the local AutoNumeric element list\n */\n unformat: function unformat() {\n _this.autoNumericLocalList.forEach(function (aNObject) {\n aNObject.unformat();\n });\n },\n\n /**\n * Remove the formatting and keep only the localized unformatted value in the element, with the option to override the default outputFormat if needed\n *\n * @param {null|string} forcedOutputFormat If set to something different than `null`, then this is used as an overriding outputFormat option\n */\n unformatLocalized: function unformatLocalized() {\n var forcedOutputFormat = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\n _this.autoNumericLocalList.forEach(function (aNObject) {\n aNObject.unformatLocalized(forcedOutputFormat);\n });\n },\n\n /**\n * Updates the AutoNumeric settings, and immediately format the elements accordingly, for each elements of the local AutoNumeric element list\n *\n * @param {object} newOptions This can be either one or more option objects\n */\n update: function update() {\n for (var _len = arguments.length, newOptions = Array(_len), _key = 0; _key < _len; _key++) {\n newOptions[_key] = arguments[_key];\n }\n\n _this.autoNumericLocalList.forEach(function (aNObject) {\n aNObject.update.apply(aNObject, newOptions);\n });\n },\n\n /**\n * Return `true` if *all* the autoNumeric-managed elements are pristine, if their raw value hasn't changed.\n * By default, this returns `true` if the raw unformatted value is still the same even if the formatted one has changed (due to a configuration update for instance).\n *\n * @param {boolean} checkOnlyRawValue If set to `true`, the pristine value is done on the raw unformatted value, not the formatted one. If set to `false`, this also checks that the formatted value hasn't changed.\n * @returns {boolean}\n */\n isPristine: function isPristine() {\n var checkOnlyRawValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;\n\n var isPristine = true;\n _this.autoNumericLocalList.forEach(function (aNObject) {\n if (isPristine && !aNObject.isPristine(checkOnlyRawValue)) {\n isPristine = false;\n }\n });\n\n return isPristine;\n },\n\n /**\n * Execute the `clear()` method on each AutoNumeric object in the local AutoNumeric element list\n *\n * @param {boolean} forceClearAll\n */\n clear: function clear() {\n var forceClearAll = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n _this.autoNumericLocalList.forEach(function (aNObject) {\n aNObject.clear(forceClearAll);\n });\n },\n\n /**\n * Execute the `remove()` method on each AutoNumeric object in the local AutoNumeric element list\n */\n remove: function remove() {\n _this.autoNumericLocalList.forEach(function (aNObject) {\n aNObject.remove();\n });\n },\n\n /**\n * Execute the `wipe()` method on each AutoNumeric object in the local AutoNumeric element list\n */\n wipe: function wipe() {\n _this.autoNumericLocalList.forEach(function (aNObject) {\n aNObject.wipe();\n });\n },\n\n /**\n * Execute the `nuke()` method on each AutoNumeric object in the local AutoNumeric element list\n */\n nuke: function nuke() {\n _this.autoNumericLocalList.forEach(function (aNObject) {\n aNObject.nuke();\n });\n },\n\n /**\n * Return `true` if the given AutoNumeric object (or DOM element) is in the local AutoNumeric element list\n *\n * @param {HTMLElement|HTMLInputElement|AutoNumeric} domElementOrAutoNumericObject\n * @returns {*}\n */\n has: function has(domElementOrAutoNumericObject) {\n var result = void 0;\n if (domElementOrAutoNumericObject instanceof AutoNumeric) {\n result = _this.autoNumericLocalList.has(domElementOrAutoNumericObject.node());\n } else {\n result = _this.autoNumericLocalList.has(domElementOrAutoNumericObject);\n }\n\n return result;\n },\n\n /**\n * Add an existing AutoNumeric object (or DOM element) to the local AutoNumeric element list, using the DOM element as the key.\n * This manages the case where `addObject` is used on an AutoNumeric object that already has multiple elements in its local list.\n *\n * @param {HTMLElement|HTMLInputElement|AutoNumeric} domElementOrAutoNumericObject\n */\n addObject: function addObject(domElementOrAutoNumericObject) {\n // Start with the same data, whatever the user passed as arguments\n var domElement = void 0;\n var otherAutoNumericObject = void 0;\n if (domElementOrAutoNumericObject instanceof AutoNumeric) {\n domElement = domElementOrAutoNumericObject.node();\n otherAutoNumericObject = domElementOrAutoNumericObject;\n } else {\n domElement = domElementOrAutoNumericObject;\n otherAutoNumericObject = AutoNumeric.getAutoNumericElement(domElementOrAutoNumericObject);\n }\n\n // Check if the current autoNumeric object has a local list\n if (!_this._hasLocalList()) {\n _this._createLocalList();\n }\n\n // Check if the other autoNumeric object has a local list...\n var otherANLocalList = otherAutoNumericObject._getLocalList();\n if (otherANLocalList.size === 0) {\n // Special case if the other AutoNumeric object has an empty local list, then populate itself to it\n otherAutoNumericObject._createLocalList();\n otherANLocalList = otherAutoNumericObject._getLocalList(); // Update the other local list\n }\n\n var mergedLocalLists = void 0;\n if (otherANLocalList instanceof Map) {\n // ...If it does, merge the local lists together\n mergedLocalLists = _AutoNumericHelper2.default.mergeMaps(_this._getLocalList(), otherANLocalList);\n } else {\n // ...If not, just set the current local list onto the other AutoNumeric object\n // We need to specify the AutoNumeric object, otherwise the `_addToLocalList` function would not correctly add the AutoNumeric object since we would not have a reference to it, but a reference to the current AutoNumeric object on which is called this method.\n _this._addToLocalList(domElement, otherAutoNumericObject);\n mergedLocalLists = _this._getLocalList();\n }\n\n // Update the resulting list, on all the objects of that local list (so that we can indifferently use `init()` on any object belonging to that list)\n mergedLocalLists.forEach(function (aNObject) {\n aNObject._setLocalList(mergedLocalLists);\n });\n },\n\n /**\n * Remove the given AutoNumeric object (or DOM element) from the local AutoNumeric element list, using the DOM element as the key.\n * If this function attempts to remove the current AutoNumeric object from the local list, a warning is shown, but the deletion is still done.\n *\n * Special cases :\n * - If the current object removes itself, then it's removed from the shared local list, then a new empty local list is used/created\n * - If another object remove this object, then a local list with only this object is used/created\n *\n * @param {HTMLElement|HTMLInputElement|AutoNumeric} domElementOrAutoNumericObject\n * @param {boolean} keepCurrentANObject If set to `false`, then the function will also remove the current AutoNumeric object if asked, otherwise it will ignore it and print a warning message\n */\n removeObject: function removeObject(domElementOrAutoNumericObject) {\n var keepCurrentANObject = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n // Start with the same data, whatever the user passed as arguments\n var domElement = void 0;\n var otherAutoNumericObject = void 0;\n if (domElementOrAutoNumericObject instanceof AutoNumeric) {\n domElement = domElementOrAutoNumericObject.node();\n otherAutoNumericObject = domElementOrAutoNumericObject;\n } else {\n domElement = domElementOrAutoNumericObject;\n otherAutoNumericObject = AutoNumeric.getAutoNumericElement(domElementOrAutoNumericObject);\n }\n\n // Remove the other object from the local list\n var initialCompleteLocalList = _this.autoNumericLocalList;\n _this.autoNumericLocalList.delete(domElement);\n\n // Update the local list for all objects in it\n initialCompleteLocalList.forEach(function (aNObject) {\n aNObject._setLocalList(_this.autoNumericLocalList);\n });\n\n if (!keepCurrentANObject && domElement === _this.node()) {\n // This object is removed by itself\n // Empty the object local list\n otherAutoNumericObject._setLocalList(new Map());\n } else {\n // This object is removed by another object\n // Set the local list for the removed object, with only this object in it\n otherAutoNumericObject._createLocalList();\n }\n },\n\n /**\n * Remove all elements from the shared list, effectively emptying it.\n * This is the equivalent of calling `detach()` on each of its elements.\n *\n * @param {boolean} keepEachANObjectInItsOwnList If set to `true`, then instead of completely emptying the local list of each AutoNumeric objects, each one of those keeps itself in its own local list\n */\n empty: function empty() {\n var keepEachANObjectInItsOwnList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n\n var initialCompleteLocalList = _this.autoNumericLocalList;\n\n // Update the local list for all objects in it\n initialCompleteLocalList.forEach(function (aNObject) {\n if (keepEachANObjectInItsOwnList) {\n aNObject._createLocalList();\n } else {\n aNObject._setLocalList(new Map());\n }\n });\n },\n\n /**\n * Return an array containing all the AutoNumeric DOM elements that have been initialized by each other\n *\n * @returns {Array}\n */\n elements: function elements() {\n var result = [];\n _this.autoNumericLocalList.forEach(function (aNObject) {\n result.push(aNObject.node());\n });\n\n return result;\n },\n\n /**\n * Return the `Map` object directly\n * @returns {Map}\n */\n getList: function getList() {\n return _this.autoNumericLocalList;\n },\n\n /**\n * Return the number of element in the local AutoNumeric element list\n * @returns {number}\n */\n size: function size() {\n return _this.autoNumericLocalList.size;\n }\n };\n\n // Create the functions that will allow to change each setting one by one\n /**\n * For each options, we define if we need to reformat the element content (does changing the options should change the way its value is displayed?).\n * If yes, then we use the `update()` for force a reformat, otherwise, we just update the `settings` object.\n */\n this.options = {\n /**\n * Reset any options set previously, by overwriting them with the default settings\n *\n * @returns {AutoNumeric}\n */\n reset: function reset() {\n //TODO Add a `settings` parameter so that the user can reset to a specific set of settings. This is different than update since it drops any non-default settings before using those new settings.\n _this.settings = { rawValue: _this.defaultRawValue }; // Here we pass the default rawValue in order to prevent showing a warning that we try to set an `undefined` value\n _this.update(AutoNumeric.defaultSettings);\n\n return _this;\n },\n allowDecimalPadding: function allowDecimalPadding(_allowDecimalPadding) {\n _this.update({ allowDecimalPadding: _allowDecimalPadding });\n\n return _this;\n },\n caretPositionOnFocus: function caretPositionOnFocus(_caretPositionOnFocus) {\n //FIXME test this\n _this.settings.caretPositionOnFocus = _caretPositionOnFocus;\n\n return _this;\n },\n createLocalList: function createLocalList(_createLocalList2) {\n _this.settings.createLocalList = _createLocalList2;\n\n // Delete the local list when this is set to `false`, create it if this is set to `true` and there is not pre-existing list\n if (_this.settings.createLocalList) {\n if (!_this._hasLocalList()) {\n _this._createLocalList();\n }\n } else {\n _this._deleteLocalList();\n }\n\n return _this;\n },\n currencySymbol: function currencySymbol(_currencySymbol) {\n _this.update({ currencySymbol: _currencySymbol });\n\n return _this;\n },\n currencySymbolPlacement: function currencySymbolPlacement(_currencySymbolPlacement) {\n _this.update({ currencySymbolPlacement: _currencySymbolPlacement });\n\n return _this;\n },\n decimalCharacter: function decimalCharacter(_decimalCharacter) {\n _this.update({ decimalCharacter: _decimalCharacter });\n\n return _this;\n },\n decimalCharacterAlternative: function decimalCharacterAlternative(_decimalCharacterAlternative) {\n _this.settings.decimalCharacterAlternative = _decimalCharacterAlternative;\n\n return _this;\n },\n /**\n * Update the decimal places globally, which means this override any previously set number of decimal shown on focus, on blur, or in the raw value.\n *\n * @param {int} decimalPlaces\n * @returns {AutoNumeric}\n */\n decimalPlaces: function decimalPlaces(_decimalPlaces) {\n _AutoNumericHelper2.default.warning('Using `options.decimalPlaces()` instead of calling the specific `options.decimalPlacesRawValue()`, `options.decimalPlacesShownOnFocus()` and `options.decimalPlacesShownOnBlur()` methods will reset those options.\\nPlease call the specific methods if you do not want to reset those.', _this.settings.showWarnings);\n _this.update({ decimalPlaces: _decimalPlaces });\n\n return _this;\n },\n decimalPlacesRawValue: function decimalPlacesRawValue(_decimalPlacesRawValue) {\n //FIXME test this\n _this.update({ decimalPlacesRawValue: _decimalPlacesRawValue });\n\n return _this;\n },\n decimalPlacesShownOnBlur: function decimalPlacesShownOnBlur(_decimalPlacesShownOnBlur) {\n _this.update({ decimalPlacesShownOnBlur: _decimalPlacesShownOnBlur });\n\n return _this;\n },\n decimalPlacesShownOnFocus: function decimalPlacesShownOnFocus(_decimalPlacesShownOnFocus) {\n _this.update({ decimalPlacesShownOnFocus: _decimalPlacesShownOnFocus });\n\n return _this;\n },\n defaultValueOverride: function defaultValueOverride(_defaultValueOverride) {\n _this.update({ defaultValueOverride: _defaultValueOverride });\n\n return _this;\n },\n digitalGroupSpacing: function digitalGroupSpacing(_digitalGroupSpacing) {\n _this.update({ digitalGroupSpacing: _digitalGroupSpacing });\n\n return _this;\n },\n digitGroupSeparator: function digitGroupSeparator(_digitGroupSeparator) {\n _this.update({ digitGroupSeparator: _digitGroupSeparator });\n\n return _this;\n },\n divisorWhenUnfocused: function divisorWhenUnfocused(_divisorWhenUnfocused) {\n _this.update({ divisorWhenUnfocused: _divisorWhenUnfocused });\n\n return _this;\n },\n emptyInputBehavior: function emptyInputBehavior(_emptyInputBehavior) {\n if (_this.rawValue === null && _emptyInputBehavior !== AutoNumeric.options.emptyInputBehavior.null) {\n // Special case : if the current `rawValue` is `null` and the `emptyInputBehavior` is changed to something else than `'null'`, then it makes that `rawValue` invalid.\n // Here we can either prevent the option update and throw an error, or still accept the option update and update the value from `null` to `''`.\n // We cannot keep `rawValue` to `null` since if `emptyInputBehavior` is not set to `null`, lots of function assume `rawValue` is a string.\n _AutoNumericHelper2.default.warning('You are trying to modify the `emptyInputBehavior` option to something different than `\\'null\\'` (' + _emptyInputBehavior + '), but the element raw value is currently set to `null`. This would result in an invalid `rawValue`. In order to fix that, the element value has been changed to the empty string `\\'\\'`.', _this.settings.showWarnings);\n _this.rawValue = '';\n }\n\n _this.update({ emptyInputBehavior: _emptyInputBehavior });\n\n return _this;\n },\n failOnUnknownOption: function failOnUnknownOption(_failOnUnknownOption) {\n _this.settings.failOnUnknownOption = _failOnUnknownOption; //FIXME test this\n\n return _this;\n },\n formatOnPageLoad: function formatOnPageLoad(_formatOnPageLoad) {\n _this.settings.formatOnPageLoad = _formatOnPageLoad; //FIXME test this\n\n return _this;\n },\n historySize: function historySize(_historySize) {\n _this.settings.historySize = _historySize;\n\n return _this;\n },\n isCancellable: function isCancellable(_isCancellable) {\n _this.settings.isCancellable = _isCancellable; //FIXME test this\n\n return _this;\n },\n leadingZero: function leadingZero(_leadingZero) {\n _this.update({ leadingZero: _leadingZero });\n\n return _this;\n },\n maximumValue: function maximumValue(_maximumValue) {\n _this.update({ maximumValue: _maximumValue });\n\n return _this;\n },\n minimumValue: function minimumValue(_minimumValue) {\n _this.update({ minimumValue: _minimumValue });\n\n return _this;\n },\n modifyValueOnWheel: function modifyValueOnWheel(_modifyValueOnWheel) {\n _this.settings.modifyValueOnWheel = _modifyValueOnWheel; //FIXME test this\n\n return _this;\n },\n negativeBracketsTypeOnBlur: function negativeBracketsTypeOnBlur(_negativeBracketsTypeOnBlur) {\n _this.update({ negativeBracketsTypeOnBlur: _negativeBracketsTypeOnBlur });\n\n return _this;\n },\n negativePositiveSignPlacement: function negativePositiveSignPlacement(_negativePositiveSignPlacement) {\n _this.update({ negativePositiveSignPlacement: _negativePositiveSignPlacement });\n\n return _this;\n },\n noEventListeners: function noEventListeners(_noEventListeners) {\n //FIXME test this\n if (_noEventListeners === AutoNumeric.options.noEventListeners.noEvents && _this.settings.noEventListeners === AutoNumeric.options.noEventListeners.addEvents) {\n // Remove the events once\n _this._removeEventListeners();\n }\n\n _this.update({ noEventListeners: _noEventListeners });\n\n return _this;\n },\n onInvalidPaste: function onInvalidPaste(_onInvalidPaste) {\n _this.settings.onInvalidPaste = _onInvalidPaste; //FIXME test this\n\n return _this;\n },\n outputFormat: function outputFormat(_outputFormat) {\n _this.settings.outputFormat = _outputFormat;\n\n return _this;\n },\n overrideMinMaxLimits: function overrideMinMaxLimits(_overrideMinMaxLimits) {\n _this.update({ overrideMinMaxLimits: _overrideMinMaxLimits });\n\n return _this;\n },\n rawValueDivisor: function rawValueDivisor(_rawValueDivisor) {\n _this.update({ rawValueDivisor: _rawValueDivisor });\n\n return _this;\n },\n readOnly: function readOnly(_readOnly) {\n //FIXME test this\n _this.settings.readOnly = _readOnly;\n _this._setReadOnly();\n\n return _this;\n },\n roundingMethod: function roundingMethod(_roundingMethod) {\n _this.update({ roundingMethod: _roundingMethod });\n\n return _this;\n },\n saveValueToSessionStorage: function saveValueToSessionStorage(_saveValueToSessionStorage) {\n _this.update({ saveValueToSessionStorage: _saveValueToSessionStorage });\n\n return _this;\n },\n symbolWhenUnfocused: function symbolWhenUnfocused(_symbolWhenUnfocused) {\n _this.update({ symbolWhenUnfocused: _symbolWhenUnfocused });\n\n return _this;\n },\n selectNumberOnly: function selectNumberOnly(_selectNumberOnly) {\n _this.settings.selectNumberOnly = _selectNumberOnly; //FIXME test this\n\n return _this;\n },\n selectOnFocus: function selectOnFocus(_selectOnFocus) {\n _this.settings.selectOnFocus = _selectOnFocus; //FIXME test this\n\n return _this;\n },\n serializeSpaces: function serializeSpaces(_serializeSpaces) {\n _this.settings.serializeSpaces = _serializeSpaces; //FIXME test this\n\n return _this;\n },\n showOnlyNumbersOnFocus: function showOnlyNumbersOnFocus(_showOnlyNumbersOnFocus) {\n _this.update({ showOnlyNumbersOnFocus: _showOnlyNumbersOnFocus });\n\n return _this;\n },\n showPositiveSign: function showPositiveSign(_showPositiveSign) {\n _this.update({ showPositiveSign: _showPositiveSign });\n\n return _this;\n },\n showWarnings: function showWarnings(_showWarnings) {\n _this.settings.showWarnings = _showWarnings; //FIXME test this\n\n return _this;\n },\n styleRules: function styleRules(_styleRules) {\n _this.update({ styleRules: _styleRules });\n\n return _this;\n },\n suffixText: function suffixText(_suffixText) {\n _this.update({ suffixText: _suffixText });\n\n return _this;\n },\n unformatOnHover: function unformatOnHover(_unformatOnHover) {\n _this.settings.unformatOnHover = _unformatOnHover; //FIXME test this\n\n return _this;\n },\n unformatOnSubmit: function unformatOnSubmit(_unformatOnSubmit) {\n _this.settings.unformatOnSubmit = _unformatOnSubmit; //FIXME test this\n\n return _this;\n },\n wheelStep: function wheelStep(_wheelStep) {\n _this.settings.wheelStep = _wheelStep; //FIXME test this\n\n return _this;\n }\n };\n }\n\n /**\n * Return the autoNumeric version number (for debugging purpose)\n *\n * @returns {string}\n */\n\n\n _createClass(AutoNumeric, [{\n key: '_saveInitialValues',\n\n\n /**\n * Save the initial element values for later use in the pristine test.\n * Those values are :\n * - the html attribute (ie. ), and\n * - the script `value` (ie. `let domElement.value`)\n *\n * @param {null|number|string} initialValue\n * @private\n */\n value: function _saveInitialValues(initialValue) {\n // Keep the very first initial values (in the html attribute and set by the script). This is needed to check if the element is pristine.\n // Save the html attribute 'value'\n this.initialValueHtmlAttribute = this.domElement.getAttribute('value');\n if (_AutoNumericHelper2.default.isNull(this.initialValueHtmlAttribute)) {\n // Set the default empty value attribute instead of `null`, since if the initial value is null, the empty string is used\n this.initialValueHtmlAttribute = '';\n }\n\n // Save the 'script' value\n this.initialValue = initialValue;\n if (_AutoNumericHelper2.default.isNull(this.initialValue)) {\n // Same as above\n this.initialValue = '';\n }\n }\n\n /**\n * Generate all the event listeners for the given DOM element\n * @private\n */\n\n }, {\n key: '_createEventListeners',\n value: function _createEventListeners() {\n var _this2 = this;\n\n // Create references to the event handler functions, so we can then cleanly removes those listeners if needed\n // That would not be possible if we used closures directly in the event handler declarations\n this._onFocusInFunc = function (e) {\n _this2._onFocusIn(e);\n };\n this._onFocusInAndMouseEnterFunc = function (e) {\n _this2._onFocusInAndMouseEnter(e);\n };\n this._onFocusFunc = function () {\n _this2._onFocus();\n };\n this._onKeydownFunc = function (e) {\n _this2._onKeydown(e);\n };\n this._onKeypressFunc = function (e) {\n _this2._onKeypress(e);\n };\n this._onInputFunc = function (e) {\n _this2._onInput(e);\n };\n this._onKeyupFunc = function (e) {\n _this2._onKeyup(e);\n };\n this._onFocusOutAndMouseLeaveFunc = function (e) {\n _this2._onFocusOutAndMouseLeave(e);\n };\n this._onPasteFunc = function (e) {\n _this2._onPaste(e);\n };\n this._onWheelFunc = function (e) {\n _this2._onWheel(e);\n };\n this._onFormSubmitFunc = function () {\n _this2._onFormSubmit();\n };\n this._onKeydownGlobalFunc = function (e) {\n _this2._onKeydownGlobal(e);\n };\n this._onKeyupGlobalFunc = function (e) {\n _this2._onKeyupGlobal(e);\n };\n this._onDropFunc = function (e) {\n _this2._onDrop(e);\n };\n\n // Add the event listeners\n this.domElement.addEventListener('focusin', this._onFocusInFunc, false);\n this.domElement.addEventListener('focus', this._onFocusInAndMouseEnterFunc, false);\n this.domElement.addEventListener('focus', this._onFocusFunc, false);\n this.domElement.addEventListener('mouseenter', this._onFocusInAndMouseEnterFunc, false);\n this.domElement.addEventListener('keydown', this._onKeydownFunc, false);\n this.domElement.addEventListener('keypress', this._onKeypressFunc, false);\n this.domElement.addEventListener('input', this._onInputFunc, false);\n this.domElement.addEventListener('keyup', this._onKeyupFunc, false);\n this.domElement.addEventListener('blur', this._onFocusOutAndMouseLeaveFunc, false);\n this.domElement.addEventListener('mouseleave', this._onFocusOutAndMouseLeaveFunc, false);\n this.domElement.addEventListener('paste', this._onPasteFunc, false);\n this.domElement.addEventListener('wheel', this._onWheelFunc, false);\n this.domElement.addEventListener('drop', this._onDropFunc, false);\n\n if (!_AutoNumericHelper2.default.isNull(this.parentForm)) {\n this.parentForm.addEventListener('submit', this._onFormSubmitFunc, false);\n }\n\n // Create one global event listener for the keyup event on the document object, which will be shared by all the autoNumeric elements\n if (!AutoNumeric._doesGlobalListExists()) {\n document.addEventListener('keydown', this._onKeydownGlobalFunc, false);\n document.addEventListener('keyup', this._onKeyupGlobalFunc, false);\n }\n }\n\n /**\n * Remove all the autoNumeric-related event listeners for the given DOM element\n * @private\n */\n\n }, {\n key: '_removeEventListeners',\n value: function _removeEventListeners() {\n //FIXME test this\n this.domElement.removeEventListener('focusin', this._onFocusInFunc, false);\n this.domElement.removeEventListener('focus', this._onFocusInAndMouseEnterFunc, false);\n this.domElement.removeEventListener('focus', this._onFocusFunc, false);\n this.domElement.removeEventListener('mouseenter', this._onFocusInAndMouseEnterFunc, false);\n this.domElement.removeEventListener('blur', this._onFocusOutAndMouseLeaveFunc, false);\n this.domElement.removeEventListener('mouseleave', this._onFocusOutAndMouseLeaveFunc, false);\n this.domElement.removeEventListener('keydown', this._onKeydownFunc, false);\n this.domElement.removeEventListener('keypress', this._onKeypressFunc, false);\n this.domElement.removeEventListener('input', this._onInputFunc, false);\n this.domElement.removeEventListener('keyup', this._onKeyupFunc, false);\n this.domElement.removeEventListener('paste', this._onPasteFunc, false);\n this.domElement.removeEventListener('wheel', this._onWheelFunc, false);\n\n document.removeEventListener('keydown', this._onKeydownGlobalFunc, false);\n document.removeEventListener('keyup', this._onKeyupGlobalFunc, false);\n\n if (!_AutoNumericHelper2.default.isNull(this.parentForm)) {\n this.parentForm.removeEventListener('submit', this._onFormSubmitFunc, false);\n }\n }\n\n /**\n * Set the element attribute 'readonly' according to the current settings.\n *\n * @private\n */\n\n }, {\n key: '_setReadOnly',\n value: function _setReadOnly() {\n if (this.isInputElement && this.settings.readOnly) {\n this.domElement.readOnly = true;\n }\n }\n\n /**\n * Save the current raw value into the history table, along with the selection information.\n *\n * If the user has done some undos and tries to enter:\n * - a new and different number than the 'next' state, this drops the rest of the history table\n * - the very same number that result in the same rawValue than the 'next' state, we only move the history table pointer to the next state\n *\n * @private\n */\n\n }, {\n key: '_historyTableAdd',\n value: function _historyTableAdd() {\n //TODO Add a `this.settings.saveSelectionsIntoHistory` option to prevent saving the selections (in order to gain performance)\n var isEmptyHistoryTable = this.historyTable.length === 0;\n // Only add a new value if it's different than the previous one (to prevent infinitely adding values on mouseover for instance)\n if (isEmptyHistoryTable || this.rawValue !== this._historyTableCurrentValueUsed()) {\n // Trim the history table if the user changed the value of an intermediary state\n var addNewHistoryState = true;\n if (!isEmptyHistoryTable) {\n // If some undo has been done and the user type the exact same data than the next entry after the current history pointer, do no drop the rest of the 'redo' list, and just advance the historyTableIndex\n var nextHistoryStateIndex = this.historyTableIndex + 1;\n if (nextHistoryStateIndex < this.historyTable.length && this.rawValue === this.historyTable[nextHistoryStateIndex].value) {\n // If the character input result in the same state than the next one, do not remove the next history states nor add a new one\n addNewHistoryState = false;\n } else {\n // First remove anything that is after the current index\n _AutoNumericHelper2.default.arrayTrim(this.historyTable, this.historyTableIndex + 1);\n }\n }\n\n // Update the history pointer\n this.historyTableIndex++;\n\n // Add the new history state, if needed\n if (addNewHistoryState) {\n // Save the selection info\n var selection = _AutoNumericHelper2.default.getElementSelection(this.domElement);\n this.selectionStart = selection.start;\n this.selectionEnd = selection.end;\n\n // Then add the new raw value\n this.historyTable.push({\n // Save the rawValue and selection start/end\n value: this.rawValue,\n // The selection for this element is temporary, and will be updated when the next history state will be recorded.\n // That way, we are always sure we save the last caret or selection positions just before the value is changed. Otherwise we would only save those positions when the value is first changed, and would not take into account that the user could move the caret around afterward.\n // For instance, this is needed if the user change the element value, and immediately undo it ; if he then does a redo, he'll see the value and the right selection\n // To sum up; The selection position are not always +1 character, since it could also be '2' if a group separator is added when entering one character. That's why the current history state caret/selection position is updated on each `keyup` event.\n start: this.selectionStart + 1, // Here we add one since the user added one character too\n end: this.selectionEnd + 1\n });\n\n // Update the selection in the previous entry, in order to keep track of the updated caret/selection positions\n if (this.historyTable.length > 1) {\n this.historyTable[this.historyTableIndex - 1].start = this.selectionStart;\n this.historyTable[this.historyTableIndex - 1].end = this.selectionEnd;\n }\n }\n\n // Limit the history table size according to the `historySize` option\n if (this.historyTable.length > this.settings.historySize) {\n this._historyTableForget();\n }\n }\n }\n\n /**\n * Debug function for the history table\n * @private\n */\n /*\n _debugHistoryTable() {\n let i = 0;\n let mark;\n this.historyTable.forEach(history => {\n if (this.historyTableIndex === i) {\n mark = '> ';\n } else {\n mark = '';\n }\n console.log(`${mark}${i++}: ${history.value} ${history.start}|${history.end} [onGoingRedo: ${this.onGoingRedo}]`); //DEBUG\n });\n }\n */\n\n /**\n * 'Undo' or 'Redo' the last/next user entry in the history table.\n * This does not modify the history table, only the pointer to the current state.\n *\n * @param {boolean} undo If set to `true`, then this function does an 'Undo', otherwise it does a 'Redo'\n * @private\n */\n\n }, {\n key: '_historyTableUndoOrRedo',\n value: function _historyTableUndoOrRedo() {\n var undo = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;\n\n var check = void 0;\n if (undo) {\n // Only 'undo' if there are some info to undo\n check = this.historyTableIndex > 0;\n if (check) {\n this.historyTableIndex--;\n }\n } else {\n // Only 'redo' if there are some info to redo at the end of the history table\n check = this.historyTableIndex + 1 < this.historyTable.length;\n if (check) {\n this.historyTableIndex++;\n }\n }\n\n if (check) {\n // Set the value back\n var undoInfo = this.historyTable[this.historyTableIndex];\n this.set(undoInfo.value, null, false); // next or previous raw value\n\n // Set the selection back\n _AutoNumericHelper2.default.setElementSelection(this.domElement, undoInfo.start, undoInfo.end);\n }\n }\n\n /**\n * 'Undo' the last user entry by going back one entry in the history table.\n * This keeps the following entries in order to allow for a 'redo'.\n * This does not modify the history table, only the pointer to the current state.\n * @private\n */\n\n }, {\n key: '_historyTableUndo',\n value: function _historyTableUndo() {\n this._historyTableUndoOrRedo(true);\n }\n\n /**\n * 'Redo' the next user entry in the history table.\n * This does not modify the history table, only the pointer to the current state.\n * @private\n */\n\n }, {\n key: '_historyTableRedo',\n value: function _historyTableRedo() {\n this._historyTableUndoOrRedo(false);\n }\n\n /**\n * Reset the history table to its initial state, and select the value.\n * @private\n */\n /*\n resetHistoryTable() { //FIXME Test this\n this.set(this.rawValue, null, false);\n this.select();\n const selection = AutoNumericHelper.getElementSelection(this.domElement);\n this.historyTableIndex = 0;\n this.historyTable = [{\n // Save the rawValue and selection start/end\n value: this.rawValue,\n start: selection.start,\n end : selection.end,\n }];\n }\n */\n\n /**\n * Make the history table forget its first N elements, shifting its indexes in the process.\n * `N` being given as the `numberOfEntriesToForget` parameter.\n *\n * @param {Number} numberOfEntriesToForget\n * @returns {object|Array