浏览代码

update readme

Robin Herbots 10 年之前
父节点
当前提交
28d112b1d1
共有 2 个文件被更改,包括 36 次插入37 次删除
  1. 17 13
      README.md
  2. 19 24
      js/inputmask.js

文件差异内容过多而无法显示
+ 17 - 13
README.md


+ 19 - 24
js/inputmask.js

@@ -2237,14 +2237,13 @@
 			$el = $(el);
 			$el = $(el);
 
 
 			//show tooltip
 			//show tooltip
-			if (opts.showTooltip) {
-				$el.prop("title", getMaskSet()["mask"]);
-			}
+			if (opts.showTooltip)
+				$el.prop("title", getMaskSet().mask);
 
 
-			if (el.dir == "rtl" || opts.rightAlign)
+			if (el.dir === "rtl" || opts.rightAlign)
 				$el.css("text-align", "right");
 				$el.css("text-align", "right");
 
 
-			if (el.dir == "rtl" || opts.numericInput) {
+			if (el.dir === "rtl" || opts.numericInput) {
 				el.dir = "ltr";
 				el.dir = "ltr";
 				$el.removeAttr("dir");
 				$el.removeAttr("dir");
 				el.inputmask.isRTL = true;
 				el.inputmask.isRTL = true;
@@ -2256,30 +2255,26 @@
 
 
 			if (($el.is(":input") && isInputTypeSupported($el.attr("type"))) || el.isContentEditable) {
 			if (($el.is(":input") && isInputTypeSupported($el.attr("type"))) || el.isContentEditable) {
 				//bind events
 				//bind events
-				$el.closest('form').bind("submit", function(e) { //trigger change on submit if any
-					if (undoValue != getBuffer().join('')) {
+				$el.closest("form").bind("submit", function() { //trigger change on submit if any
+					if (undoValue !== getBuffer().join(""))
 						$el.change();
 						$el.change();
-					}
-					if (opts.clearMaskOnLostFocus && $el[0].inputmask._valueGet && $el[0].inputmask._valueGet() == getBufferTemplate().join('')) {
-						$el[0].inputmask._valueSet(''); //clear masktemplete on submit and still has focus
-					}
-					if (opts.removeMaskOnSubmit) {
+					if (opts.clearMaskOnLostFocus && $el[0].inputmask._valueGet && $el[0].inputmask._valueGet() === getBufferTemplate().join(""))
+						$el[0].inputmask._valueSet(""); //clear masktemplete on submit and still has focus
+
+					if (opts.removeMaskOnSubmit)
 						$el.inputmask("remove");
 						$el.inputmask("remove");
-					}
-				}).bind('reset', function() {
+				}).bind("reset", function() {
 					setTimeout(function() {
 					setTimeout(function() {
-						$el.triggerHandler('setvalue.inputmask');
+						$el.triggerHandler("setvalue.inputmask");
 					}, 0);
 					}, 0);
 				});
 				});
 				$el.bind("mouseenter.inputmask", function() {
 				$el.bind("mouseenter.inputmask", function() {
 					var $input = $(this),
 					var $input = $(this),
 						input = this;
 						input = this;
 					mouseEnter = true;
 					mouseEnter = true;
-					if (!$input.is(":focus") && opts.showMaskOnHover) {
-						if (input.inputmask._valueGet() != getBuffer().join('')) {
+					if (!$input.is(":focus") && opts.showMaskOnHover)
+						if (input.inputmask._valueGet() !== getBuffer().join(""))
 							writeBuffer(input, getBuffer());
 							writeBuffer(input, getBuffer());
-						}
-					}
 				}).bind("blur.inputmask", function(e) {
 				}).bind("blur.inputmask", function(e) {
 					var $input = $(this),
 					var $input = $(this),
 						input = this;
 						input = this;
@@ -2287,15 +2282,15 @@
 						var nptValue = input.inputmask._valueGet(),
 						var nptValue = input.inputmask._valueGet(),
 							buffer = getBuffer().slice();
 							buffer = getBuffer().slice();
 						firstClick = true;
 						firstClick = true;
-						if (undoValue != buffer.join('')) {
+						if (undoValue !== buffer.join("")) {
 							setTimeout(function() { //change event should be triggered after the other buffer manipulations on blur
 							setTimeout(function() { //change event should be triggered after the other buffer manipulations on blur
 								$input.change();
 								$input.change();
-								undoValue = buffer.join('');
+								undoValue = buffer.join("");
 							}, 0);
 							}, 0);
 						}
 						}
-						if (nptValue != '') {
+						if (nptValue !== "") {
 							if (opts.clearMaskOnLostFocus) {
 							if (opts.clearMaskOnLostFocus) {
-								if (nptValue == getBufferTemplate().join(''))
+								if (nptValue == getBufferTemplate().join(""))
 									buffer = [];
 									buffer = [];
 								else { //clearout optional tail of the mask
 								else { //clearout optional tail of the mask
 									clearOptionalTail(buffer);
 									clearOptionalTail(buffer);
@@ -2409,7 +2404,7 @@
 
 
 				if (PasteEventType === "paste") {
 				if (PasteEventType === "paste") {
 					$el.bind("input.inputmask", inputFallBackEvent);
 					$el.bind("input.inputmask", inputFallBackEvent);
-				}			
+				}
 				//if (android || androidfirefox || androidchrome || kindle) {
 				//if (android || androidfirefox || androidchrome || kindle) {
 				//		$el.unbind("input.inputmask");
 				//		$el.unbind("input.inputmask");
 				//		$el.bind("input.inputmask", mobileInputEvent);
 				//		$el.bind("input.inputmask", mobileInputEvent);