ソースを参照

Use inline regexp when possible

vsn4ik 10 年 前
コミット
cf90357fee
1 ファイル変更5 行追加5 行削除
  1. 5 5
      js/inputmask.js

+ 5 - 5
js/inputmask.js

@@ -728,11 +728,11 @@
 		}
 
 		var ua = navigator.userAgent,
-			iemobile = ua.match(new RegExp("iemobile", "i")) !== null,
-			iphone = (ua.match(new RegExp("iphone", "i")) !== null) && !iemobile,
-			android = (ua.match(new RegExp("android.*safari.*", "i")) !== null) && !iemobile,
-			androidchrome = ua.match(new RegExp("android.*chrome.*", "i")) !== null,
-			androidfirefox = ua.match(new RegExp("android.*firefox.*", "i")) !== null,
+			iemobile = /iemobile/i.test(ua),
+			iphone = /iphone/i.test(ua) && !iemobile,
+			android = /android.*safari.*/i.test(ua) && !iemobile,
+			androidchrome = /android.*chrome.*/i.test(ua),
+			androidfirefox = /android.*firefox.*/i.test(ua),
 			kindle = /Kindle/i.test(ua) || /Silk/i.test(ua) || /KFTT/i.test(ua) || /KFOT/i.test(ua) || /KFJWA/i.test(ua) || /KFJWI/i.test(ua) || /KFSOWI/i.test(ua) || /KFTHWA/i.test(ua) || /KFTHWI/i.test(ua) || /KFAPWA/i.test(ua) || /KFAPWI/i.test(ua),
 			PasteEventType = isInputEventSupported("paste") ? "paste" : isInputEventSupported("input") ? "input" : "propertychange";