Skip to content

Commit

Permalink
version 1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
sanniassin committed Jan 15, 2018
1 parent 7544e9f commit edb6e14
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
28 changes: 20 additions & 8 deletions dist/react-input-mask.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,22 @@ function _objectWithoutProperties(source, excluded) {
return target;
}

function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}

return self;
}

var defaultCharsRules = {
'9': '[0-9]',
'a': '[A-Za-z]',
'*': '[A-Za-z0-9]'
};
var defaultMaskChar = '_';

var parseMask = function (mask, maskChar, charsRules) {
function parseMask (mask, maskChar, charsRules) {
if (maskChar === undefined) {
maskChar = defaultMaskChar;
}
Expand Down Expand Up @@ -136,7 +144,7 @@ var parseMask = function (mask, maskChar, charsRules) {
lastEditablePos: lastEditablePos,
permanents: permanents
};
};
}

function isAndroidBrowser() {
var windows = new RegExp('windows', 'i');
Expand Down Expand Up @@ -359,13 +367,13 @@ function getInsertStringLength(maskOptions, value, insertStr, insertPos) {
return insertPos - initialInsertPos;
}

var defer = function (fn) {
function defer (fn) {
var defer = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function () {
return setTimeout(fn, 0);
};

return defer(fn);
};
}

// https://github.com/sanniassin/react-input-mask
var InputElement =
Expand All @@ -378,7 +386,7 @@ function (_React$Component) {

_this = _React$Component.call(this, props) || this;

_initialiseProps.call(_this);
_initialiseProps.call(_assertThisInitialized(_this));

var mask = props.mask,
maskChar = props.maskChar,
Expand Down Expand Up @@ -779,11 +787,15 @@ var _initialiseProps = function _initialiseProps() {

var input = _this3.getInputDOMNode(); // autofill replaces whole value, ignore old one
// https://github.com/sanniassin/react-input-mask/issues/113
//
// input.matches throws exception if selector isn't supported


if (typeof input.matches === 'function' && input.matches(':-webkit-autofill')) {
oldValue = '';
}
try {
if (typeof input.matches === 'function' && input.matches(':-webkit-autofill')) {
oldValue = '';
}
} catch (e) {}

var selection = _this3.getSelection();

Expand Down
Loading

0 comments on commit edb6e14

Please sign in to comment.