MCPcopy
hub / github.com/autoNumeric/autoNumeric / _onBlur

Method _onBlur

src/AutoNumeric.js:7548–7560  ·  view source on GitHub ↗

* When focusing out of the input, we check if the value has changed, and if it has, then we send a `change` event (since the native one would have been prevented by `e.preventDefault()` called in the other event listeners). * We also update the info of the focused state in the `this.isFocused`

(e)

Source from the content-addressed store, hash-verified

7546 * @param {Event} e
7547 */
7548 _onBlur(e) {
7549 // Keep track if the element is currently focused
7550 this.isFocused = false;
7551 // Keep track if the user is currently editing the element
7552 this.isEditing = false;
7553
7554 // Send a `change` event if the raw value has been changed since the last focus or 'enter' validation
7555 if (AutoNumericHelper.trimPaddedZerosFromDecimalPlaces(this.rawValue) !== AutoNumericHelper.trimPaddedZerosFromDecimalPlaces(this.rawValueOnFocus)) {
7556 this._triggerEvent(AutoNumeric.events.native.change, e.target);
7557 }
7558
7559 this.rawValueOnFocus = void(0); // Reset the tracker
7560 }
7561
7562 /**
7563 * Helper function that DRY the similar behaviors of the mousewheel and up/down arrow keys, which increment/decrement the element value, either by a fixed value, or using the 'progressive' heuristic

Callers 1

Calls 2

_triggerEventMethod · 0.95

Tested by

no test coverage detected