Skip to content

Commit 43b130b

Browse files
committed
AC-8077::Upgrade JQuery Validation Plugin library to the latest version
1 parent b9101b1 commit 43b130b

File tree

1 file changed

+21
-30
lines changed

1 file changed

+21
-30
lines changed

lib/web/jquery/jquery.validate.js

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/*!
2-
* jQuery Validation Plugin v1.19.3
2+
* jQuery Validation Plugin v1.19.5
33
*
44
* https://jqueryvalidation.org/
55
*
6-
* Copyright (c) 2021 Jörn Zaefferer
6+
* Copyright (c) 2022 Jörn Zaefferer
77
* Released under the MIT license
88
*/
99
(function( factory ) {
1010
if ( typeof define === "function" && define.amd ) {
11-
define( ["jquery", "jquery/jquery.metadata"], factory );
11+
define( ["jquery"], factory );
1212
} else if (typeof module === "object" && module.exports) {
1313
module.exports = factory( require( "jquery" ) );
1414
} else {
@@ -192,7 +192,6 @@
192192
data = $.validator.normalizeRules(
193193
$.extend(
194194
{},
195-
$.validator.metadataRules(element),
196195
$.validator.classRules( element ),
197196
$.validator.attributeRules( element ),
198197
$.validator.dataRules( element ),
@@ -378,7 +377,6 @@
378377
dateISO: "Please enter a valid date (ISO).",
379378
number: "Please enter a valid number.",
380379
digits: "Please enter only digits.",
381-
creditcard: "Please enter a valid credit card number.",
382380
equalTo: "Please enter the same value again.",
383381
maxlength: $.validator.format( "Please enter no more than {0} characters." ),
384382
minlength: $.validator.format( "Please enter at least {0} characters." ),
@@ -784,7 +782,7 @@
784782
normalizer = this.settings.normalizer;
785783
}
786784

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
788786
// of using the real one.
789787
// Note that `this` in the normalizer is `element`.
790788
if ( normalizer ) {
@@ -875,13 +873,13 @@
875873
}
876874

877875
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 ),
880878

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>"
885883
),
886884
theregex = /\$?\{(\d+)\}/g;
887885
if ( typeof message === "function" ) {
@@ -982,7 +980,7 @@
982980
if ( this.labelContainer.length ) {
983981
this.labelContainer.append( place );
984982
} else if ( this.settings.errorPlacement ) {
985-
this.settings.errorPlacement( place, $( element ) );
983+
this.settings.errorPlacement.call( this, place, $( element ) );
986984
} else {
987985
place.insertAfter( element );
988986
}
@@ -1040,7 +1038,7 @@
10401038
// 'aria-describedby' should directly reference the error element
10411039
if ( describer ) {
10421040
selector = selector + ", #" + this.escapeCssMeta( describer )
1043-
.replace( /\s+/g, ", #" ) + ":visible";
1041+
.replace( /\s+/g, ", #" );
10441042
}
10451043

10461044
return this
@@ -1052,7 +1050,11 @@
10521050
// meta-characters that should be escaped in order to be used with JQuery
10531051
// as a literal part of a name/id or any selector.
10541052
escapeCssMeta: function( string ) {
1055-
return (string || '').replace( /([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g, "\\$1" );
1053+
if ( string === undefined ) {
1054+
return "";
1055+
}
1056+
1057+
return string.replace( /([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g, "\\$1" );
10561058
},
10571059

10581060
idOrName: function( element ) {
@@ -1128,8 +1130,8 @@
11281130
}
11291131
delete this.pending[ element.name ];
11301132
$( 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" );
11331135

11341136
// Remove the hidden input that was used as a replacement for the
11351137
// missing submit button. The hidden input is added by `handle()`
@@ -1234,7 +1236,7 @@
12341236

12351237
// Exception: the jquery validate 'range' method
12361238
// does not test for the html5 'range' type
1237-
rules[ method ] = true;
1239+
rules[ type === "date" ? "dateISO" : method ] = true;
12381240
}
12391241
},
12401242

@@ -1273,17 +1275,6 @@
12731275
return rules;
12741276
},
12751277

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-
12871278
dataRules: function( element ) {
12881279
var rules = {},
12891280
$element = $( element ),
@@ -1443,7 +1434,7 @@
14431434
// https://gist.github.com/dperini/729294
14441435
// see also https://mathiasbynens.be/demo/url-regex
14451436
// 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 );
14471438
},
14481439

14491440
// https://jqueryvalidation.org/date-method/

0 commit comments

Comments
 (0)