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

Commit 5970499

Browse files
1.8.7
1 parent 927ee81 commit 5970499

File tree

3 files changed

+27
-12
lines changed

3 files changed

+27
-12
lines changed

dist/mask.js

Lines changed: 24 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.6 - 2016-06-20T21:05:48.730Z
4+
* Version: 1.8.7 - 2016-07-26T15:59:07.992Z
55
* License: MIT
66
*/
77

@@ -470,7 +470,7 @@ angular.module('ui.mask', [])
470470
// Angular uses html element and calls setViewValue(element.value.trim()), setting it to the trimmed mask
471471
// when it should be empty
472472
var currentVal = iElement.val();
473-
var isTemporarilyEmpty = value === '' && currentVal && angular.isDefined(iAttrs.uiMaskPlaceholderChar) && iAttrs.uiMaskPlaceholderChar === 'space';
473+
var isTemporarilyEmpty = value === '' && currentVal && angular.isDefined(iAttrs.uiMaskPlaceholderChar) && iAttrs.uiMaskPlaceholderChar === 'space';
474474
if(isTemporarilyEmpty) {
475475
iElement.val('');
476476
}
@@ -486,12 +486,20 @@ angular.module('ui.mask', [])
486486
var change;
487487
if (angular.isFunction(window.Event) && !element.fireEvent) {
488488
// modern browsers and Edge
489-
change = new Event('change', {
490-
view: window,
491-
bubbles: true,
492-
cancelable: false
493-
});
494-
element.dispatchEvent(change);
489+
try {
490+
change = new Event('change', {
491+
view: window,
492+
bubbles: true,
493+
cancelable: false
494+
});
495+
} catch (ex) {
496+
//this is for certain mobile browsers that have the Event object
497+
//but don't support the Event constructor #168
498+
change = document.createEvent('HTMLEvents');
499+
change.initEvent('change', false, true);
500+
} finally {
501+
element.dispatchEvent(change);
502+
}
495503
} else if ('createEvent' in document) {
496504
// older browsers
497505
change = document.createEvent('HTMLEvents');
@@ -523,7 +531,8 @@ angular.module('ui.mask', [])
523531
function keydownHandler(e) {
524532
/*jshint validthis: true */
525533
var isKeyBackspace = e.which === 8,
526-
caretPos = getCaretPosition(this) - 1 || 0; //value in keydown is pre change so bump caret position back to simulate post change
534+
caretPos = getCaretPosition(this) - 1 || 0, //value in keydown is pre change so bump caret position back to simulate post change
535+
isCtrlZ = e.which === 90 && e.ctrlKey; //ctrl+z pressed
527536

528537
if (isKeyBackspace) {
529538
while(caretPos >= 0) {
@@ -537,6 +546,12 @@ angular.module('ui.mask', [])
537546
}
538547
preventBackspace = caretPos === -1;
539548
}
549+
550+
if (isCtrlZ) {
551+
// prevent IE bug - value should be returned to initial state
552+
iElement.val('');
553+
e.preventDefault();
554+
}
540555
}
541556

542557
function eventHandler(e) {

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.6",
3+
"version": "1.8.7",
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)