ソースを参照

Error thrown in unmask after upgrade to 5.0.5 fix #2375

Robin Herbots 5 年 前
コミット
da2c60f1a4

+ 1 - 0
CHANGELOG.md

@@ -2,6 +2,7 @@
 
 ## [5.0.6 - UNRELEASED]
 ### Fixed
+- Error thrown in unmask after upgrade to 5.0.5 #2375
 - Inputmask.remove(document.getElementById(selector)) is not working in Node after version 5.0.5 update #2373
 - date format yyyy-mm-dd doesn't work with min and max #2360
 - Datetime inputFormat mm/dd/yyyy allows entry of 02/3 without padding the day #1922

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "inputmask",
-  "version": "5.0.6-beta.6",
+  "version": "5.0.6-beta.8",
   "main": [
 	  "./index.js",
     "./css/inputmask.css"

+ 1 - 1
composer.json

@@ -1,7 +1,7 @@
 {
   "name": "robinherbots/inputmask",
   "description": "Inputmask is a javascript library which creates an input mask.  Inputmask can run against vanilla javascript, jQuery and jqlite.",
-  "version": "5.0.6-beta.6",
+  "version": "5.0.6-beta.8",
   "type": "library",
   "keywords": ["jquery", "plugins", "input", "form", "inputmask", "mask"],
   "homepage": "http://robinherbots.github.io/Inputmask",

+ 3 - 3
dist/inputmask.js

@@ -3,7 +3,7 @@
  * https://github.com/RobinHerbots/Inputmask
  * Copyright (c) 2010 - 2020 Robin Herbots
  * Licensed under the MIT license
- * Version: 5.0.6-beta.5
+ * Version: 5.0.6-beta.7
  */
 !function webpackUniversalModuleDefinition(root, factory) {
     if ("object" == typeof exports && "object" == typeof module) module.exports = factory(); else if ("function" == typeof define && define.amd) define([], factory); else {
@@ -975,7 +975,7 @@
                     var keypress = new $.Event("_checkval");
                     keypress.which = charCode.toString().charCodeAt(0), charCodes += charCode;
                     var lvp = _positioning.getLastValidPosition.call(inputmask, void 0, !0);
-                    isTemplateMatch(initialNdx, charCodes) ? result = _eventhandlers.EventHandlers.keypressEvent.call(input || inputmask, keypress, !0, !1, strict, lvp + 1) : (result = _eventhandlers.EventHandlers.keypressEvent.call(input || inputmask, keypress, !0, !1, strict, inputmask.caretPos.begin), 
+                    isTemplateMatch(initialNdx, charCodes) ? result = _eventhandlers.EventHandlers.keypressEvent.call(inputmask, keypress, !0, !1, strict, lvp + 1) : (result = _eventhandlers.EventHandlers.keypressEvent.call(inputmask, keypress, !0, !1, strict, inputmask.caretPos.begin), 
                     result && (initialNdx = inputmask.caretPos.begin + 1, charCodes = "")), result ? (void 0 !== result.pos && maskset.validPositions[result.pos] && !0 === maskset.validPositions[result.pos].match.static && void 0 === maskset.validPositions[result.pos].alternation && (staticMatches.push(result.pos), 
                     inputmask.isRTL || (result.forwardPosition = result.pos + 1)), writeBuffer.call(inputmask, void 0, _positioning.getBuffer.call(inputmask), result.forwardPosition, keypress, !1), 
                     inputmask.caretPos = {
@@ -988,7 +988,7 @@
                 if (!_validation.isComplete.call(inputmask, _positioning.getBuffer.call(inputmask)) && staticMatches.length <= nextValid || _validation.isComplete.call(inputmask, _positioning.getBuffer.call(inputmask)) && 0 < staticMatches.length && staticMatches.length !== nextValid && 0 === staticMatches[0]) for (var nextSndx = nextValid; void 0 !== (sndx = staticMatches.shift()); ) {
                     var keypress = new $.Event("_checkval");
                     if (validPos = maskset.validPositions[sndx], validPos.generatedInput = !0, keypress.which = validPos.input.charCodeAt(0), 
-                    result = _eventhandlers.EventHandlers.keypressEvent.call(input, keypress, !0, !1, strict, nextSndx), 
+                    result = _eventhandlers.EventHandlers.keypressEvent.call(inputmask, keypress, !0, !1, strict, nextSndx), 
                     result && void 0 !== result.pos && result.pos !== sndx && maskset.validPositions[result.pos] && !0 === maskset.validPositions[result.pos].match.static) staticMatches.push(result.pos); else if (!result) break;
                     nextSndx++;
                 }

ファイルの差分が大きいため隠しています
+ 2 - 2
dist/inputmask.min.js


+ 3 - 3
dist/jquery.inputmask.js

@@ -3,7 +3,7 @@
  * https://github.com/RobinHerbots/Inputmask
  * Copyright (c) 2010 - 2020 Robin Herbots
  * Licensed under the MIT license
- * Version: 5.0.6-beta.5
+ * Version: 5.0.6-beta.7
  */
 !function webpackUniversalModuleDefinition(root, factory) {
     if ("object" == typeof exports && "object" == typeof module) module.exports = factory(require("jquery")); else if ("function" == typeof define && define.amd) define([ "jquery" ], factory); else {
@@ -975,7 +975,7 @@
                     var keypress = new $.Event("_checkval");
                     keypress.which = charCode.toString().charCodeAt(0), charCodes += charCode;
                     var lvp = _positioning.getLastValidPosition.call(inputmask, void 0, !0);
-                    isTemplateMatch(initialNdx, charCodes) ? result = _eventhandlers.EventHandlers.keypressEvent.call(input || inputmask, keypress, !0, !1, strict, lvp + 1) : (result = _eventhandlers.EventHandlers.keypressEvent.call(input || inputmask, keypress, !0, !1, strict, inputmask.caretPos.begin), 
+                    isTemplateMatch(initialNdx, charCodes) ? result = _eventhandlers.EventHandlers.keypressEvent.call(inputmask, keypress, !0, !1, strict, lvp + 1) : (result = _eventhandlers.EventHandlers.keypressEvent.call(inputmask, keypress, !0, !1, strict, inputmask.caretPos.begin), 
                     result && (initialNdx = inputmask.caretPos.begin + 1, charCodes = "")), result ? (void 0 !== result.pos && maskset.validPositions[result.pos] && !0 === maskset.validPositions[result.pos].match.static && void 0 === maskset.validPositions[result.pos].alternation && (staticMatches.push(result.pos), 
                     inputmask.isRTL || (result.forwardPosition = result.pos + 1)), writeBuffer.call(inputmask, void 0, _positioning.getBuffer.call(inputmask), result.forwardPosition, keypress, !1), 
                     inputmask.caretPos = {
@@ -988,7 +988,7 @@
                 if (!_validation.isComplete.call(inputmask, _positioning.getBuffer.call(inputmask)) && staticMatches.length <= nextValid || _validation.isComplete.call(inputmask, _positioning.getBuffer.call(inputmask)) && 0 < staticMatches.length && staticMatches.length !== nextValid && 0 === staticMatches[0]) for (var nextSndx = nextValid; void 0 !== (sndx = staticMatches.shift()); ) {
                     var keypress = new $.Event("_checkval");
                     if (validPos = maskset.validPositions[sndx], validPos.generatedInput = !0, keypress.which = validPos.input.charCodeAt(0), 
-                    result = _eventhandlers.EventHandlers.keypressEvent.call(input, keypress, !0, !1, strict, nextSndx), 
+                    result = _eventhandlers.EventHandlers.keypressEvent.call(inputmask, keypress, !0, !1, strict, nextSndx), 
                     result && void 0 !== result.pos && result.pos !== sndx && maskset.validPositions[result.pos] && !0 === maskset.validPositions[result.pos].match.static) staticMatches.push(result.pos); else if (!result) break;
                     nextSndx++;
                 }

ファイルの差分が大きいため隠しています
+ 2 - 2
dist/jquery.inputmask.min.js


+ 3 - 3
lib/inputHandling.js

@@ -89,14 +89,14 @@ function checkVal(input, writeOut, strict, nptvl, initiatingEvent) {
 				charCodes += charCode;
 				var lvp = getLastValidPosition.call(inputmask, undefined, true);
 				if (!isTemplateMatch(initialNdx, charCodes)) {
-					result = EventHandlers.keypressEvent.call(input || inputmask, keypress, true, false, strict, inputmask.caretPos.begin);
+					result = EventHandlers.keypressEvent.call(inputmask, keypress, true, false, strict, inputmask.caretPos.begin);
 
 					if (result) {
 						initialNdx = inputmask.caretPos.begin + 1;
 						charCodes = "";
 					}
 				} else {
-					result = EventHandlers.keypressEvent.call(input || inputmask, keypress, true, false, strict, lvp + 1);
+					result = EventHandlers.keypressEvent.call(inputmask, keypress, true, false, strict, lvp + 1);
 				}
 				if (result) {
 					if (result.pos !== undefined && maskset.validPositions[result.pos] && maskset.validPositions[result.pos].match.static === true && maskset.validPositions[result.pos].alternation === undefined) {
@@ -124,7 +124,7 @@ function checkVal(input, writeOut, strict, nptvl, initiatingEvent) {
 				validPos = maskset.validPositions[sndx];
 				validPos.generatedInput = true;
 				keypress.which = validPos.input.charCodeAt(0);
-				result = EventHandlers.keypressEvent.call(input, keypress, true, false, strict, nextSndx);
+				result = EventHandlers.keypressEvent.call(inputmask, keypress, true, false, strict, nextSndx);
 				if (result && result.pos !== undefined && result.pos !== sndx && maskset.validPositions[result.pos] && maskset.validPositions[result.pos].match.static === true) {
 					staticMatches.push(result.pos);
 				} else if (!result) break;

+ 1 - 1
package-lock.json

@@ -1,6 +1,6 @@
 {
   "name": "inputmask",
-  "version": "5.0.4-beta.49",
+  "version": "5.0.6-beta.6",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "inputmask",
-  "version": "5.0.6-beta.6",
+  "version": "5.0.6-beta.8",
   "description": "Inputmask is a javascript library which creates an input mask.  Inputmask can run against vanilla javascript, jQuery and jqlite.",
   "main": "index.js",
   "files": [

+ 6 - 1
qunit/tests_formatvalidate.js

@@ -227,5 +227,10 @@ export default function (qunit, Inputmask) {
 		assert.equal(unmasked, "23031973", "Result " + unmasked);
 	});
 
+	qunit.test("Inputmask.unmask('(123)456-78-90', '(999)999-99-99')", function (assert) {
+		var unmasked = Inputmask.unmask("(123)456-78-90", "(999)999-99-99");
+		assert.equal(unmasked, "1234567890", "Result " + unmasked);
+	});
+
 
-};
+}