Browse Source

When blur input, inputmask adds attr placeholder to input fix #1992

Robin Herbots 7 years ago
parent
commit
6efe6a9c8b

+ 1 - 0
CHANGELOG.md

@@ -11,6 +11,7 @@
 - update dependencies
 
 ### Fixed
+- When blur input, inputmask adds attr placeholder to input - #1992
 - Fix endless loop for quantifiers (see tests_dynamic.js - latest unittests) #1983
 - Element keeps the focus to itself in ie11 #1846
 - Changes for min/max options do not get picked up. #1931

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "inputmask",
-  "version": "4.0.1-beta.38",
+  "version": "4.0.1-beta.39",
   "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": "4.0.1-beta.38",
+  "version": "4.0.1-beta.39",
   "type": "library",
   "keywords": ["jquery", "plugins", "input", "form", "inputmask", "mask"],
   "homepage": "http://robinherbots.github.io/Inputmask",

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

+ 4 - 2
dist/inputmask/inputmask.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.1-beta.38
+* Version: 4.0.1-beta.39
 */
 
 (function(factory) {
@@ -725,7 +725,7 @@
     function maskScope(actionObj, maskset, opts) {
         maskset = maskset || this.maskset;
         opts = opts || this.opts;
-        var inputmask = this, el = this.el, isRTL = this.isRTL, undoValue, $el, skipKeyPressEvent = false, skipInputEvent = false, ignorable = false, maxLength, mouseEnter = false, colorMask, originalPlaceholder = "";
+        var inputmask = this, el = this.el, isRTL = this.isRTL, undoValue, $el, skipKeyPressEvent = false, skipInputEvent = false, ignorable = false, maxLength, mouseEnter = false, colorMask, originalPlaceholder;
         function getMaskTemplate(baseOnInput, minimalPos, includeMode, noJit, clearOptionalTail) {
             var greedy = opts.greedy;
             if (clearOptionalTail) opts.greedy = false;
@@ -1913,6 +1913,7 @@
                 mouseEnter = false;
                 if (opts.clearMaskOnLostFocus && document.activeElement !== input) {
                     input.placeholder = originalPlaceholder;
+                    if (input.placeholder === "") input.removeAttribute("placeholder");
                 }
             },
             clickEvent: function(e, tabbed) {
@@ -1997,6 +1998,7 @@
                 var $input = $(this), input = this;
                 if (input.inputmask) {
                     input.placeholder = originalPlaceholder;
+                    if (input.placeholder === "") input.removeAttribute("placeholder");
                     var nptValue = input.inputmask._valueGet(), buffer = getBuffer().slice();
                     if (nptValue !== "" || colorMask !== undefined) {
                         if (opts.clearMaskOnLostFocus) {

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

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

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

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

+ 4 - 2
dist/jquery.inputmask.bundle.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.1-beta.38
+* Version: 4.0.1-beta.39
 */
 
 (function(modules) {
@@ -910,7 +910,7 @@
         function maskScope(actionObj, maskset, opts) {
             maskset = maskset || this.maskset;
             opts = opts || this.opts;
-            var inputmask = this, el = this.el, isRTL = this.isRTL, undoValue, $el, skipKeyPressEvent = false, skipInputEvent = false, ignorable = false, maxLength, mouseEnter = false, colorMask, originalPlaceholder = "";
+            var inputmask = this, el = this.el, isRTL = this.isRTL, undoValue, $el, skipKeyPressEvent = false, skipInputEvent = false, ignorable = false, maxLength, mouseEnter = false, colorMask, originalPlaceholder;
             function getMaskTemplate(baseOnInput, minimalPos, includeMode, noJit, clearOptionalTail) {
                 var greedy = opts.greedy;
                 if (clearOptionalTail) opts.greedy = false;
@@ -2104,6 +2104,7 @@
                     mouseEnter = false;
                     if (opts.clearMaskOnLostFocus && document.activeElement !== input) {
                         input.placeholder = originalPlaceholder;
+                        if (input.placeholder === "") input.removeAttribute("placeholder");
                     }
                 },
                 clickEvent: function clickEvent(e, tabbed) {
@@ -2188,6 +2189,7 @@
                     var $input = $(this), input = this;
                     if (input.inputmask) {
                         input.placeholder = originalPlaceholder;
+                        if (input.placeholder === "") input.removeAttribute("placeholder");
                         var nptValue = input.inputmask._valueGet(), buffer = getBuffer().slice();
                         if (nptValue !== "" || colorMask !== undefined) {
                             if (opts.clearMaskOnLostFocus) {

File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/bindings/inputmask.binding.min.js


File diff suppressed because it is too large
+ 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
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.1-beta.38
+* Version: 4.0.1-beta.39
 */
 
 (function(factory){if(typeof define==="function"&&define.amd){define(["jquery"],factory)}else if(typeof exports==="object"){module.exports=factory(require("jquery"))}else{window.dependencyLib=factory(jQuery)}})(function($){return $});

File diff suppressed because it is too large
+ 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
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.1-beta.38
+* Version: 4.0.1-beta.39
 */
 
 if(typeof define==="function"&&define.amd)define(function(){return document});else if(typeof exports==="object")module.exports=document;

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

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

File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/inputmask.date.extensions.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/inputmask.extensions.min.js


File diff suppressed because it is too large
+ 2 - 2
dist/min/inputmask/inputmask.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/inputmask.numeric.extensions.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/jquery.inputmask.min.js


File diff suppressed because it is too large
+ 2 - 2
dist/min/jquery.inputmask.bundle.min.js


+ 3 - 1
js/inputmask.js

@@ -828,7 +828,7 @@
                 maxLength,
                 mouseEnter = false,
                 colorMask,
-                originalPlaceholder = "";
+                originalPlaceholder;
 
             //maskset helperfunctions
             function getMaskTemplate(baseOnInput, minimalPos, includeMode, noJit, clearOptionalTail) {
@@ -2265,6 +2265,7 @@
                     mouseEnter = false;
                     if (opts.clearMaskOnLostFocus && document.activeElement !== input) {
                         input.placeholder = originalPlaceholder;
+                        if(input.placeholder === "") input.removeAttribute("placeholder");
                     }
                 },
                 clickEvent: function (e, tabbed) {
@@ -2358,6 +2359,7 @@
                         input = this;
                     if (input.inputmask) {
                         input.placeholder = originalPlaceholder;
+                        if(input.placeholder === "") input.removeAttribute("placeholder");
                         var nptValue = input.inputmask._valueGet(),
                             buffer = getBuffer().slice();
 

+ 1 - 1
package.json

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