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

Commit e5d7ff0

Browse files
1.8.5
1 parent 7090722 commit e5d7ff0

File tree

3 files changed

+25
-12
lines changed

3 files changed

+25
-12
lines changed

dist/mask.js

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!
22
* angular-ui-mask
33
* https://github.com/angular-ui/ui-mask
4-
* Version: 1.8.4 - 2016-05-17T14:33:25.025Z
4+
* Version: 1.8.5 - 2016-06-10T16:53:59.510Z
55
* License: MIT
66
*/
77

@@ -87,13 +87,13 @@ angular.module('ui.mask', [])
8787
preventBackspace;
8888

8989
var originalIsEmpty = controller.$isEmpty;
90-
controller.$isEmpty = function(value) {
91-
if (maskProcessed) {
92-
return originalIsEmpty(unmaskValue(value || ''));
93-
} else {
94-
return originalIsEmpty(value);
95-
}
96-
};
90+
controller.$isEmpty = function(value) {
91+
if (maskProcessed) {
92+
return originalIsEmpty(unmaskValue(value || ''));
93+
} else {
94+
return originalIsEmpty(value);
95+
}
96+
};
9797

9898
function initialize(maskAttr) {
9999
if (!angular.isDefined(maskAttr)) {
@@ -463,8 +463,21 @@ angular.module('ui.mask', [])
463463
}
464464
}
465465
//Check for different value and trigger change.
466+
//Check for different value and trigger change.
466467
if (value !== prevValue) {
468+
// #157 Fix the bug from the trigger when backspacing exactly on the first letter (emptying the field)
469+
// and then blurring out.
470+
// Angular uses html element and calls setViewValue(element.value.trim()), setting it to the trimmed mask
471+
// when it should be empty
472+
var currentVal = iElement.val();
473+
var isTemporarilyEmpty = value === '' && currentVal && angular.isDefined(iAttrs.uiMaskPlaceholderChar) && iAttrs.uiMaskPlaceholderChar === 'space';
474+
if(isTemporarilyEmpty) {
475+
iElement.val('');
476+
}
467477
triggerChangeEvent(iElement[0]);
478+
if(isTemporarilyEmpty) {
479+
iElement.val(currentVal);
480+
}
468481
}
469482
prevValue = value;
470483
}
@@ -603,7 +616,7 @@ angular.module('ui.mask', [])
603616

604617
// If value has not changed, don't want to call $setViewValue, may be caused by IE raising input event due to placeholder
605618
if (valUnmasked !== valUnmaskedOld)
606-
valAltered = true;
619+
valAltered = true;
607620
}
608621

609622
// Update values

dist/mask.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-ui-mask",
3-
"version": "1.8.4",
3+
"version": "1.8.5",
44
"author": "https://github.com/angular-ui/ui-mask/graphs/contributors",
55
"license": "MIT",
66
"homepage": "https://github.com/angular-ui/ui-mask",

0 commit comments

Comments
 (0)