Robin Herbots 14 years ago
parent
commit
f3da18e705
1 changed files with 5 additions and 23 deletions
  1. 5 23
      jquery.inputmask.js

+ 5 - 23
jquery.inputmask.js

@@ -480,8 +480,7 @@ This plugin is based on the masked input plugin written by Josh Bush (digitalbus
                     'greedy': opts.greedy,
                     'repeat': opts.repeat,
                     'autoUnmask': opts.autoUnmask,
-                    'definitions': opts.definitions,
-                    'placeholder': opts.placeholder
+                    'definitions': opts.definitions
                 });
 
                 //init buffer
@@ -531,26 +530,9 @@ This plugin is based on the masked input plugin written by Josh Bush (digitalbus
                                 opts.onincomplete.call(input);
                             }
                             if (opts.clearIncomplete) {
-                                if (opts.clearMaskOnLostFocus){
-                                	var result = '',
-                                		required = 0,
-                                		value = _val.call(input),
-                                		data = input.data('inputmask');
-                                	for(var i = 0, length = value.length; i < length; i++){
-                                		if(!data.tests[i].optionality){
-                                			required++;
-                                			if(value[i] !== data.placeholder[i % data.placeholder.length]){
-                                				result += value[i];
-                                			}
-                                		}else{
-                                			break;
-                                		}
-                                	}
-                                	if(result.length !== required){
-                                		result = '';
-                                	}
-                                    _val.call(input,result);
-                                } else {
+                                if (opts.clearMaskOnLostFocus)
+                                    _val.call(input, '');
+                                else {
                                     buffer = _buffer.slice();
                                     writeBuffer(input, buffer);
                                 }
@@ -794,4 +776,4 @@ This plugin is based on the masked input plugin written by Josh Bush (digitalbus
             }
         };
     }
-})(jQuery);
+})(jQuery);