Skip to content
This repository was archived by the owner on Sep 4, 2024. It is now read-only.
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: probil/v-mask
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 284fa37e24ed78d5b3e2b32593587a2ea30475e9
Choose a base ref
..
head repository: probil/v-mask
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: dfe6590ad80f6e772dcf5aaaf821d97e4812a308
Choose a head ref
Showing with 10 additions and 6 deletions.
  1. +10 −6 src/directive.js
16 changes: 10 additions & 6 deletions src/directive.js
Original file line number Diff line number Diff line change
@@ -20,6 +20,15 @@ function triggerInputUpdate(el) {
trigger(el, 'input');
}

function updateElementWithMaskedValue(el, maskedValue) {
if (maskedValue === el.value) {
return;
}

el.value = maskedValue;
triggerInputUpdate(el);
}

/**
* Event handler
* @param {HTMLInputElement} el
@@ -36,12 +45,7 @@ function updateValue(el, force = false) {
if ((force || isUpdateNeeded) && mask) {
const { conformedValue } = conformToMask(value, mask, { guide: false });

if (conformedValue === value) {
return;
}

el.value = conformedValue;
triggerInputUpdate(el);
updateElementWithMaskedValue(el, conformedValue);
}

options.partiallyUpdate(el, { previousValue: value });