|
1 | 1 | /*!
|
2 |
| - * jQuery Validation Plugin v1.19.3 |
| 2 | + * jQuery Validation Plugin v1.19.5 |
3 | 3 | *
|
4 | 4 | * https://jqueryvalidation.org/
|
5 | 5 | *
|
6 |
| - * Copyright (c) 2021 Jörn Zaefferer |
| 6 | + * Copyright (c) 2022 Jörn Zaefferer |
7 | 7 | * Released under the MIT license
|
8 | 8 | */
|
9 | 9 | (function( factory ) {
|
|
378 | 378 | dateISO: "Please enter a valid date (ISO).",
|
379 | 379 | number: "Please enter a valid number.",
|
380 | 380 | digits: "Please enter only digits.",
|
381 |
| - creditcard: "Please enter a valid credit card number.", |
382 | 381 | equalTo: "Please enter the same value again.",
|
383 | 382 | maxlength: $.validator.format( "Please enter no more than {0} characters." ),
|
384 | 383 | minlength: $.validator.format( "Please enter at least {0} characters." ),
|
|
784 | 783 | normalizer = this.settings.normalizer;
|
785 | 784 | }
|
786 | 785 |
|
787 |
| - // If normalizer is defined, then call it to retrieve the changed value instead |
| 786 | + // If normalizer is defined, then call it to the changed value instead |
788 | 787 | // of using the real one.
|
789 | 788 | // Note that `this` in the normalizer is `element`.
|
790 | 789 | if ( normalizer ) {
|
|
875 | 874 | }
|
876 | 875 |
|
877 | 876 | var message = this.findDefined(
|
878 |
| - this.customMessage( element.name, rule.method ), |
879 |
| - this.customDataMessage( element, rule.method ), |
| 877 | + this.customMessage( element.name, rule.method ), |
| 878 | + this.customDataMessage( element, rule.method ), |
880 | 879 |
|
881 |
| - // 'title' is never undefined, so handle empty string as undefined |
882 |
| - !this.settings.ignoreTitle && element.title || undefined, |
883 |
| - $.validator.messages[ rule.method ], |
884 |
| - "<strong>Warning: No message defined for " + element.name + "</strong>" |
| 880 | + // 'title' is never undefined, so handle empty string as undefined |
| 881 | + !this.settings.ignoreTitle && element.title || undefined, |
| 882 | + $.validator.messages[ rule.method ], |
| 883 | + "<strong>Warning: No message defined for " + element.name + "</strong>" |
885 | 884 | ),
|
886 | 885 | theregex = /\$?\{(\d+)\}/g;
|
887 | 886 | if ( typeof message === "function" ) {
|
|
982 | 981 | if ( this.labelContainer.length ) {
|
983 | 982 | this.labelContainer.append( place );
|
984 | 983 | } else if ( this.settings.errorPlacement ) {
|
985 |
| - this.settings.errorPlacement( place, $( element ) ); |
| 984 | + this.settings.errorPlacement.call( this, place, $( element ) ); |
986 | 985 | } else {
|
987 | 986 | place.insertAfter( element );
|
988 | 987 | }
|
|
1052 | 1051 | // meta-characters that should be escaped in order to be used with JQuery
|
1053 | 1052 | // as a literal part of a name/id or any selector.
|
1054 | 1053 | escapeCssMeta: function( string ) {
|
1055 |
| - return (string || '').replace( /([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g, "\\$1" ); |
| 1054 | + if ( string === undefined ) { |
| 1055 | + return ""; |
| 1056 | + } |
| 1057 | + |
| 1058 | + return string.replace( /([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g, "\\$1" ); |
1056 | 1059 | },
|
1057 | 1060 |
|
1058 | 1061 | idOrName: function( element ) {
|
|
1128 | 1131 | }
|
1129 | 1132 | delete this.pending[ element.name ];
|
1130 | 1133 | $( element ).removeClass( this.settings.pendingClass );
|
1131 |
| - if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) { |
1132 |
| - $( this.currentForm ).submit(); |
| 1134 | + if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() && this.pendingRequest === 0 ) { |
| 1135 | + $( this.currentForm ).trigger( "submit" ); |
1133 | 1136 |
|
1134 | 1137 | // Remove the hidden input that was used as a replacement for the
|
1135 | 1138 | // missing submit button. The hidden input is added by `handle()`
|
|
1234 | 1237 |
|
1235 | 1238 | // Exception: the jquery validate 'range' method
|
1236 | 1239 | // does not test for the html5 'range' type
|
1237 |
| - rules[ method ] = true; |
| 1240 | + rules[ type === "date" ? "dateISO" : method ] = true; |
1238 | 1241 | }
|
1239 | 1242 | },
|
1240 | 1243 |
|
|
1283 | 1286 | $(element).metadata()[meta] :
|
1284 | 1287 | $(element).metadata();
|
1285 | 1288 | },
|
1286 |
| - |
| 1289 | + |
1287 | 1290 | dataRules: function( element ) {
|
1288 | 1291 | var rules = {},
|
1289 | 1292 | $element = $( element ),
|
|
1443 | 1446 | // https://gist.github.com/dperini/729294
|
1444 | 1447 | // see also https://mathiasbynens.be/demo/url-regex
|
1445 | 1448 | // modified to allow protocol-relative URLs
|
1446 |
| - return this.optional( element ) || /^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test( value ); |
| 1449 | + return this.optional( element ) || /^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})+(?::(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test( value ); |
1447 | 1450 | },
|
1448 | 1451 |
|
1449 | 1452 | // https://jqueryvalidation.org/date-method/
|
|
0 commit comments