ソースを参照

make behavior of [] and {0,1} consistent

Robin Herbots 7 年 前
コミット
b916b5fb53
50 ファイル変更83 行追加86 行削除
  1. 2 0
      CHANGELOG.md
  2. 1 0
      README.md
  3. 1 1
      bower.json
  4. 1 1
      component.json
  5. 1 1
      composer.json
  6. 1 1
      dist/inputmask/bindings/inputmask.binding.js
  7. 1 1
      dist/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.js
  8. 1 1
      dist/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.js
  9. 1 1
      dist/inputmask/dependencyLibs/inputmask.dependencyLib.js
  10. 1 1
      dist/inputmask/global/document.js
  11. 1 1
      dist/inputmask/global/window.js
  12. 1 1
      dist/inputmask/inputmask.date.extensions.js
  13. 1 1
      dist/inputmask/inputmask.extensions.js
  14. 10 9
      dist/inputmask/inputmask.js
  15. 1 1
      dist/inputmask/inputmask.numeric.extensions.js
  16. 1 1
      dist/inputmask/inputmask.phone.extensions.js
  17. 1 1
      dist/inputmask/jquery.inputmask.js
  18. 1 1
      dist/inputmask/phone-codes/phone-be.js
  19. 1 1
      dist/inputmask/phone-codes/phone-ca.js
  20. 1 1
      dist/inputmask/phone-codes/phone-hu.js
  21. 1 1
      dist/inputmask/phone-codes/phone-it.js
  22. 1 1
      dist/inputmask/phone-codes/phone-mx.js
  23. 1 1
      dist/inputmask/phone-codes/phone-nl.js
  24. 1 1
      dist/inputmask/phone-codes/phone-ru.js
  25. 1 1
      dist/inputmask/phone-codes/phone.js
  26. 10 9
      dist/jquery.inputmask.bundle.js
  27. 1 1
      dist/min/inputmask/bindings/inputmask.binding.min.js
  28. 1 1
      dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.min.js
  29. 1 1
      dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.min.js
  30. 1 1
      dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.min.js
  31. 1 1
      dist/min/inputmask/global/document.min.js
  32. 1 1
      dist/min/inputmask/global/window.min.js
  33. 1 1
      dist/min/inputmask/inputmask.date.extensions.min.js
  34. 1 1
      dist/min/inputmask/inputmask.extensions.min.js
  35. 2 2
      dist/min/inputmask/inputmask.min.js
  36. 1 1
      dist/min/inputmask/inputmask.numeric.extensions.min.js
  37. 1 1
      dist/min/inputmask/inputmask.phone.extensions.min.js
  38. 1 1
      dist/min/inputmask/jquery.inputmask.min.js
  39. 1 1
      dist/min/inputmask/phone-codes/phone-be.min.js
  40. 1 1
      dist/min/inputmask/phone-codes/phone-ca.min.js
  41. 1 1
      dist/min/inputmask/phone-codes/phone-hu.min.js
  42. 1 1
      dist/min/inputmask/phone-codes/phone-it.min.js
  43. 1 1
      dist/min/inputmask/phone-codes/phone-mx.min.js
  44. 1 1
      dist/min/inputmask/phone-codes/phone-nl.min.js
  45. 1 1
      dist/min/inputmask/phone-codes/phone-ru.min.js
  46. 1 1
      dist/min/inputmask/phone-codes/phone.min.js
  47. 2 2
      dist/min/jquery.inputmask.bundle.min.js
  48. 13 21
      js/inputmask.js
  49. 1 1
      package.json
  50. 1 1
      qunit/tests_optional.js

+ 2 - 0
CHANGELOG.md

@@ -11,6 +11,8 @@
 - CSS Unit Mask #1843
 - CSS Unit Mask #1843
 
 
 ### Updates
 ### Updates
+- make behavior of [] an {0,1} consistent
+- change default value from greedy option to false
 - fix unmatched alternations in gettests. ("[0-9]{2}|[0-9]{3}" like masks)
 - fix unmatched alternations in gettests. ("[0-9]{2}|[0-9]{3}" like masks)
 - code cleanup and refactoring
 - code cleanup and refactoring
     - oncomplete calls
     - oncomplete calls

+ 1 - 0
README.md

@@ -786,6 +786,7 @@ $(document).ready(function(){
 ```
 ```
 
 
 ### greedy
 ### greedy
+Default: false
 Toggle to allocate as much possible or the opposite. Non-greedy repeat function.
 Toggle to allocate as much possible or the opposite. Non-greedy repeat function.
 
 
 ```javascript
 ```javascript

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "inputmask",
   "name": "inputmask",
-  "version": "4.0.0-beta.49",
+  "version": "4.0.0-beta.50",
   "main": [
   "main": [
 	  "./dist/inputmask/inputmask.js",
 	  "./dist/inputmask/inputmask.js",
 	  "./dist/inputmask/inputmask.extensions.js",
 	  "./dist/inputmask/inputmask.extensions.js",

+ 1 - 1
component.json

@@ -2,7 +2,7 @@
 	"name": "inputmask",
 	"name": "inputmask",
 	"repository": "robinherbots/Inputmask",
 	"repository": "robinherbots/Inputmask",
 	"description": "Inputmask is a javascript library which creates an input mask.  Inputmask can run against vanilla javascript, jQuery and jqlite.",
 	"description": "Inputmask is a javascript library which creates an input mask.  Inputmask can run against vanilla javascript, jQuery and jqlite.",
-	"version": "4.0.0-beta.49",
+	"version": "4.0.0-beta.50",
 	"keywords": [
 	"keywords": [
 		"jquery",
 		"jquery",
 		"plugins",
 		"plugins",

+ 1 - 1
composer.json

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

+ 1 - 1
dist/inputmask/bindings/inputmask.binding.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.49
+* Version: 4.0.0-beta.50
 */
 */
 
 
 !function(factory) {
 !function(factory) {

+ 1 - 1
dist/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.49
+* Version: 4.0.0-beta.50
 */
 */
 
 
 !function(factory) {
 !function(factory) {

+ 1 - 1
dist/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.49
+* Version: 4.0.0-beta.50
 */
 */
 
 
 !function(factory) {
 !function(factory) {

+ 1 - 1
dist/inputmask/dependencyLibs/inputmask.dependencyLib.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.49
+* Version: 4.0.0-beta.50
 */
 */
 
 
 !function(factory) {
 !function(factory) {

+ 1 - 1
dist/inputmask/global/document.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.49
+* Version: 4.0.0-beta.50
 */
 */
 
 
 "function" == typeof define && define.amd ? define(function() {
 "function" == typeof define && define.amd ? define(function() {

+ 1 - 1
dist/inputmask/global/window.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.49
+* Version: 4.0.0-beta.50
 */
 */
 
 
 "function" == typeof define && define.amd ? define(function() {
 "function" == typeof define && define.amd ? define(function() {

+ 1 - 1
dist/inputmask/inputmask.date.extensions.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.49
+* Version: 4.0.0-beta.50
 */
 */
 
 
 !function(factory) {
 !function(factory) {

+ 1 - 1
dist/inputmask/inputmask.extensions.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.49
+* Version: 4.0.0-beta.50
 */
 */
 
 
 !function(factory) {
 !function(factory) {

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


+ 1 - 1
dist/inputmask/inputmask.numeric.extensions.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.49
+* Version: 4.0.0-beta.50
 */
 */
 
 
 !function(factory) {
 !function(factory) {

+ 1 - 1
dist/inputmask/inputmask.phone.extensions.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.49
+* Version: 4.0.0-beta.50
 */
 */
 
 
 !function(factory) {
 !function(factory) {

+ 1 - 1
dist/inputmask/jquery.inputmask.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.49
+* Version: 4.0.0-beta.50
 */
 */
 
 
 !function(factory) {
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-be.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.49
+* Version: 4.0.0-beta.50
 */
 */
 
 
 !function(factory) {
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-ca.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.49
+* Version: 4.0.0-beta.50
 */
 */
 
 
 !function(factory) {
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-hu.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.49
+* Version: 4.0.0-beta.50
 */
 */
 
 
 !function(factory) {
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-it.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.49
+* Version: 4.0.0-beta.50
 */
 */
 
 
 !function(factory) {
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-mx.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.49
+* Version: 4.0.0-beta.50
 */
 */
 
 
 !function(factory) {
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-nl.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.49
+* Version: 4.0.0-beta.50
 */
 */
 
 
 !function(factory) {
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-ru.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.49
+* Version: 4.0.0-beta.50
 */
 */
 
 
 !function(factory) {
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.49
+* Version: 4.0.0-beta.50
 */
 */
 
 
 !function(factory) {
 !function(factory) {

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


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


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


+ 1 - 1
dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.min.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.49
+* Version: 4.0.0-beta.50
 */
 */
 
 
 !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):window.dependencyLib=e(jQuery)}(function(e){return e});
 !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):window.dependencyLib=e(jQuery)}(function(e){return e});

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


+ 1 - 1
dist/min/inputmask/global/document.min.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.49
+* Version: 4.0.0-beta.50
 */
 */
 
 
 "function"==typeof define&&define.amd?define(function(){return document}):"object"==typeof exports&&(module.exports=document);
 "function"==typeof define&&define.amd?define(function(){return document}):"object"==typeof exports&&(module.exports=document);

+ 1 - 1
dist/min/inputmask/global/window.min.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.0-beta.49
+* Version: 4.0.0-beta.50
 */
 */
 
 
 "function"==typeof define&&define.amd?define(function(){return window}):"object"==typeof exports&&(module.exports=window);
 "function"==typeof define&&define.amd?define(function(){return window}):"object"==typeof exports&&(module.exports=window);

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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


+ 13 - 21
js/inputmask.js

@@ -63,7 +63,7 @@
                 onincomplete: $.noop, //executes when the mask is incomplete and focus is lost
                 onincomplete: $.noop, //executes when the mask is incomplete and focus is lost
                 oncleared: $.noop, //executes when the mask is cleared
                 oncleared: $.noop, //executes when the mask is cleared
                 repeat: 0, //repetitions of the mask: * ~ forever, otherwise specify an integer
                 repeat: 0, //repetitions of the mask: * ~ forever, otherwise specify an integer
-                greedy: true, //true: allocated buffer for the mask and repetitions - false: allocate only if needed
+                greedy: false, //true: allocated buffer for the mask and repetitions - false: allocate only if needed
                 autoUnmask: false, //automatically unmask when retrieving the value with $.fn.val or value if the browser supports __lookupGetter__ or getOwnPropertyDescriptor
                 autoUnmask: false, //automatically unmask when retrieving the value with $.fn.val or value if the browser supports __lookupGetter__ or getOwnPropertyDescriptor
                 removeMaskOnSubmit: false, //remove the mask before submitting the form.
                 removeMaskOnSubmit: false, //remove the mask before submitting the form.
                 clearMaskOnLostFocus: true,
                 clearMaskOnLostFocus: true,
@@ -821,15 +821,20 @@
                 trackCaret = false;
                 trackCaret = false;
 
 
             //maskset helperfunctions
             //maskset helperfunctions
-            function getMaskTemplate(baseOnInput, minimalPos, includeMode, noJit) {
+            function getMaskTemplate(baseOnInput, minimalPos, includeMode, noJit, clearOptionalTail) {
                 //includeMode true => input, undefined => placeholder, false => mask
                 //includeMode true => input, undefined => placeholder, false => mask
+
+                var greedy = opts.greedy;
+                if (clearOptionalTail) opts.greedy = false;
                 minimalPos = minimalPos || 0;
                 minimalPos = minimalPos || 0;
                 var maskTemplate = [],
                 var maskTemplate = [],
                     ndxIntlzr, pos = 0,
                     ndxIntlzr, pos = 0,
                     test, testPos, lvp = getLastValidPosition();
                     test, testPos, lvp = getLastValidPosition();
                 do {
                 do {
                     if (baseOnInput === true && getMaskSet().validPositions[pos]) {
                     if (baseOnInput === true && getMaskSet().validPositions[pos]) {
-                        testPos = getMaskSet().validPositions[pos];
+                        testPos = (clearOptionalTail && getMaskSet().validPositions[pos].match.optionality === true && (getMaskSet().validPositions[pos].generatedInput === true || getMaskSet().validPositions[pos].input == opts.skipOptionalPartCharacter) && getMaskSet().validPositions[pos + 1] === undefined)
+                            ? determineTestTemplate(pos, getTests(pos, ndxIntlzr, pos - 1))
+                            : getMaskSet().validPositions[pos];
                         test = testPos.match;
                         test = testPos.match;
                         ndxIntlzr = testPos.locator.slice();
                         ndxIntlzr = testPos.locator.slice();
                         maskTemplate.push(includeMode === true ? testPos.input : includeMode === false ? test.nativeDef : getPlaceholder(pos, test));
                         maskTemplate.push(includeMode === true ? testPos.input : includeMode === false ? test.nativeDef : getPlaceholder(pos, test));
@@ -856,6 +861,8 @@
                 if (includeMode !== false || //do not alter the masklength when just retrieving the maskdefinition
                 if (includeMode !== false || //do not alter the masklength when just retrieving the maskdefinition
                     getMaskSet().maskLength === undefined) //just make sure the maskLength gets initialized in all cases (needed for isValid)
                     getMaskSet().maskLength === undefined) //just make sure the maskLength gets initialized in all cases (needed for isValid)
                     getMaskSet().maskLength = pos - 1;
                     getMaskSet().maskLength = pos - 1;
+
+                opts.greedy = greedy;
                 return maskTemplate;
                 return maskTemplate;
             }
             }
 
 
@@ -2660,24 +2667,9 @@
             }
             }
 
 
             function clearOptionalTail(buffer) {
             function clearOptionalTail(buffer) {
-                var rl = determineLastRequiredPosition(),
-                    validPos, bl = buffer.length;
-
-                var lv = getMaskSet().validPositions[getLastValidPosition()];
-                while (rl < bl &&
-                !isMask(rl, true) &&
-                (validPos = (lv !== undefined ? getTestTemplate(rl, lv.locator.slice(""), lv) : getTest(rl))) &&
-                validPos.match.optionality !== true &&
-                ((validPos.match.optionalQuantifier !== true && validPos.match.newBlockMarker !== true) || (rl + 1 === bl &&
-                    (lv !== undefined ? getTestTemplate(rl + 1, lv.locator.slice(""), lv) : getTest(rl + 1)).match.def === ""))) {
-                    rl++;
-                }
-
-                //exceptionally strip from the validatedPositions
-                while ((validPos = getMaskSet().validPositions[rl - 1]) && validPos && validPos.match.optionality && validPos.input === opts.skipOptionalPartCharacter) {
-                    rl--;
-                }
-                buffer.splice(rl);
+                buffer.length = 0;
+                var template = getMaskTemplate(true, 0, true, undefined, true), lmnt, validPos;
+                while (lmnt = template.shift(), lmnt !== undefined) buffer.push(lmnt);
                 return buffer;
                 return buffer;
             }
             }
 
 

+ 1 - 1
package.json

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

+ 1 - 1
qunit/tests_optional.js

@@ -77,7 +77,7 @@ export default function (qunit, $, Inputmask) {
 
 
 		testmask.focus();
 		testmask.focus();
 		$("#testmask").Type("123456");
 		$("#testmask").Type("123456");
-		assert.equal(testmask.value, "12345-6", "Result " + testmask.value);
+		assert.equal(testmask.value, "12345-6___", "Result " + testmask.value);
 	});
 	});
 
 
 	qunit.test("inputmask({ mask: \"99999[-9999]\", greedy: false }) - input 123456789", function (assert) {
 	qunit.test("inputmask({ mask: \"99999[-9999]\", greedy: false }) - input 123456789", function (assert) {