* Save the initial element values for later use in the pristine test. * Those values are : * - the html attribute (i.e. ), and * - the script `value` (i.e. `let domElement.value`) * * @param {null|number|string} initialValue * @private
(initialValue)
| 1167 | * @private |
| 1168 | */ |
| 1169 | _saveInitialValues(initialValue) { |
| 1170 | // 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. |
| 1171 | // Save the html attribute 'value' |
| 1172 | this.initialValueHtmlAttribute = AutoNumericHelper.scientificToDecimal(this.domElement.getAttribute('value')); |
| 1173 | if (AutoNumericHelper.isNull(this.initialValueHtmlAttribute)) { |
| 1174 | // Set the default empty value attribute instead of `null`, since if the initial value is null, the empty string is used |
| 1175 | this.initialValueHtmlAttribute = ''; |
| 1176 | } |
| 1177 | |
| 1178 | // Save the 'script' value |
| 1179 | this.initialValue = initialValue; |
| 1180 | if (AutoNumericHelper.isNull(this.initialValue)) { |
| 1181 | // Same as above |
| 1182 | this.initialValue = ''; |
| 1183 | } |
| 1184 | } |
| 1185 | |
| 1186 | /** |
| 1187 | * Generate all the event listeners for the given DOM element |
no test coverage detected