|
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 ) {
|
10 | 10 | if ( typeof define === "function" && define.amd ) {
|
11 |
| - define( ["jquery", "jquery/jquery.metadata"], factory ); |
| 11 | + define( ["jquery"], factory ); |
12 | 12 | } else if (typeof module === "object" && module.exports) {
|
13 | 13 | module.exports = factory( require( "jquery" ) );
|
14 | 14 | } else {
|
|
192 | 192 | data = $.validator.normalizeRules(
|
193 | 193 | $.extend(
|
194 | 194 | {},
|
195 |
| - $.validator.metadataRules(element), |
196 | 195 | $.validator.classRules( element ),
|
197 | 196 | $.validator.attributeRules( element ),
|
198 | 197 | $.validator.dataRules( element ),
|
|
378 | 377 | dateISO: "Please enter a valid date (ISO).",
|
379 | 378 | number: "Please enter a valid number.",
|
380 | 379 | digits: "Please enter only digits.",
|
381 |
| - creditcard: "Please enter a valid credit card number.", |
382 | 380 | equalTo: "Please enter the same value again.",
|
383 | 381 | maxlength: $.validator.format( "Please enter no more than {0} characters." ),
|
384 | 382 | minlength: $.validator.format( "Please enter at least {0} characters." ),
|
|
784 | 782 | normalizer = this.settings.normalizer;
|
785 | 783 | }
|
786 | 784 |
|
787 |
| - // If normalizer is defined, then call it to retrieve the changed value instead |
| 785 | + // If normalizer is defined, then call it to retreive the changed value instead |
788 | 786 | // of using the real one.
|
789 | 787 | // Note that `this` in the normalizer is `element`.
|
790 | 788 | if ( normalizer ) {
|
|
875 | 873 | }
|
876 | 874 |
|
877 | 875 | var message = this.findDefined(
|
878 |
| - this.customMessage( element.name, rule.method ), |
879 |
| - this.customDataMessage( element, rule.method ), |
| 876 | + this.customMessage( element.name, rule.method ), |
| 877 | + this.customDataMessage( element, rule.method ), |
880 | 878 |
|
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>" |
| 879 | + // 'title' is never undefined, so handle empty string as undefined |
| 880 | + !this.settings.ignoreTitle && element.title || undefined, |
| 881 | + $.validator.messages[ rule.method ], |
| 882 | + "<strong>Warning: No message defined for " + element.name + "</strong>" |
885 | 883 | ),
|
886 | 884 | theregex = /\$?\{(\d+)\}/g;
|
887 | 885 | if ( typeof message === "function" ) {
|
|
982 | 980 | if ( this.labelContainer.length ) {
|
983 | 981 | this.labelContainer.append( place );
|
984 | 982 | } else if ( this.settings.errorPlacement ) {
|
985 |
| - this.settings.errorPlacement( place, $( element ) ); |
| 983 | + this.settings.errorPlacement.call( this, place, $( element ) ); |
986 | 984 | } else {
|
987 | 985 | place.insertAfter( element );
|
988 | 986 | }
|
|
1040 | 1038 | // 'aria-describedby' should directly reference the error element
|
1041 | 1039 | if ( describer ) {
|
1042 | 1040 | selector = selector + ", #" + this.escapeCssMeta( describer )
|
1043 |
| - .replace( /\s+/g, ", #" ) + ":visible"; |
| 1041 | + .replace( /\s+/g, ", #" ); |
1044 | 1042 | }
|
1045 | 1043 |
|
1046 | 1044 | return this
|
|
1052 | 1050 | // meta-characters that should be escaped in order to be used with JQuery
|
1053 | 1051 | // as a literal part of a name/id or any selector.
|
1054 | 1052 | escapeCssMeta: function( string ) {
|
1055 |
| - return (string || '').replace( /([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g, "\\$1" ); |
| 1053 | + if ( string === undefined ) { |
| 1054 | + return ""; |
| 1055 | + } |
| 1056 | + |
| 1057 | + return string.replace( /([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g, "\\$1" ); |
1056 | 1058 | },
|
1057 | 1059 |
|
1058 | 1060 | idOrName: function( element ) {
|
|
1128 | 1130 | }
|
1129 | 1131 | delete this.pending[ element.name ];
|
1130 | 1132 | $( element ).removeClass( this.settings.pendingClass );
|
1131 |
| - if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) { |
1132 |
| - $( this.currentForm ).submit(); |
| 1133 | + if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() && this.pendingRequest === 0 ) { |
| 1134 | + $( this.currentForm ).trigger( "submit" ); |
1133 | 1135 |
|
1134 | 1136 | // Remove the hidden input that was used as a replacement for the
|
1135 | 1137 | // missing submit button. The hidden input is added by `handle()`
|
|
1234 | 1236 |
|
1235 | 1237 | // Exception: the jquery validate 'range' method
|
1236 | 1238 | // does not test for the html5 'range' type
|
1237 |
| - rules[ method ] = true; |
| 1239 | + rules[ type === "date" ? "dateISO" : method ] = true; |
1238 | 1240 | }
|
1239 | 1241 | },
|
1240 | 1242 |
|
|
1273 | 1275 | return rules;
|
1274 | 1276 | },
|
1275 | 1277 |
|
1276 |
| - metadataRules: function (element) { |
1277 |
| - if (!$.metadata) { |
1278 |
| - return {}; |
1279 |
| - } |
1280 |
| - |
1281 |
| - var meta = $.data(element.form, 'validator').settings.meta; |
1282 |
| - return meta ? |
1283 |
| - $(element).metadata()[meta] : |
1284 |
| - $(element).metadata(); |
1285 |
| - }, |
1286 |
| - |
1287 | 1278 | dataRules: function( element ) {
|
1288 | 1279 | var rules = {},
|
1289 | 1280 | $element = $( element ),
|
|
1443 | 1434 | // https://gist.github.com/dperini/729294
|
1444 | 1435 | // see also https://mathiasbynens.be/demo/url-regex
|
1445 | 1436 | // 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 ); |
| 1437 | + 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 | 1438 | },
|
1448 | 1439 |
|
1449 | 1440 | // https://jqueryvalidation.org/date-method/
|
|
0 commit comments