Skip to content

Commit 5a26b23

Browse files
committed
chore(dependencies): bumps to payment@1.0.2
1 parent 3e99b16 commit 5a26b23

3 files changed

Lines changed: 29 additions & 19 deletions

File tree

lib/js/card.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -987,14 +987,19 @@ luhnCheck = function(num) {
987987
};
988988

989989
hasTextSelected = function(target) {
990-
var ref;
991-
if ((target.selectionStart != null) && target.selectionStart !== target.selectionEnd) {
992-
return true;
993-
}
994-
if ((typeof document !== "undefined" && document !== null ? (ref = document.selection) != null ? ref.createRange : void 0 : void 0) != null) {
995-
if (document.selection.createRange().text) {
990+
var e, error, ref;
991+
try {
992+
if ((target.selectionStart != null) && target.selectionStart !== target.selectionEnd) {
996993
return true;
997994
}
995+
if ((typeof document !== "undefined" && document !== null ? (ref = document.selection) != null ? ref.createRange : void 0 : void 0) != null) {
996+
if (document.selection.createRange().text) {
997+
return true;
998+
}
999+
}
1000+
} catch (error) {
1001+
e = error;
1002+
false;
9981003
}
9991004
return false;
10001005
};
@@ -1028,7 +1033,7 @@ formatCardNumber = function(e) {
10281033
if (length >= upperLength) {
10291034
return;
10301035
}
1031-
if ((target.selectionStart != null) && target.selectionStart !== value.length) {
1036+
if (hasTextSelected(target)) {
10321037
return;
10331038
}
10341039
if (card && card.type === 'amex') {
@@ -1055,7 +1060,7 @@ formatBackCardNumber = function(e) {
10551060
if (e.which !== 8) {
10561061
return;
10571062
}
1058-
if ((target.selectionStart != null) && target.selectionStart !== value.length) {
1063+
if (hasTextSelected(target)) {
10591064
return;
10601065
}
10611066
if (/\d\s$/.test(value)) {
@@ -1137,7 +1142,7 @@ formatBackExpiry = function(e) {
11371142
if (e.which !== 8) {
11381143
return;
11391144
}
1140-
if ((target.selectionStart != null) && target.selectionStart !== value.length) {
1145+
if (hasTextSelected(target)) {
11411146
return;
11421147
}
11431148
if (/\d(\s|\/)+$/.test(value)) {

lib/js/jquery.card.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -987,14 +987,19 @@ luhnCheck = function(num) {
987987
};
988988

989989
hasTextSelected = function(target) {
990-
var ref;
991-
if ((target.selectionStart != null) && target.selectionStart !== target.selectionEnd) {
992-
return true;
993-
}
994-
if ((typeof document !== "undefined" && document !== null ? (ref = document.selection) != null ? ref.createRange : void 0 : void 0) != null) {
995-
if (document.selection.createRange().text) {
990+
var e, error, ref;
991+
try {
992+
if ((target.selectionStart != null) && target.selectionStart !== target.selectionEnd) {
996993
return true;
997994
}
995+
if ((typeof document !== "undefined" && document !== null ? (ref = document.selection) != null ? ref.createRange : void 0 : void 0) != null) {
996+
if (document.selection.createRange().text) {
997+
return true;
998+
}
999+
}
1000+
} catch (error) {
1001+
e = error;
1002+
false;
9981003
}
9991004
return false;
10001005
};
@@ -1028,7 +1033,7 @@ formatCardNumber = function(e) {
10281033
if (length >= upperLength) {
10291034
return;
10301035
}
1031-
if ((target.selectionStart != null) && target.selectionStart !== value.length) {
1036+
if (hasTextSelected(target)) {
10321037
return;
10331038
}
10341039
if (card && card.type === 'amex') {
@@ -1055,7 +1060,7 @@ formatBackCardNumber = function(e) {
10551060
if (e.which !== 8) {
10561061
return;
10571062
}
1058-
if ((target.selectionStart != null) && target.selectionStart !== value.length) {
1063+
if (hasTextSelected(target)) {
10591064
return;
10601065
}
10611066
if (/\d\s$/.test(value)) {
@@ -1137,7 +1142,7 @@ formatBackExpiry = function(e) {
11371142
if (e.which !== 8) {
11381143
return;
11391144
}
1140-
if ((target.selectionStart != null) && target.selectionStart !== value.length) {
1145+
if (hasTextSelected(target)) {
11411146
return;
11421147
}
11431148
if (/\d(\s|\/)+$/.test(value)) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@
6262
"cssify": "~0.6.0",
6363
"node.extend": "~1.1.3",
6464
"qj": "~1.0.0",
65-
"payment": "~1.0.1"
65+
"payment": "~1.0.2"
6666
}
6767
}

0 commit comments

Comments
 (0)