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

Commit

Permalink
fix(directive): reformat despite the same value
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Lyashuk committed Jun 16, 2019
1 parent dd7fffe commit e0d102f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ import { isAndroid, isChrome } from './utils/env';
* @param {Boolean} force
*/
function updateValue(el, force = false) {
const { value, dataset: { previousValue = '', mask } } = el;
const { value = '', dataset: { mask } } = el;

if (force || (value && value !== previousValue && value.length > previousValue.length)) {
const hasValue = value.trim().length > 0;

if (force || hasValue) {
el.value = format(value, mask);
if (isAndroid && isChrome) {
setTimeout(() => trigger(el, 'input'), 0);
} else {
trigger(el, 'input');
}
}

el.dataset.previousValue = value;
}

/**
Expand Down

0 comments on commit e0d102f

Please sign in to comment.