ソースを参照

fix placeholder #657

Robin Herbots 11 年 前
コミット
867abf69c0

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

@@ -515,7 +515,9 @@
             input._valueSet(buffer.join("")), void 0 != caretPos && caret(input, caretPos);
             input._valueSet(buffer.join("")), void 0 != caretPos && caret(input, caretPos);
         }
         }
         function getPlaceholder(pos, test) {
         function getPlaceholder(pos, test) {
-            return test = test || getTest(pos), ($.isFunction(test.placeholder) ? test.placeholder.call(this, opts) : test.placeholder) || (null == test.fn ? test.def : opts.placeholder.charAt(pos % opts.placeholder.length));
+            test = test || getTest(pos);
+            var placeholder = $.isFunction(test.placeholder) ? test.placeholder.call(this, opts) : test.placeholder;
+            return void 0 != placeholder ? placeholder : null == test.fn ? test.def : opts.placeholder.charAt(pos % opts.placeholder.length);
         }
         }
         function checkVal(input, writeOut, strict, nptvl, intelliCheck) {
         function checkVal(input, writeOut, strict, nptvl, intelliCheck) {
             var inputValue = void 0 != nptvl ? nptvl.slice() : truncateInput(input._valueGet()).split("");
             var inputValue = void 0 != nptvl ? nptvl.slice() : truncateInput(input._valueGet()).split("");

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

@@ -513,7 +513,9 @@
             input._valueSet(buffer.join("")), void 0 != caretPos && caret(input, caretPos);
             input._valueSet(buffer.join("")), void 0 != caretPos && caret(input, caretPos);
         }
         }
         function getPlaceholder(pos, test) {
         function getPlaceholder(pos, test) {
-            return test = test || getTest(pos), ($.isFunction(test.placeholder) ? test.placeholder.call(this, opts) : test.placeholder) || (null == test.fn ? test.def : opts.placeholder.charAt(pos % opts.placeholder.length));
+            test = test || getTest(pos);
+            var placeholder = $.isFunction(test.placeholder) ? test.placeholder.call(this, opts) : test.placeholder;
+            return void 0 != placeholder ? placeholder : null == test.fn ? test.def : opts.placeholder.charAt(pos % opts.placeholder.length);
         }
         }
         function checkVal(input, writeOut, strict, nptvl, intelliCheck) {
         function checkVal(input, writeOut, strict, nptvl, intelliCheck) {
             var inputValue = void 0 != nptvl ? nptvl.slice() : truncateInput(input._valueGet()).split("");
             var inputValue = void 0 != nptvl ? nptvl.slice() : truncateInput(input._valueGet()).split("");

+ 2 - 1
js/jquery.inputmask.js

@@ -910,7 +910,8 @@
             }
             }
             function getPlaceholder(pos, test) {
             function getPlaceholder(pos, test) {
                 test = test || getTest(pos);
                 test = test || getTest(pos);
-                return ($.isFunction(test["placeholder"]) ? test["placeholder"].call(this, opts) : test["placeholder"]) || (test["fn"] == null ? test["def"] : opts.placeholder.charAt(pos % opts.placeholder.length));
+                var placeholder = $.isFunction(test["placeholder"]) ? test["placeholder"].call(this, opts) : test["placeholder"];
+                return placeholder != undefined ? placeholder : (test["fn"] == null ? test["def"] : opts.placeholder.charAt(pos % opts.placeholder.length));
             }
             }
             function checkVal(input, writeOut, strict, nptvl, intelliCheck) {
             function checkVal(input, writeOut, strict, nptvl, intelliCheck) {
                 var inputValue = nptvl != undefined ? nptvl.slice() : truncateInput(input._valueGet()).split('');
                 var inputValue = nptvl != undefined ? nptvl.slice() : truncateInput(input._valueGet()).split('');