Skip to content

Commit 17bb069

Browse files
authored
Merge branch '2.4-develop' into spartans_pr_29052025
2 parents 3abfc76 + a43ecb4 commit 17bb069

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

‎lib/web/jquery/jquery.validate.js

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/*!
2-
* jQuery Validation Plugin v1.20.0
2+
* jQuery Validation Plugin v1.21.0
33
*
44
* https://jqueryvalidation.org/
55
*
6-
* Copyright (c) 2023 Jörn Zaefferer
6+
* Copyright (c) 2024 Jörn Zaefferer
77
* Released under the MIT license
88
*/
99
(function( factory ) {
@@ -294,6 +294,7 @@
294294
onsubmit: true,
295295
ignore: ":hidden",
296296
ignoreTitle: false,
297+
customElements: [],
297298
onfocusin: function( element ) {
298299
this.lastActive = element;
299300

@@ -441,17 +442,17 @@
441442
settings[ eventType ].call( validator, this, event );
442443
}
443444
}
444-
445+
var focusListeners = [ ":text", "[type='password']", "[type='file']", "select", "textarea", "[type='number']", "[type='search']",
446+
"[type='tel']", "[type='url']", "[type='email']", "[type='datetime']", "[type='date']", "[type='month']",
447+
"[type='week']", "[type='time']", "[type='datetime-local']", "[type='range']", "[type='color']",
448+
"[type='radio']", "[type='checkbox']", "[contenteditable]", "[type='button']" ];
449+
var clickListeners = [ "select", "option", "[type='radio']", "[type='checkbox']" ];
445450
$( this.currentForm )
446-
.on( "focusin.validate focusout.validate keyup.validate",
447-
":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], " +
448-
"[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], " +
449-
"[type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], " +
450-
"[type='radio'], [type='checkbox'], [contenteditable], [type='button']", delegate )
451+
.on( "focusin.validate focusout.validate keyup.validate", focusListeners.concat( this.settings.customElements ).join( ", " ), delegate )
451452

452453
// Support: Chrome, oldIE
453454
// "select" is provided as event.target when clicking a option
454-
.on( "click.validate", "select, option, [type='radio'], [type='checkbox']", delegate );
455+
.on( "click.validate", clickListeners.concat( this.settings.customElements ).join( ", " ), delegate );
455456

456457
if ( this.settings.invalidHandler ) {
457458
$( this.currentForm ).on( "invalid-form.validate", this.settings.invalidHandler );
@@ -648,11 +649,12 @@
648649

649650
elements: function() {
650651
var validator = this,
651-
rulesCache = {};
652+
rulesCache = {},
653+
selectors = [ "input", "select", "textarea", "[contenteditable]" ];
652654

653655
// Select all valid inputs inside the form (no submit or reset buttons)
654656
return $( this.currentForm )
655-
.find( "input, select, textarea, [contenteditable]" )
657+
.find( selectors.concat( this.settings.customElements ).join( ", " ) )
656658
.not( ":submit, :reset, :image, :disabled" )
657659
.not( this.settings.ignore )
658660
.filter( function() {
@@ -1310,7 +1312,6 @@
13101312

13111313
return rules;
13121314
},
1313-
13141315
metadataRules: function (element) {
13151316
if (!$.metadata) {
13161317
return {};
@@ -1321,7 +1322,6 @@
13211322
$(element).metadata()[meta] :
13221323
$(element).metadata();
13231324
},
1324-
13251325
dataRules: function( element ) {
13261326
var rules = {},
13271327
$element = $( element ),
@@ -1513,7 +1513,7 @@
15131513

15141514
// https://jqueryvalidation.org/number-method/
15151515
number: function( value, element ) {
1516-
return this.optional( element ) || /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test( value );
1516+
return this.optional( element ) || /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:-?\.\d+)?$/.test( value );
15171517
},
15181518

15191519
// https://jqueryvalidation.org/digits-method/
@@ -1624,11 +1624,12 @@
16241624

16251625
param = typeof param === "string" && { url: param } || param;
16261626
optionDataString = $.param( $.extend( { data: value }, param.data ) );
1627-
if ( previous.old === optionDataString ) {
1627+
if ( previous.valid !== null && previous.old === optionDataString ) {
16281628
return previous.valid;
16291629
}
16301630

16311631
previous.old = optionDataString;
1632+
previous.valid = null;
16321633
validator = this;
16331634
this.startRequest( element );
16341635
data = {};

0 commit comments

Comments
 (0)