From 3a4cd948d18cd157f9b743b80735335a5cf852e7 Mon Sep 17 00:00:00 2001 From: Kieran Brahney Date: Thu, 19 May 2022 16:41:29 +0100 Subject: [PATCH 01/38] Build: Updating the master version to 1.19.5-pre. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e33dea196..0bc214db1 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "jquery-validation", "title": "jQuery Validation Plugin", "description": "Client-side form validation made easy", - "version": "1.19.4-pre", + "version": "1.19.5-pre", "homepage": "https://jqueryvalidation.org/", "license": "MIT", "author": { From b68e282cc4e4e1bc34805f9f2383562e3c4dcc4b Mon Sep 17 00:00:00 2001 From: Kieran Brahney Date: Thu, 19 May 2022 16:53:14 +0100 Subject: [PATCH 02/38] Chore: update changelog --- changelog.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/changelog.md b/changelog.md index 9f23f9b1b..284e5a15c 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,22 @@ +1.19.4 / 2022-05-19 +=================== + +## Build + * Add License.md to zip tarball (#2386) + +## Chore + * Updated build status badges (#2424) + * Enabled stable bot (#2425) + +## Core + * Fixed validation for input type="date" (#2360) + * Wait for pendingRequests to finish before submitting form (#2369) + * Fixed bug for Html Editors (#2154) (#2422) + * Fixed ReDoS vulnerability in URL2 validation (#2428) + +## Test + * Switch from Travis to GitHub workflows (#2423) + 1.19.3 / 2021-01-09 =================== From 1b79877af768ceaa0901dbcbda366bb27124989b Mon Sep 17 00:00:00 2001 From: EricDunsworth <1907279+EricDunsworth@users.noreply.github.com> Date: Mon, 23 May 2022 06:50:05 -0400 Subject: [PATCH 03/38] Localization: Add periods to messages (#2266) All core messages end with periods. But additional/localization messages were previously using them inconsistently. This commit adds message periods to: * Additional files that lacked them * Localization files that were already mostly using them * Italian (it) localization file Didn't add any periods to non-Latin localization files that previously weren't using them at all (AR, bn_BD, he, hy_AM, sd, th, ur, zh and zh_TW). --- src/additional/alphanumeric.js | 2 +- src/additional/bankaccountNL.js | 2 +- src/additional/bankorgiroaccountNL.js | 2 +- src/additional/bic.js | 2 +- src/additional/cnhBR.js | 2 +- src/additional/cnpjBR.js | 2 +- src/additional/cpfBR.js | 2 +- src/additional/currency.js | 2 +- src/additional/giroaccountNL.js | 2 +- src/additional/iban.js | 2 +- src/additional/integer.js | 2 +- src/additional/lettersonly.js | 2 +- src/additional/letterswithbasicpunc.js | 2 +- src/additional/mobileNL.js | 2 +- src/additional/mobileRU.js | 2 +- src/additional/mobileUK.js | 2 +- src/additional/nisBR.js | 2 +- src/additional/nowhitespace.js | 2 +- src/additional/phonePL.js | 2 +- src/additional/phoneUK.js | 2 +- src/additional/phoneUS.js | 2 +- src/additional/phonesUK.js | 2 +- src/additional/postalCodeCA.js | 2 +- src/additional/postalcodeIT.js | 2 +- src/additional/postalcodeNL.js | 2 +- src/additional/postcodeUK.js | 2 +- src/additional/statesUS.js | 2 +- src/additional/strippedminlength.js | 2 +- src/additional/time.js | 2 +- src/additional/time12h.js | 2 +- src/additional/zipcodeUS.js | 2 +- src/additional/ziprange.js | 2 +- src/localization/messages_az.js | 2 +- src/localization/messages_ca.js | 2 +- src/localization/messages_da.js | 12 ++++---- src/localization/messages_fa.js | 2 +- src/localization/messages_ge.js | 2 +- src/localization/messages_it.js | 42 +++++++++++++------------- src/localization/messages_mk.js | 8 ++--- src/localization/messages_pl.js | 2 +- src/localization/messages_pt_BR.js | 4 +-- src/localization/messages_ro.js | 2 +- src/localization/messages_sr_lat.js | 2 +- src/localization/messages_tj.js | 2 +- src/localization/messages_tr.js | 2 +- 45 files changed, 74 insertions(+), 74 deletions(-) diff --git a/src/additional/alphanumeric.js b/src/additional/alphanumeric.js index 79e54e0a1..50790d61a 100644 --- a/src/additional/alphanumeric.js +++ b/src/additional/alphanumeric.js @@ -1,3 +1,3 @@ $.validator.addMethod( "alphanumeric", function( value, element ) { return this.optional( element ) || /^\w+$/i.test( value ); -}, "Letters, numbers, and underscores only please" ); +}, "Letters, numbers, and underscores only please." ); diff --git a/src/additional/bankaccountNL.js b/src/additional/bankaccountNL.js index 1671f4980..d9a0d234f 100644 --- a/src/additional/bankaccountNL.js +++ b/src/additional/bankaccountNL.js @@ -23,4 +23,4 @@ $.validator.addMethod( "bankaccountNL", function( value, element ) { sum = sum + factor * digit; } return sum % 11 === 0; -}, "Please specify a valid bank account number" ); +}, "Please specify a valid bank account number." ); diff --git a/src/additional/bankorgiroaccountNL.js b/src/additional/bankorgiroaccountNL.js index b224f45b1..17eec5335 100644 --- a/src/additional/bankorgiroaccountNL.js +++ b/src/additional/bankorgiroaccountNL.js @@ -2,4 +2,4 @@ $.validator.addMethod( "bankorgiroaccountNL", function( value, element ) { return this.optional( element ) || ( $.validator.methods.bankaccountNL.call( this, value, element ) ) || ( $.validator.methods.giroaccountNL.call( this, value, element ) ); -}, "Please specify a valid bank or giro account number" ); +}, "Please specify a valid bank or giro account number." ); diff --git a/src/additional/bic.js b/src/additional/bic.js index 49f137fa5..4f65c59b5 100644 --- a/src/additional/bic.js +++ b/src/additional/bic.js @@ -15,4 +15,4 @@ */ $.validator.addMethod( "bic", function( value, element ) { return this.optional( element ) || /^([A-Z]{6}[A-Z2-9][A-NP-Z1-9])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$/.test( value.toUpperCase() ); -}, "Please specify a valid BIC code" ); +}, "Please specify a valid BIC code." ); diff --git a/src/additional/cnhBR.js b/src/additional/cnhBR.js index 67ea7965a..92e45e779 100644 --- a/src/additional/cnhBR.js +++ b/src/additional/cnhBR.js @@ -46,4 +46,4 @@ $.validator.addMethod( "cnhBR", function( value ) { return ( String( firstCN ).concat( secondCN ) === value.substr( -2 ) ); -}, "Please specify a valid CNH number" ); +}, "Please specify a valid CNH number." ); diff --git a/src/additional/cnpjBR.js b/src/additional/cnpjBR.js index 43e3bfcf6..cbe89adb3 100644 --- a/src/additional/cnpjBR.js +++ b/src/additional/cnpjBR.js @@ -71,4 +71,4 @@ $.validator.addMethod( "cnpjBR", function( value, element ) { return true; -}, "Please specify a CNPJ value number" ); +}, "Please specify a CNPJ value number." ); diff --git a/src/additional/cpfBR.js b/src/additional/cpfBR.js index a2b1611b3..78e0da2d8 100644 --- a/src/additional/cpfBR.js +++ b/src/additional/cpfBR.js @@ -62,4 +62,4 @@ $.validator.addMethod( "cpfBR", function( value, element ) { } return false; -}, "Please specify a valid CPF number" ); +}, "Please specify a valid CPF number." ); diff --git a/src/additional/currency.js b/src/additional/currency.js index 76197df5a..d593790e3 100644 --- a/src/additional/currency.js +++ b/src/additional/currency.js @@ -38,4 +38,4 @@ $.validator.addMethod( "currency", function( value, element, param ) { regex = new RegExp( regex ); return this.optional( element ) || regex.test( value ); -}, "Please specify a valid currency" ); +}, "Please specify a valid currency." ); diff --git a/src/additional/giroaccountNL.js b/src/additional/giroaccountNL.js index 0cfd04cd6..26ea14fba 100644 --- a/src/additional/giroaccountNL.js +++ b/src/additional/giroaccountNL.js @@ -3,4 +3,4 @@ */ $.validator.addMethod( "giroaccountNL", function( value, element ) { return this.optional( element ) || /^[0-9]{1,7}$/.test( value ); -}, "Please specify a valid giro account number" ); +}, "Please specify a valid giro account number." ); diff --git a/src/additional/iban.js b/src/additional/iban.js index 0a2bfbeec..94c610d8f 100644 --- a/src/additional/iban.js +++ b/src/additional/iban.js @@ -133,4 +133,4 @@ $.validator.addMethod( "iban", function( value, element ) { cRest = cOperator % 97; } return cRest === 1; -}, "Please specify a valid IBAN" ); +}, "Please specify a valid IBAN." ); diff --git a/src/additional/integer.js b/src/additional/integer.js index 779431d72..ad0dab2fa 100644 --- a/src/additional/integer.js +++ b/src/additional/integer.js @@ -1,3 +1,3 @@ $.validator.addMethod( "integer", function( value, element ) { return this.optional( element ) || /^-?\d+$/.test( value ); -}, "A positive or negative non-decimal number please" ); +}, "A positive or negative non-decimal number please." ); diff --git a/src/additional/lettersonly.js b/src/additional/lettersonly.js index 893b487a8..82857661b 100644 --- a/src/additional/lettersonly.js +++ b/src/additional/lettersonly.js @@ -1,3 +1,3 @@ $.validator.addMethod( "lettersonly", function( value, element ) { return this.optional( element ) || /^[a-z]+$/i.test( value ); -}, "Letters only please" ); +}, "Letters only please." ); diff --git a/src/additional/letterswithbasicpunc.js b/src/additional/letterswithbasicpunc.js index 9bbb4d9d9..0e90c0555 100644 --- a/src/additional/letterswithbasicpunc.js +++ b/src/additional/letterswithbasicpunc.js @@ -1,3 +1,3 @@ $.validator.addMethod( "letterswithbasicpunc", function( value, element ) { return this.optional( element ) || /^[a-z\-.,()'"\s]+$/i.test( value ); -}, "Letters or punctuation only please" ); +}, "Letters or punctuation only please." ); diff --git a/src/additional/mobileNL.js b/src/additional/mobileNL.js index 3f1f45a75..12092e2ea 100644 --- a/src/additional/mobileNL.js +++ b/src/additional/mobileNL.js @@ -1,3 +1,3 @@ $.validator.addMethod( "mobileNL", function( value, element ) { return this.optional( element ) || /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)6((\s|\s?\-\s?)?[0-9]){8}$/.test( value ); -}, "Please specify a valid mobile number" ); +}, "Please specify a valid mobile number." ); diff --git a/src/additional/mobileRU.js b/src/additional/mobileRU.js index 7006d09b4..c135be752 100644 --- a/src/additional/mobileRU.js +++ b/src/additional/mobileRU.js @@ -1,4 +1,4 @@ $.validator.addMethod( "mobileRU", function( phone_number, element ) { var ruPhone_number = phone_number.replace( /\(|\)|\s+|-/g, "" ); return this.optional( element ) || ruPhone_number.length > 9 && /^((\+7|7|8)+([0-9]){10})$/.test( ruPhone_number ); -}, "Please specify a valid mobile number" ); +}, "Please specify a valid mobile number." ); diff --git a/src/additional/mobileUK.js b/src/additional/mobileUK.js index e1c5ce3b2..e2d02ae9b 100644 --- a/src/additional/mobileUK.js +++ b/src/additional/mobileUK.js @@ -10,4 +10,4 @@ $.validator.addMethod( "mobileUK", function( phone_number, element ) { phone_number = phone_number.replace( /\(|\)|\s+|-/g, "" ); return this.optional( element ) || phone_number.length > 9 && phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/ ); -}, "Please specify a valid mobile number" ); +}, "Please specify a valid mobile number." ); diff --git a/src/additional/nisBR.js b/src/additional/nisBR.js index 7a685d1cb..3d305787d 100644 --- a/src/additional/nisBR.js +++ b/src/additional/nisBR.js @@ -54,4 +54,4 @@ $.validator.addMethod( "nisBR", function( value ) { } else { return false; } -}, "Please specify a valid NIS/PIS number" ); +}, "Please specify a valid NIS/PIS number." ); diff --git a/src/additional/nowhitespace.js b/src/additional/nowhitespace.js index 7f6c3bd43..86a3b9703 100644 --- a/src/additional/nowhitespace.js +++ b/src/additional/nowhitespace.js @@ -1,3 +1,3 @@ $.validator.addMethod( "nowhitespace", function( value, element ) { return this.optional( element ) || /^\S+$/i.test( value ); -}, "No white space please" ); +}, "No white space please." ); diff --git a/src/additional/phonePL.js b/src/additional/phonePL.js index cca314df4..f62f5fcb3 100644 --- a/src/additional/phonePL.js +++ b/src/additional/phonePL.js @@ -20,4 +20,4 @@ $.validator.addMethod( "phonePL", function( phone_number, element ) { phone_number = phone_number.replace( /\s+/g, "" ); var regexp = /^(?:(?:(?:\+|00)?48)|(?:\(\+?48\)))?(?:1[2-8]|2[2-69]|3[2-49]|4[1-68]|5[0-9]|6[0-35-9]|[7-8][1-9]|9[145])\d{7}$/; return this.optional( element ) || regexp.test( phone_number ); -}, "Please specify a valid phone number" ); +}, "Please specify a valid phone number." ); diff --git a/src/additional/phoneUK.js b/src/additional/phoneUK.js index b97866f09..af53bf1f6 100644 --- a/src/additional/phoneUK.js +++ b/src/additional/phoneUK.js @@ -10,4 +10,4 @@ $.validator.addMethod( "phoneUK", function( phone_number, element ) { phone_number = phone_number.replace( /\(|\)|\s+|-/g, "" ); return this.optional( element ) || phone_number.length > 9 && phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?)|(?:\(?0))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/ ); -}, "Please specify a valid phone number" ); +}, "Please specify a valid phone number." ); diff --git a/src/additional/phoneUS.js b/src/additional/phoneUS.js index 894a25c67..ed1c3d2fd 100644 --- a/src/additional/phoneUS.js +++ b/src/additional/phoneUS.js @@ -18,4 +18,4 @@ $.validator.addMethod( "phoneUS", function( phone_number, element ) { phone_number = phone_number.replace( /\s+/g, "" ); return this.optional( element ) || phone_number.length > 9 && phone_number.match( /^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]\d{2}-?\d{4}$/ ); -}, "Please specify a valid phone number" ); +}, "Please specify a valid phone number." ); diff --git a/src/additional/phonesUK.js b/src/additional/phonesUK.js index fa04167d5..e5678d612 100644 --- a/src/additional/phonesUK.js +++ b/src/additional/phonesUK.js @@ -12,4 +12,4 @@ $.validator.addMethod( "phonesUK", function( phone_number, element ) { phone_number = phone_number.replace( /\(|\)|\s+|-/g, "" ); return this.optional( element ) || phone_number.length > 9 && phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/ ); -}, "Please specify a valid uk phone number" ); +}, "Please specify a valid uk phone number." ); diff --git a/src/additional/postalCodeCA.js b/src/additional/postalCodeCA.js index ba3bb4a4e..7082d967e 100644 --- a/src/additional/postalCodeCA.js +++ b/src/additional/postalCodeCA.js @@ -13,4 +13,4 @@ */ $.validator.addMethod( "postalCodeCA", function( value, element ) { return this.optional( element ) || /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] *\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i.test( value ); -}, "Please specify a valid postal code" ); +}, "Please specify a valid postal code." ); diff --git a/src/additional/postalcodeIT.js b/src/additional/postalcodeIT.js index 38ea89d2b..a229956e6 100644 --- a/src/additional/postalcodeIT.js +++ b/src/additional/postalcodeIT.js @@ -1,4 +1,4 @@ /* Matches Italian postcode (CAP) */ $.validator.addMethod( "postalcodeIT", function( value, element ) { return this.optional( element ) || /^\d{5}$/.test( value ); -}, "Please specify a valid postal code" ); +}, "Please specify a valid postal code." ); diff --git a/src/additional/postalcodeNL.js b/src/additional/postalcodeNL.js index 38a547623..78707fd39 100644 --- a/src/additional/postalcodeNL.js +++ b/src/additional/postalcodeNL.js @@ -1,3 +1,3 @@ $.validator.addMethod( "postalcodeNL", function( value, element ) { return this.optional( element ) || /^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test( value ); -}, "Please specify a valid postal code" ); +}, "Please specify a valid postal code." ); diff --git a/src/additional/postcodeUK.js b/src/additional/postcodeUK.js index 26a4743c8..b5d2618a8 100644 --- a/src/additional/postcodeUK.js +++ b/src/additional/postcodeUK.js @@ -1,4 +1,4 @@ // Matches UK postcode. Does not match to UK Channel Islands that have their own postcodes (non standard UK) $.validator.addMethod( "postcodeUK", function( value, element ) { return this.optional( element ) || /^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test( value ); -}, "Please specify a valid UK postcode" ); +}, "Please specify a valid UK postcode." ); diff --git a/src/additional/statesUS.js b/src/additional/statesUS.js index 015894f3b..b26c33743 100644 --- a/src/additional/statesUS.js +++ b/src/additional/statesUS.js @@ -51,4 +51,4 @@ $.validator.addMethod( "stateUS", function( value, element, options ) { regex = caseSensitive ? new RegExp( regex ) : new RegExp( regex, "i" ); return this.optional( element ) || regex.test( value ); -}, "Please specify a valid state" ); +}, "Please specify a valid state." ); diff --git a/src/additional/strippedminlength.js b/src/additional/strippedminlength.js index e5bf73434..0b7006deb 100644 --- a/src/additional/strippedminlength.js +++ b/src/additional/strippedminlength.js @@ -1,4 +1,4 @@ // TODO check if value starts with <, otherwise don't try stripping anything $.validator.addMethod( "strippedminlength", function( value, element, param ) { return $( value ).text().length >= param; -}, $.validator.format( "Please enter at least {0} characters" ) ); +}, $.validator.format( "Please enter at least {0} characters." ) ); diff --git a/src/additional/time.js b/src/additional/time.js index 2bcbce13e..82c9806d0 100644 --- a/src/additional/time.js +++ b/src/additional/time.js @@ -1,3 +1,3 @@ $.validator.addMethod( "time", function( value, element ) { return this.optional( element ) || /^([01]\d|2[0-3]|[0-9])(:[0-5]\d){1,2}$/.test( value ); -}, "Please enter a valid time, between 00:00 and 23:59" ); +}, "Please enter a valid time, between 00:00 and 23:59." ); diff --git a/src/additional/time12h.js b/src/additional/time12h.js index fcd3fa288..402e4d2da 100644 --- a/src/additional/time12h.js +++ b/src/additional/time12h.js @@ -1,3 +1,3 @@ $.validator.addMethod( "time12h", function( value, element ) { return this.optional( element ) || /^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test( value ); -}, "Please enter a valid time in 12-hour am/pm format" ); +}, "Please enter a valid time in 12-hour am/pm format." ); diff --git a/src/additional/zipcodeUS.js b/src/additional/zipcodeUS.js index 8d52ac0b5..15c85dd58 100644 --- a/src/additional/zipcodeUS.js +++ b/src/additional/zipcodeUS.js @@ -1,3 +1,3 @@ $.validator.addMethod( "zipcodeUS", function( value, element ) { return this.optional( element ) || /^\d{5}(-\d{4})?$/.test( value ); -}, "The specified US ZIP Code is invalid" ); +}, "The specified US ZIP Code is invalid." ); diff --git a/src/additional/ziprange.js b/src/additional/ziprange.js index 48dc6836d..7e501d5b1 100644 --- a/src/additional/ziprange.js +++ b/src/additional/ziprange.js @@ -1,3 +1,3 @@ $.validator.addMethod( "ziprange", function( value, element ) { return this.optional( element ) || /^90[2-5]\d\{2\}-\d{4}$/.test( value ); -}, "Your ZIP-code must be in the range 902xx-xxxx to 905xx-xxxx" ); +}, "Your ZIP-code must be in the range 902xx-xxxx to 905xx-xxxx." ); diff --git a/src/localization/messages_az.js b/src/localization/messages_az.js index 61956a2d4..f629c8080 100644 --- a/src/localization/messages_az.js +++ b/src/localization/messages_az.js @@ -19,5 +19,5 @@ $.extend( $.validator.messages, { rangelength: $.validator.format( "Zəhmət olmasa, {0} - {1} aralığında uzunluğa malik simvol daxil edin." ), range: $.validator.format( "Zəhmət olmasa, {0} - {1} aralığında rəqəm daxil edin." ), max: $.validator.format( "Zəhmət olmasa, {0} və ondan kiçik rəqəm daxil edin." ), - min: $.validator.format( "Zəhmət olmasa, {0} və ondan böyük rəqəm daxil edin" ) + min: $.validator.format( "Zəhmət olmasa, {0} və ondan böyük rəqəm daxil edin." ) } ); diff --git a/src/localization/messages_ca.js b/src/localization/messages_ca.js index 2d650bc86..0c9184ac8 100644 --- a/src/localization/messages_ca.js +++ b/src/localization/messages_ca.js @@ -5,7 +5,7 @@ $.extend( $.validator.messages, { required: "Aquest camp és obligatori.", remote: "Si us plau, omple aquest camp.", - email: "Si us plau, escriu una adreça de correu-e vàlida", + email: "Si us plau, escriu una adreça de correu-e vàlida.", url: "Si us plau, escriu una URL vàlida.", date: "Si us plau, escriu una data vàlida.", dateISO: "Si us plau, escriu una data (ISO) vàlida.", diff --git a/src/localization/messages_da.js b/src/localization/messages_da.js index 4c0efcc1b..b41079412 100644 --- a/src/localization/messages_da.js +++ b/src/localization/messages_da.js @@ -4,7 +4,7 @@ */ $.extend( $.validator.messages, { required: "Dette felt er påkrævet.", - remote: "Ret venligst dette felt", + remote: "Ret venligst dette felt.", email: "Indtast en gyldig email-adresse.", url: "Indtast en gyldig URL.", date: "Indtast en gyldig dato.", @@ -16,18 +16,18 @@ $.extend( $.validator.messages, { ipv4: "Angiv venligst en gyldig IPv4-adresse.", ipv6: "Angiv venligst en gyldig IPv6-adresse.", require_from_group: $.validator.format( "Angiv mindst {0} af disse felter." ), - extension: "Indtast venligst en værdi med en gyldig endelse", - pattern: "Ugyldigt format", + extension: "Indtast venligst en værdi med en gyldig endelse.", + pattern: "Ugyldigt format.", lettersonly: "Angiv venligst kun bogstaver.", - nowhitespace: "Må ikke indholde mellemrum", + nowhitespace: "Må ikke indholde mellemrum.", maxlength: $.validator.format( "Indtast højst {0} tegn." ), minlength: $.validator.format( "Indtast mindst {0} tegn." ), rangelength: $.validator.format( "Indtast mindst {0} og højst {1} tegn." ), range: $.validator.format( "Angiv en værdi mellem {0} og {1}." ), max: $.validator.format( "Angiv en værdi der højst er {0}." ), min: $.validator.format( "Angiv en værdi der mindst er {0}." ), - minWords: $.validator.format( "Indtast venligst mindst {0} ord" ), - maxWords: $.validator.format( "Indtast venligst højst {0} ord" ), + minWords: $.validator.format( "Indtast venligst mindst {0} ord." ), + maxWords: $.validator.format( "Indtast venligst højst {0} ord." ), step: $.validator.format( "Angiv en værdi gange {0}." ), notEqualTo: "Angiv en anden værdi, værdierne må ikke være det samme.", integer: "Angiv et ikke-decimaltal, der er positivt eller negativt." diff --git a/src/localization/messages_fa.js b/src/localization/messages_fa.js index 234687bd7..c323a8119 100644 --- a/src/localization/messages_fa.js +++ b/src/localization/messages_fa.js @@ -14,7 +14,7 @@ $.extend( $.validator.messages, { digits: "لطفا تنها رقم وارد کنید.", creditcard: "لطفا کریدیت کارت صحیح وارد کنید.", equalTo: "لطفا مقدار برابری وارد کنید.", - extension: "لطفا مقداری وارد کنید که", + extension: "لطفا مقداری وارد کنید که.", alphanumeric: "لطفا مقدار را عدد (انگلیسی) وارد کنید.", maxlength: $.validator.format( "لطفا بیشتر از {0} حرف وارد نکنید." ), minlength: $.validator.format( "لطفا کمتر از {0} حرف وارد نکنید." ), diff --git a/src/localization/messages_ge.js b/src/localization/messages_ge.js index 95c40d4fa..bfcd3f5e1 100644 --- a/src/localization/messages_ge.js +++ b/src/localization/messages_ge.js @@ -4,7 +4,7 @@ * Locale: GE (Georgian; ქართული) */ $.extend( $.validator.messages, { - required: "ეს ველი სავალდებულოა", + required: "ეს ველი სავალდებულოა.", remote: "გთხოვთ შეასწოროთ.", email: "გთხოვთ შეიყვანოთ სწორი ფორმატით.", url: "გთხოვთ შეიყვანოთ სწორი ფორმატით.", diff --git a/src/localization/messages_it.js b/src/localization/messages_it.js index 54f07e106..111509454 100644 --- a/src/localization/messages_it.js +++ b/src/localization/messages_it.js @@ -3,25 +3,25 @@ * Locale: IT (Italian; Italiano) */ $.extend( $.validator.messages, { - required: "Campo obbligatorio", - remote: "Controlla questo campo", - email: "Inserisci un indirizzo email valido", - url: "Inserisci un indirizzo web valido", - date: "Inserisci una data valida", - dateISO: "Inserisci una data valida (ISO)", - number: "Inserisci un numero valido", - digits: "Inserisci solo numeri", - creditcard: "Inserisci un numero di carta di credito valido", - equalTo: "Il valore non corrisponde", - extension: "Inserisci un valore con un'estensione valida", - maxlength: $.validator.format( "Non inserire più di {0} caratteri" ), - minlength: $.validator.format( "Inserisci almeno {0} caratteri" ), - rangelength: $.validator.format( "Inserisci un valore compreso tra {0} e {1} caratteri" ), - range: $.validator.format( "Inserisci un valore compreso tra {0} e {1}" ), - max: $.validator.format( "Inserisci un valore minore o uguale a {0}" ), - min: $.validator.format( "Inserisci un valore maggiore o uguale a {0}" ), - nifES: "Inserisci un NIF valido", - nieES: "Inserisci un NIE valido", - cifES: "Inserisci un CIF valido", - currency: "Inserisci una valuta valida" + required: "Campo obbligatorio.", + remote: "Controlla questo campo.", + email: "Inserisci un indirizzo email valido.", + url: "Inserisci un indirizzo web valido.", + date: "Inserisci una data valida.", + dateISO: "Inserisci una data valida (ISO).", + number: "Inserisci un numero valido.", + digits: "Inserisci solo numeri.", + creditcard: "Inserisci un numero di carta di credito valido.", + equalTo: "Il valore non corrisponde.", + extension: "Inserisci un valore con un'estensione valida.", + maxlength: $.validator.format( "Non inserire più di {0} caratteri." ), + minlength: $.validator.format( "Inserisci almeno {0} caratteri." ), + rangelength: $.validator.format( "Inserisci un valore compreso tra {0} e {1} caratteri." ), + range: $.validator.format( "Inserisci un valore compreso tra {0} e {1}." ), + max: $.validator.format( "Inserisci un valore minore o uguale a {0}." ), + min: $.validator.format( "Inserisci un valore maggiore o uguale a {0}." ), + nifES: "Inserisci un NIF valido.", + nieES: "Inserisci un NIE valido.", + cifES: "Inserisci un CIF valido.", + currency: "Inserisci una valuta valida." } ); diff --git a/src/localization/messages_mk.js b/src/localization/messages_mk.js index 21da3282f..24fb59785 100644 --- a/src/localization/messages_mk.js +++ b/src/localization/messages_mk.js @@ -4,10 +4,10 @@ */ $.extend( $.validator.messages, { required: "Полето е задолжително.", - remote: "Поправете го ова поле", - email: "Внесете правилна e-mail адреса", + remote: "Поправете го ова поле.", + email: "Внесете правилна e-mail адреса.", url: "Внесете правилен URL.", - date: "Внесете правилен датум", + date: "Внесете правилен датум.", dateISO: "Внесете правилен датум (ISO).", number: "Внесете правилен број.", digits: "Внесете само бројки.", @@ -19,5 +19,5 @@ $.extend( $.validator.messages, { rangelength: $.validator.format( "Внесете вредност со должина помеѓу {0} и {1} знаци." ), range: $.validator.format( "Внесете вредност помеѓу {0} и {1}." ), max: $.validator.format( "Внесете вредност помала или еднаква на {0}." ), - min: $.validator.format( "Внесете вредност поголема или еднаква на {0}" ) + min: $.validator.format( "Внесете вредност поголема или еднаква на {0}." ) } ); diff --git a/src/localization/messages_pl.js b/src/localization/messages_pl.js index 1f77009ec..c67b396d3 100644 --- a/src/localization/messages_pl.js +++ b/src/localization/messages_pl.js @@ -15,7 +15,7 @@ $.extend( $.validator.messages, { equalTo: "Proszę o podanie tej samej wartości ponownie.", extension: "Proszę o podanie wartości z prawidłowym rozszerzeniem.", nipPL: "Proszę o podanie prawidłowego numeru NIP.", - phonePL: "Proszę o podanie prawidłowego numeru telefonu", + phonePL: "Proszę o podanie prawidłowego numeru telefonu.", maxlength: $.validator.format( "Proszę o podanie nie więcej niż {0} znaków." ), minlength: $.validator.format( "Proszę o podanie przynajmniej {0} znaków." ), rangelength: $.validator.format( "Proszę o podanie wartości o długości od {0} do {1} znaków." ), diff --git a/src/localization/messages_pt_BR.js b/src/localization/messages_pt_BR.js index cfd018de8..996c844be 100644 --- a/src/localization/messages_pt_BR.js +++ b/src/localization/messages_pt_BR.js @@ -71,9 +71,9 @@ $.extend( $.validator.messages, { url2: "Por favor, forneça uma URL válida.", vinUS: "O número de identificação de veículo informado (VIN) é inválido.", zipcodeUS: "Por favor, forneça um código postal americano válido.", - ziprange: "O código postal deve estar entre 902xx-xxxx e 905xx-xxxx", + ziprange: "O código postal deve estar entre 902xx-xxxx e 905xx-xxxx.", cpfBR: "Por favor, forneça um CPF válido.", - nisBR: "Por favor, forneça um NIS/PIS válido", + nisBR: "Por favor, forneça um NIS/PIS válido.", cnhBR: "Por favor, forneça um CNH válido.", cnpjBR: "Por favor, forneça um CNPJ válido." } ); diff --git a/src/localization/messages_ro.js b/src/localization/messages_ro.js index 7ea626b42..4b3190b79 100644 --- a/src/localization/messages_ro.js +++ b/src/localization/messages_ro.js @@ -5,7 +5,7 @@ $.extend( $.validator.messages, { required: "Acest câmp este obligatoriu.", remote: "Te rugăm să completezi acest câmp.", - email: "Te rugăm să introduci o adresă de email validă", + email: "Te rugăm să introduci o adresă de email validă.", url: "Te rugăm sa introduci o adresă URL validă.", date: "Te rugăm să introduci o dată corectă.", dateISO: "Te rugăm să introduci o dată (ISO) corectă.", diff --git a/src/localization/messages_sr_lat.js b/src/localization/messages_sr_lat.js index 43666f98d..07b74137b 100644 --- a/src/localization/messages_sr_lat.js +++ b/src/localization/messages_sr_lat.js @@ -5,7 +5,7 @@ $.extend( $.validator.messages, { required: "Polje je obavezno.", remote: "Sredite ovo polje.", - email: "Unesite ispravnu e-mail adresu", + email: "Unesite ispravnu e-mail adresu.", url: "Unesite ispravan URL.", date: "Unesite ispravan datum.", dateISO: "Unesite ispravan datum (ISO).", diff --git a/src/localization/messages_tj.js b/src/localization/messages_tj.js index 4bbb4d2c4..c540461d9 100644 --- a/src/localization/messages_tj.js +++ b/src/localization/messages_tj.js @@ -13,7 +13,7 @@ $.extend( $.validator.messages, { digits: "Илтимос, танҳо рақам ворид кунед.", creditcard: "Илтимос, кредит карди саҳеҳ ворид кунед.", equalTo: "Илтимос, миқдори баробар ворид кунед.", - extension: "Илтимос, қофияи файлро дуруст интихоб кунед", + extension: "Илтимос, қофияи файлро дуруст интихоб кунед.", maxlength: $.validator.format( "Илтимос, бештар аз {0} рамз ворид накунед." ), minlength: $.validator.format( "Илтимос, камтар аз {0} рамз ворид накунед." ), rangelength: $.validator.format( "Илтимос, камтар аз {0} ва зиёда аз {1} рамз ворид кунед." ), diff --git a/src/localization/messages_tr.js b/src/localization/messages_tr.js index 8d8086048..509c6f5f6 100644 --- a/src/localization/messages_tr.js +++ b/src/localization/messages_tr.js @@ -8,7 +8,7 @@ $.extend( $.validator.messages, { email: "Lütfen geçerli bir e-posta adresi giriniz.", url: "Lütfen geçerli bir web adresi (URL) giriniz.", date: "Lütfen geçerli bir tarih giriniz.", - dateISO: "Lütfen geçerli bir tarih giriniz(ISO formatında)", + dateISO: "Lütfen geçerli bir tarih giriniz(ISO formatında).", number: "Lütfen geçerli bir sayı giriniz.", digits: "Lütfen sadece sayısal karakterler giriniz.", creditcard: "Lütfen geçerli bir kredi kartı giriniz.", From 0da490675cdc1d1ce0b6644c3f4ad14023d53238 Mon Sep 17 00:00:00 2001 From: Kieran Date: Mon, 23 May 2022 23:48:30 +0100 Subject: [PATCH 04/38] Core: fix deprecated jquery .submit() event shorthand (#2430) * Core: fix deprecated jquery .submit() event shorthand * Core: jscs --- src/core.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core.js b/src/core.js index 5f4d362b5..088be16d7 100644 --- a/src/core.js +++ b/src/core.js @@ -1113,7 +1113,7 @@ $.extend( $.validator, { delete this.pending[ element.name ]; $( element ).removeClass( this.settings.pendingClass ); if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() && this.pendingRequest === 0 ) { - $( this.currentForm ).submit(); + $( this.currentForm ).trigger( "submit" ); // Remove the hidden input that was used as a replacement for the // missing submit button. The hidden input is added by `handle()` From 3d3c1fb880c3c623da334e9b6b32a861a16efeb8 Mon Sep 17 00:00:00 2001 From: Kieran Date: Thu, 23 Jun 2022 17:05:23 +0100 Subject: [PATCH 05/38] Chore: Add CodeQL analysis --- .github/workflows/codeql-analysis.yml | 72 +++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/codeql-analysis.yml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 000000000..7ef364fb7 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,72 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ "master" ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "master" ] + schedule: + - cron: '19 23 * * 1' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'javascript' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 From 5bbd80d27fc6b607d2f7f106c89522051a9fb0dd Mon Sep 17 00:00:00 2001 From: Kieran Date: Fri, 1 Jul 2022 16:00:37 +0100 Subject: [PATCH 06/38] Merge pull request from GHSA-ffmh-x56j-9rc3 (cherry picked from commit a3908cc082465000a3afa4bed47418b6e02c14ed) --- src/additional/url2.js | 2 +- src/core.js | 2 +- test/methods.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/additional/url2.js b/src/additional/url2.js index 955851a49..e7c8f42df 100644 --- a/src/additional/url2.js +++ b/src/additional/url2.js @@ -1,4 +1,4 @@ // Same as url, but TLD is optional $.validator.addMethod( "url2", function( value, element ) { - 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 ); + 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,}\.?)|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff])|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62}\.)))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test( value ); }, $.validator.messages.url ); diff --git a/src/core.js b/src/core.js index 088be16d7..ddb258119 100644 --- a/src/core.js +++ b/src/core.js @@ -1416,7 +1416,7 @@ $.extend( $.validator, { // https://gist.github.com/dperini/729294 // see also https://mathiasbynens.be/demo/url-regex // modified to allow protocol-relative URLs - 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 ); + 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 ); }, // https://jqueryvalidation.org/date-method/ diff --git a/test/methods.js b/test/methods.js index 743267cab..fa49939e4 100644 --- a/test/methods.js +++ b/test/methods.js @@ -123,9 +123,9 @@ QUnit.test( "url2 (tld optional)", function( assert ) { assert.ok( method( "http://www.føtex.dk/" ), "Valid url, danish unicode characters" ); assert.ok( method( "http://bösendorfer.de/" ), "Valid url, german unicode characters" ); assert.ok( method( "http://142.42.1.1" ), "Valid IP Address" ); + assert.ok( method( "http://bassistance" ), "Valid URL (optional TLD)" ); + assert.ok( method( "http://bassistance." ), "Valid URL (optional TLD)" ); assert.ok( !method( "http://192.168.8." ), "Invalid IP Address" ); - assert.ok( method( "http://bassistance" ), "Invalid url" ); - assert.ok( method( "http://bassistance." ), "Invalid url" ); assert.ok( !method( "http://bassistance,de" ), "Invalid url" ); assert.ok( !method( "http://bassistance;de" ), "Invalid url" ); assert.ok( !method( "http://.bassistancede" ), "Invalid url" ); From 1c4f409aef4930040753ab59b5532b7e430f37cc Mon Sep 17 00:00:00 2001 From: Kieran Brahney Date: Fri, 1 Jul 2022 16:20:23 +0100 Subject: [PATCH 07/38] Build: Updating the master version to 1.19.6-pre. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0bc214db1..2cc35a6bc 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "jquery-validation", "title": "jQuery Validation Plugin", "description": "Client-side form validation made easy", - "version": "1.19.5-pre", + "version": "1.19.6-pre", "homepage": "https://jqueryvalidation.org/", "license": "MIT", "author": { From 73c645d7d5f879543c32f03f5231200e3748fc30 Mon Sep 17 00:00:00 2001 From: Kieran Brahney Date: Fri, 1 Jul 2022 16:30:42 +0100 Subject: [PATCH 08/38] Chore: update changelog --- changelog.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 284e5a15c..ca71122fb 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,16 @@ +1.19.5 / 2022-06-01 +=================== + +## Chore + * Add CodeQL analysis [3d3c1fb](https://github.com/jquery-validation/jquery-validation/commit/3d3c1fb880c3c623da334e9b6b32a861a16efeb8) + +## Core + * Fixed jQuery .submit() event shorthand deprecation notice [#2430](https://github.com/jquery-validation/jquery-validation/pull/2430) + * Fixed ReDos vulnerability in url, and url2 validation [5bbd80d](https://github.com/jquery-validation/jquery-validation/commit/5bbd80d27fc6b607d2f7f106c89522051a9fb0dd) + +## Localisation + * Added periods to messages [#2266](https://github.com/jquery-validation/jquery-validation/pull/2266) + 1.19.4 / 2022-05-19 =================== @@ -28,7 +41,7 @@ * Add Accessibility section to Readme (#2149) ## Localization - * Add "pattern" translation for French (#2363) + * Add "pattern" translation for French (#2363) * add phone validate translate for Turkish translation (#2343) 1.19.2 / 2020-05-23 @@ -160,7 +173,7 @@ The hashes for the 1.19.0 release can be found in the file [`jquery-validation-s ## Tests * Pass on the value of the used submit button for scripted submits (#2019) * Use assert#pushResult instead of assert#push (#2018) - + ## All * Fix links after move to organization * Use https From 24f2e277f1cb2c4d0dfcd97ae35997d43136dfbe Mon Sep 17 00:00:00 2001 From: Kieran Date: Fri, 1 Jul 2022 21:39:27 +0100 Subject: [PATCH 09/38] Chore: correct 1.19.5 release date --- changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index ca71122fb..6bbbd5ccb 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,4 @@ -1.19.5 / 2022-06-01 +1.19.5 / 2022-07-01 =================== ## Chore From 980087a897c1d3a03b87f8d07cf756e8b9bba6d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sylvain=20Monn=C3=A9?= Date: Fri, 15 Jul 2022 23:26:56 +0200 Subject: [PATCH 10/38] Core: fix race condition in remote validation rules (#2435) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #2434 Co-authored-by: Sylvain Monné --- src/ajax.js | 17 +++++++++++------ src/core.js | 27 ++++++++++++++++++++++++++- test/methods.js | 30 ++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 7 deletions(-) diff --git a/src/ajax.js b/src/ajax.js index fb56de4b3..5f87bed20 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -1,5 +1,6 @@ // Ajax mode: abort // usage: $.ajax({ mode: "abort"[, port: "uniqueport"]}); +// $.ajaxAbort( port ); // if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort() var pendingRequests = {}, @@ -10,9 +11,7 @@ if ( $.ajaxPrefilter ) { $.ajaxPrefilter( function( settings, _, xhr ) { var port = settings.port; if ( settings.mode === "abort" ) { - if ( pendingRequests[ port ] ) { - pendingRequests[ port ].abort(); - } + $.ajaxAbort( port ); pendingRequests[ port ] = xhr; } } ); @@ -24,12 +23,18 @@ if ( $.ajaxPrefilter ) { var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode, port = ( "port" in settings ? settings : $.ajaxSettings ).port; if ( mode === "abort" ) { - if ( pendingRequests[ port ] ) { - pendingRequests[ port ].abort(); - } + $.ajaxAbort( port ); pendingRequests[ port ] = ajax.apply( this, arguments ); return pendingRequests[ port ]; } return ajax.apply( this, arguments ); }; } + +// Abort the previous request without sending a new one +$.ajaxAbort = function( port ) { + if ( pendingRequests[ port ] ) { + pendingRequests[ port ].abort(); + delete pendingRequests[ port ]; + } +}; diff --git a/src/core.js b/src/core.js index ddb258119..923b3012b 100644 --- a/src/core.js +++ b/src/core.js @@ -756,6 +756,9 @@ $.extend( $.validator, { val = this.elementValue( element ), result, method, rule, normalizer; + // Abort any pending Ajax request from a previous call to this method. + this.abortRequest( element ); + // Prioritize the local normalizer defined for this element over the global one // if the former exists, otherwise user the global one in case it exists. if ( typeof rules.normalizer === "function" ) { @@ -1095,6 +1098,10 @@ $.extend( $.validator, { return !$.validator.methods.required.call( this, val, element ) && "dependency-mismatch"; }, + elementAjaxPort: function( element ) { + return "validate" + element.name; + }, + startRequest: function( element ) { if ( !this.pending[ element.name ] ) { this.pendingRequest++; @@ -1130,6 +1137,24 @@ $.extend( $.validator, { } }, + abortRequest: function( element ) { + var port; + + if ( this.pending[ element.name ] ) { + port = this.elementAjaxPort( element ); + $.ajaxAbort( port ); + + this.pendingRequest--; + + // Sometimes synchronization fails, make sure pendingRequest is never < 0 + if ( this.pendingRequest < 0 ) { + this.pendingRequest = 0; + } + + delete this.pending[ element.name ]; + } + }, + previousValue: function( element, method ) { method = typeof method === "string" && method || "remote"; @@ -1570,7 +1595,7 @@ $.extend( $.validator, { data[ element.name ] = value; $.ajax( $.extend( true, { mode: "abort", - port: "validate" + element.name, + port: this.elementAjaxPort( element ), dataType: "json", data: data, context: validator.currentForm, diff --git a/test/methods.js b/test/methods.js index fa49939e4..2966ec25f 100644 --- a/test/methods.js +++ b/test/methods.js @@ -801,6 +801,36 @@ QUnit.test( "Fix #697: remote validation uses wrong error messages", function( a } ); } ); +QUnit.test( "Fix #2434: race condition in remote validation rules", function( assert ) { + var e = $( "#username" ), + done1 = assert.async(), + v = $( "#userForm" ).validate( { + rules: { + username: { + required: true, + remote: { + url: "users.php" + } + } + }, + messages: { + username: { + remote: $.validator.format( "{0} in use" ) + } + } + } ); + + e.val( "Peter" ); + v.element( e ); + + e.val( "" ); + v.element( e ); + setTimeout( function() { + assert.equal( v.errorList[ 0 ].message, "This field is required." ); + done1(); + } ); +} ); + QUnit.module( "additional methods" ); QUnit.test( "phone (us)", function( assert ) { From 98fbc5f4287b9e580be6c1404094e9ae31b4abb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sylvain=20Monn=C3=A9?= Date: Sun, 17 Jul 2022 13:21:36 +0200 Subject: [PATCH 11/38] Core: remove pending class from fields with an aborted request (#2436) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ref #2434 Ref #2435 Co-authored-by: Sylvain Monné --- src/core.js | 1 + test/methods.js | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/core.js b/src/core.js index 923b3012b..b7c62c04c 100644 --- a/src/core.js +++ b/src/core.js @@ -1152,6 +1152,7 @@ $.extend( $.validator, { } delete this.pending[ element.name ]; + $( element ).removeClass( this.settings.pendingClass ); } }, diff --git a/test/methods.js b/test/methods.js index 2966ec25f..a65e4b474 100644 --- a/test/methods.js +++ b/test/methods.js @@ -822,11 +822,19 @@ QUnit.test( "Fix #2434: race condition in remote validation rules", function( as e.val( "Peter" ); v.element( e ); + assert.equal( e.hasClass( "error" ), false, "Field 'username' should not have the error class" ); + assert.equal( e.hasClass( "pending" ), true, "field 'username' should have the pending class" ); e.val( "" ); v.element( e ); + assert.equal( v.errorList[ 0 ].message, "This field is required." ); + assert.equal( e.hasClass( "error" ), true, "Field 'username' should have the error class" ); + assert.equal( e.hasClass( "pending" ), false, "field 'username' should not have the pending class" ); + setTimeout( function() { assert.equal( v.errorList[ 0 ].message, "This field is required." ); + assert.equal( e.hasClass( "error" ), true, "Field 'username' should have the error class" ); + assert.equal( e.hasClass( "pending" ), false, "field 'username' should not have the pending class" ); done1(); } ); } ); From f1bb23544bb7a796402b763af115662651aa6dbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=A1vio=20Monteiro?= Date: Thu, 13 Oct 2022 06:36:37 -0300 Subject: [PATCH 12/38] Localization: Improve required translation in pt_BR (#2445) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "É requerido" although correct is weird in this context (it's much more used in formal settings for documents known as requerimentos) and too much of a literal translation. This change aims to improve user-friendliness in this particular message. --- src/localization/messages_pt_BR.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/localization/messages_pt_BR.js b/src/localization/messages_pt_BR.js index 996c844be..42cd4a6bd 100644 --- a/src/localization/messages_pt_BR.js +++ b/src/localization/messages_pt_BR.js @@ -6,7 +6,7 @@ $.extend( $.validator.messages, { // Core - required: "Este campo é requerido.", + required: "Este campo é obrigatório.", remote: "Por favor, corrija este campo.", email: "Por favor, forneça um endereço de email válido.", url: "Por favor, forneça uma URL válida.", From d46e86c1432f449959025b1c41e4cf16eb62a699 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Fri, 11 Nov 2022 11:40:48 +0100 Subject: [PATCH 13/38] Demo: fix minlength validation in ajaxSubmit-integration-demo.html (#2454) --- demo/ajaxSubmit-integration-demo.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/ajaxSubmit-integration-demo.html b/demo/ajaxSubmit-integration-demo.html index 057f18dbe..21a7d38d9 100644 --- a/demo/ajaxSubmit-integration-demo.html +++ b/demo/ajaxSubmit-integration-demo.html @@ -74,7 +74,7 @@

jQuery Validation Plugin

- +

From 29fb609cd093a7b5eca9ed33668b55765a4fc0b0 Mon Sep 17 00:00:00 2001 From: Saurabh <41580629+saurabhsharma2u@users.noreply.github.com> Date: Fri, 11 Nov 2022 21:59:31 +0530 Subject: [PATCH 14/38] Localization: Add Hindi translation (#2453) * Localisation: Update Hindi (India) translation * Hindi Translation for Step Method * HIndi-India Local messages for additional method * file rename as per ISO 639-1 format * removed duplicate message, causing the test fail * removed duplicate "cifES" error message --- src/localization/message_hi.js | 42 ++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/localization/message_hi.js diff --git a/src/localization/message_hi.js b/src/localization/message_hi.js new file mode 100644 index 000000000..72bf4a149 --- /dev/null +++ b/src/localization/message_hi.js @@ -0,0 +1,42 @@ +/* + * Translated default messages for the jQuery validation plugin. + * Locale: Hindi; हिंदी + */ +$.extend( $.validator.messages, { + required: "आवश्यक फ़ील्ड।", + remote:"इस फ़ील्ड को जांचें।", + email: "एक वैध ई - मेल पते की प्रविष्टि करें।", + url: "कृपया एक वैध वेब पता दर्ज करें।", + date: "कृपया कोई मान्य दिनांक दर्ज करें।", + dateISO: "कृपया एक मान्य दिनांक (ISO) दर्ज करें।", + number: "कृपया सही अंक दर्ज करें।", + digits: "केवल संख्याएं दर्ज करें।", + creditcard: "कृपया एक वैध क्रेडिट कार्ड नंबर डालें।", + equalTo: "मेल नहीं खाता।", + extension: "कृपया एक मान्य एक्सटेंशन वाला मान दर्ज करें।", + maxlength: $.validator.format( "अधिक दर्ज न करें {0} वर्णों में से" ), + minlength: $.validator.format( "कृपया कम से कम {0} वर्ण दर्ज करें।" ), + rangelength: $.validator.format( "कृपया {0} और {1} वर्णों के बीच एक मान दर्ज करें।" ), + range: $.validator.format( "कृपया {0} और {1} के बीच एक मान दर्ज करें।" ), + max: $.validator.format( "कृपया {0} से कम या उसके बराबर मान दर्ज करें।" ), + min: $.validator.format( "कृपया {0} से अधिक या उसके बराबर मान दर्ज करें।" ), + nieES: "कृपया एक मान्य NIE दर्ज करें।", + cifES: "कृपया एक मान्य CIF दर्ज करें.", + currency: "कृपया एक मान्य मुद्रा दर्ज करें।.", + step: $.validator.format( "{0} का गुणज होना चाहिए।" ), + abaRoutingNumber:"कृपया एक मान्य रूटिंग नंबर दर्ज करें।", + accept:"कृपया एक मान्य माइमटाइप वाला मान दर्ज करें।", + alphanumeric:"कृपया, केवल अक्षर, संख्याएं और अंडरस्कोर।", + bankaccountNL:"कृपया एक वैध बैंक खाता संख्या निर्दिष्ट करें।", + bankorgiroaccountNL:"कृपया एक वैध बैंक या जीरो खाता संख्या निर्दिष्ट करें।", + bic:"कृपया कोई मान्य BIC कोड निर्दिष्ट करें।", + ziprange:"आपका ज़िप कोड 902xx-xxxx से 905xx-xxxx की सीमा में होना चाहिए।", + zipcodeUS:"निर्दिष्ट यूएस ज़िप कोड अमान्य है।", + vinUS:"निर्दिष्ट वाहन पहचान संख्या (VIN) अमान्य है।", + time12h:"कृपया 12 घंटे पूर्वाह्न/अपराह्न प्रारूप में मान्य समय दर्ज करें।", + time:"कृपया 00:00 और 23:59 के बीच एक वैध समय दर्ज करें।", + strippedminlength:"कृपया कम से कम {0} वर्ण दर्ज करें।", + stateUS:"कृपया एक वैध प्रदेश निर्दिष्ट करें।", + skip_or_fill_minimum:"कृपया या तो इन फ़ील्ड को छोड़ दें या उनमें से कम से कम {0} भरें।", + require_from_group:"कृपया इनमें से कम से कम {0} को भरें।" +} ); From 13b859e35735086cb320423b3585d8a6edee4349 Mon Sep 17 00:00:00 2001 From: Warren White <111083379+wewhite@users.noreply.github.com> Date: Thu, 1 Dec 2022 02:50:24 -0800 Subject: [PATCH 15/38] Additional: vinUS validation fails on valid vin numbers (#2460) * Removed === compare, changed to == Compare by value and type (===) does not work for this algorithm, as both cd and cdv can be either types at the same time. By comparing by value only (==) cd and cdv can be either integer or string, as a string number will be converted to a number reqardless of type. * Rewrote forloop, removed nested forloop * Additional: fixed spacing issues * Additional: Add vinUS.js validation test cases Test cases include default test with 17 one's, and additional US and Canada VIN * Additional: add two more test casses for vinUS * Additional: removed text license number, should be VIN --- src/additional/vinUS.js | 69 ++++++++++++++++++---------------------- test/additional/vinUS.js | 11 +++++++ test/index.html | 1 + 3 files changed, 43 insertions(+), 38 deletions(-) create mode 100644 test/additional/vinUS.js diff --git a/src/additional/vinUS.js b/src/additional/vinUS.js index 15460d725..3fd2d128b 100644 --- a/src/additional/vinUS.js +++ b/src/additional/vinUS.js @@ -11,44 +11,37 @@ * @cat Plugins/Validate/Methods */ $.validator.addMethod( "vinUS", function( v ) { - if ( v.length !== 17 ) { - return false; - } + if ( v.length !== 17 ) { + return false; + } - var LL = [ "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" ], - VL = [ 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 7, 9, 2, 3, 4, 5, 6, 7, 8, 9 ], - FL = [ 8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2 ], - rs = 0, - i, n, d, f, cd, cdv; + var LL = [ "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" ], + VL = [ 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 7, 9, 2, 3, 4, 5, 6, 7, 8, 9 ], + FL = [ 8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2 ], + rs = 0, + i, n, d, f, cd, cdv; - for ( i = 0; i < 17; i++ ) { - f = FL[ i ]; - d = v.slice( i, i + 1 ); - if ( i === 8 ) { - cdv = d; - } - if ( !isNaN( d ) ) { - d *= f; - } else { - for ( n = 0; n < LL.length; n++ ) { - if ( d.toUpperCase() === LL[ n ] ) { - d = VL[ n ]; - d *= f; - if ( isNaN( cdv ) && n === 8 ) { - cdv = LL[ n ]; - } - break; - } - } - } - rs += d; - } - cd = rs % 11; - if ( cd === 10 ) { - cd = "X"; - } - if ( cd === cdv ) { - return true; - } - return false; + for ( i = 0; i < 17; i++ ) { + f = FL[ i ]; + d = v.slice( i, i + 1 ); + if ( isNaN( d ) ) { + d = d.toUpperCase(); + n = VL[ LL.indexOf( d ) ]; + } else { + n = parseInt( d, 10 ); + } + if ( i === 8 ) + { + cdv = n; + if ( d === "X" ) { + cdv = 10; + } + } + rs += n * f; + } + cd = rs % 11; + if ( cd === cdv ) { + return true; + } + return false; }, "The specified vehicle identification number (VIN) is invalid." ); diff --git a/test/additional/vinUS.js b/test/additional/vinUS.js new file mode 100644 index 000000000..3311b0111 --- /dev/null +++ b/test/additional/vinUS.js @@ -0,0 +1,11 @@ +QUnit.test( "vinUS", function( assert ) { + var method = methodTest( "vinUS" ); + assert.ok( method( "11111111111111111" ), "Valid test VIN number" ); + assert.ok( method( "1FTFX1CT9CFD06231" ), "Valid US VIN number" ); + assert.ok( method( "2FTHF26F8SCA68695" ), "Valid CAN VIN number" ); + assert.ok( method( "LJCPCBLCX11000237" ), "Valid VIN with X check digit" ); + assert.ok( !method( "LJCPCBLC011000237" ), "Invalid VIN with 0 check digit" ); + assert.ok( !method( "2FTHF26F8" ), "InValid VIN number" ); + assert.ok( !method( "11111111X1111111" ), "Invalid test VIN" ); + assert.ok( !method( "1111111101111111" ), "Invalid test VIN" ); +} ); diff --git a/test/index.html b/test/index.html index bf22a640a..17c6438b8 100644 --- a/test/index.html +++ b/test/index.html @@ -19,6 +19,7 @@ + From cfe74a19b671b0983b3b13dbf959619cfe926de9 Mon Sep 17 00:00:00 2001 From: Leonardo Spina Date: Tue, 24 Jan 2023 11:37:07 +0000 Subject: [PATCH 16/38] Core: Call to resetInternals removed in remote validation callback (#2242) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Core: Call to resetInternals removed in remote validation callback * Core: Add unit test for issue #2150 fix * Core: fix code style errors Co-authored-by: leonardospina Co-authored-by: Julien Tschäppät --- src/core.js | 1 - test/index.html | 4 ++++ test/test.js | 31 +++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/core.js b/src/core.js index b7c62c04c..5a2fb1ce4 100644 --- a/src/core.js +++ b/src/core.js @@ -1607,7 +1607,6 @@ $.extend( $.validator, { validator.settings.messages[ element.name ][ method ] = previous.originalMessage; if ( valid ) { submitted = validator.formSubmitted; - validator.resetInternals(); validator.toHide = validator.errorsFor( element ); validator.formSubmitted = submitted; validator.successList.push( element ); diff --git a/test/index.html b/test/index.html index 17c6438b8..f27ad1d76 100644 --- a/test/index.html +++ b/test/index.html @@ -72,6 +72,10 @@

+
+
+ +
diff --git a/test/test.js b/test/test.js index 298df0dbc..02462c933 100644 --- a/test/test.js +++ b/test/test.js @@ -2060,6 +2060,37 @@ QUnit.test( "[Remote rule] #1508: Validation fails to trigger when next field is check( "abc" ); } ); +$.mockjax( { + url: "issue2150TestForm.action", + response: function() { + this.responseText = "true"; + }, + responseTime: 1 +} ); + +QUnit.test( "Remote validation should not reset existing errors (#2150)", function( assert ) { + assert.expect( 3 ); + var done = assert.async(); + $( "#issue2150TestForm" ).validate( { + rules: { + remoteTestedInput: { + remote: "issue2150TestForm.action" + }, + requiredInput: "required" + } + } ); + + assert.equal( $( "#requiredInput" ).attr( "class" ), undefined, "#requiredInput should not have any class" ); + + var isValid = $( "#issue2150TestForm" ).valid(); + + setTimeout( function() { + assert.equal( $( "#requiredInput" ).attr( "class" ), "error", "#requiredInput should have \"error\" class" ); + assert.equal( isValid, false, "Form should have error" ); + done(); + } ); +} ); + QUnit.test( "validate checkbox on click", function( assert ) { function errors( expected, message ) { assert.equal( v.size(), expected, message ); From 7a490d8f39bd988027568ddcf51755e1f4688902 Mon Sep 17 00:00:00 2001 From: Volkan Ceylan Date: Wed, 1 Feb 2023 13:26:18 +0300 Subject: [PATCH 17/38] Core: Added escapeHtml option to avoid XSS attacks via showLabel methods (#2462) --- src/core.js | 15 ++++++++--- test/error-placement.js | 57 +++++++++++++++++++++++++++++++++++++++++ test/index.html | 6 +++++ 3 files changed, 75 insertions(+), 3 deletions(-) diff --git a/src/core.js b/src/core.js index 5a2fb1ce4..ab891487b 100644 --- a/src/core.js +++ b/src/core.js @@ -945,14 +945,23 @@ $.extend( $.validator, { error.removeClass( this.settings.validClass ).addClass( this.settings.errorClass ); // Replace message on existing label - error.html( message ); + if ( this.settings && this.settings.escapeHtml ) { + error.text( message || "" ); + } else { + error.html( message || "" ); + } } else { // Create error element error = $( "<" + this.settings.errorElement + ">" ) .attr( "id", elementID + "-error" ) - .addClass( this.settings.errorClass ) - .html( message || "" ); + .addClass( this.settings.errorClass ); + + if ( this.settings && this.settings.escapeHtml ) { + error.text( message || "" ); + } else { + error.html( message || "" ); + } // Maintain reference to the element to be placed into the DOM place = error; diff --git a/test/error-placement.js b/test/error-placement.js index 7c00ce0cd..05e5c565f 100644 --- a/test/error-placement.js +++ b/test/error-placement.js @@ -440,3 +440,60 @@ QUnit.test( "#1632: Error hidden, but input error class not removed", function( assert.equal( v.numberOfInvalids(), 0, "There is no error" ); assert.equal( box2.hasClass( "error" ), false, "Box2 should not have an error class" ); } ); + +QUnit.test( "test settings.escapeHtml undefined", function( assert ) { + var form = $( "#escapeHtmlForm1" ), + field = $( "#escapeHtmlForm1text" ); + + form.validate( { + messages: { + escapeHtmlForm1text: { + required: "" + } + } + } ); + + assert.ok( !field.valid() ); + assert.hasError( field, "required" ); + + var label = form.find( "label" ); + assert.equal( label.length, 1 ); + assert.equal( label.html(), "" ); + + label.html( "" ); + assert.ok( !field.valid() ); + assert.equal( label.html(), "" ); + + field.val( "foo" ); + assert.ok( field.valid() ); + assert.noErrorFor( field ); +} ); + +QUnit.test( "test settings.escapeHtml true", function( assert ) { + var form = $( "#escapeHtmlForm2" ), + field = $( "#escapeHtmlForm2text" ); + + form.validate( { + escapeHtml: true, + messages: { + escapeHtmlForm2text: { + required: "" + } + } + } ); + + assert.ok( !field.valid() ); + assert.hasError( field, "required" ); + + var label = form.find( "label" ); + assert.equal( label.length, 1 ); + assert.equal( label.html(), "<script>console.log('!!!');</script>" ); + + label.html( "" ); + assert.ok( !field.valid() ); + assert.equal( label.html(), "<script>console.log('!!!');</script>" ); + + field.val( "foo" ); + assert.ok( field.valid() ); + assert.noErrorFor( field ); +} ); diff --git a/test/index.html b/test/index.html index f27ad1d76..601f6a505 100644 --- a/test/index.html +++ b/test/index.html @@ -467,6 +467,12 @@

+
+ +
+
+ +
From 716cdc92d11ed38525f99f47e07023e10ee6f4b4 Mon Sep 17 00:00:00 2001 From: Kieran Date: Wed, 14 Jun 2023 23:48:02 +0100 Subject: [PATCH 18/38] Update 01_bug_report.md --- .github/ISSUE_TEMPLATE/01_bug_report.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/01_bug_report.md b/.github/ISSUE_TEMPLATE/01_bug_report.md index 856a1af54..9087c0176 100644 --- a/.github/ISSUE_TEMPLATE/01_bug_report.md +++ b/.github/ISSUE_TEMPLATE/01_bug_report.md @@ -1,7 +1,7 @@ --- name: Bug report about: Report something that's broken. Please ensure that you're using the latest version. -labels: Bug +labels: ["Bug", "Status: Unverified"] --- From 935280706c0cf390ff47f5e2efdea9566de860c2 Mon Sep 17 00:00:00 2001 From: Kieran Date: Wed, 14 Jun 2023 23:49:59 +0100 Subject: [PATCH 19/38] Update stale.yml --- .github/workflows/stale.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index eebce5aeb..3e3c347e7 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -22,10 +22,7 @@ jobs: with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: > - This issue/proposal has been automatically marked as idle and stale because it hasn't - had any recent activity. It will be automatically closed if no further activity - occurs. If you think this is wrong, or the problem still persists, just pop - a reply in the comments and one of the maintainers will (try!) to follow up. + This issue lacks verification. Please provide a reproduction link. Thank you for contributing :) stale-pr-message: > @@ -38,5 +35,5 @@ jobs: stale-issue-label: 'stale' stale-pr-label: 'stale' exempt-all-milestones: true - exempt-issue-labels: 'bug, help wanted' + exempt-issue-labels: 'Status: Verified' exempt-pr-labels: 'MERGE ME, NEEDS REVIEW' From fa8d211a3e336af3256962fda99841ed1cb125ef Mon Sep 17 00:00:00 2001 From: Kieran Date: Thu, 17 Aug 2023 12:36:48 +0100 Subject: [PATCH 20/38] Update 01_bug_report.md --- .github/ISSUE_TEMPLATE/01_bug_report.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/01_bug_report.md b/.github/ISSUE_TEMPLATE/01_bug_report.md index 9087c0176..e0a6968ea 100644 --- a/.github/ISSUE_TEMPLATE/01_bug_report.md +++ b/.github/ISSUE_TEMPLATE/01_bug_report.md @@ -1,7 +1,7 @@ --- name: Bug report about: Report something that's broken. Please ensure that you're using the latest version. -labels: ["Bug", "Status: Unverified"] +labels: ["Type: Bug", "Status: Unverified"] --- From 3cdcde80e49622bda27d18c84797ed5215aea764 Mon Sep 17 00:00:00 2001 From: Kieran Date: Thu, 17 Aug 2023 12:37:23 +0100 Subject: [PATCH 21/38] Update 02_feature_request.md --- .github/ISSUE_TEMPLATE/02_feature_request.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/02_feature_request.md b/.github/ISSUE_TEMPLATE/02_feature_request.md index 6d49cfb86..03feaaf61 100644 --- a/.github/ISSUE_TEMPLATE/02_feature_request.md +++ b/.github/ISSUE_TEMPLATE/02_feature_request.md @@ -1,7 +1,7 @@ --- name: Feature request about: Wouldn't it be nice if jquery-validate could ... -labels: Feature +labels: ["Type: Feature"] --- From bb5ec97ac32de4265fb794527efcb5693adba267 Mon Sep 17 00:00:00 2001 From: EricDunsworth <1907279+EricDunsworth@users.noreply.github.com> Date: Thu, 17 Aug 2023 10:48:44 -0400 Subject: [PATCH 22/38] Localization: Add French currency translation (#2471) --- src/localization/messages_fr.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/localization/messages_fr.js b/src/localization/messages_fr.js index 97192b971..dc23300ad 100644 --- a/src/localization/messages_fr.js +++ b/src/localization/messages_fr.js @@ -41,6 +41,7 @@ $.extend( $.validator.messages, { email2: "Veuillez fournir une adresse électronique valide.", url2: "Veuillez fournir une adresse URL valide.", creditcardtypes: "Veuillez fournir un numéro de carte de crédit valide.", + currency: "Veuillez fournir une monnaie valide.", ipv4: "Veuillez fournir une adresse IP v4 valide.", ipv6: "Veuillez fournir une adresse IP v6 valide.", require_from_group: $.validator.format( "Veuillez fournir au moins {0} de ces champs." ), From 7ba6372c04705a8b90101deec1b0561f12a02518 Mon Sep 17 00:00:00 2001 From: EricDunsworth <1907279+EricDunsworth@users.noreply.github.com> Date: Fri, 25 Aug 2023 05:27:11 -0400 Subject: [PATCH 23/38] Localization: Rename message_hi.js to messages_hindi.js (#2470) This makes it consistent with other i18n file names (which are all written in plural). --- src/localization/{message_hi.js => messages_hi.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/localization/{message_hi.js => messages_hi.js} (100%) diff --git a/src/localization/message_hi.js b/src/localization/messages_hi.js similarity index 100% rename from src/localization/message_hi.js rename to src/localization/messages_hi.js From 2ecb6be81a0b2bb06434d1b5077ff3dcec5ea354 Mon Sep 17 00:00:00 2001 From: bytestream Date: Mon, 9 Oct 2023 23:47:29 +0100 Subject: [PATCH 24/38] Update version 1.20.0-pre --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2cc35a6bc..9f2d81a0c 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "jquery-validation", "title": "jQuery Validation Plugin", "description": "Client-side form validation made easy", - "version": "1.19.6-pre", + "version": "1.20.0-pre", "homepage": "https://jqueryvalidation.org/", "license": "MIT", "author": { From 99772f23f28d3e752f30c95ab0e2c6c22bce4441 Mon Sep 17 00:00:00 2001 From: bytestream Date: Mon, 9 Oct 2023 23:56:40 +0100 Subject: [PATCH 25/38] Update generateArtifacts command in build/release.js --- build/release.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/release.js b/build/release.js index 504658cf1..a71ffeeda 100644 --- a/build/release.js +++ b/build/release.js @@ -38,7 +38,7 @@ Release.define({ }, generateArtifacts: function( done ) { - Release.exec( "grunt release", "Grunt command failed" ); + Release.exec( "npx grunt release", "Grunt command failed" ); // Keep this list of files in sync with package.json's files key done([ "dist/localization/", From a354e8ac2546e859acc5cec5391a8767df306313 Mon Sep 17 00:00:00 2001 From: bytestream Date: Tue, 10 Oct 2023 00:15:15 +0100 Subject: [PATCH 26/38] Build: Updating the master version to 1.20.1-pre. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9f2d81a0c..f1a027aa7 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "jquery-validation", "title": "jQuery Validation Plugin", "description": "Client-side form validation made easy", - "version": "1.20.0-pre", + "version": "1.20.1-pre", "homepage": "https://jqueryvalidation.org/", "license": "MIT", "author": { From 672a3601d71efa7b8089c365447b1999e521c5fb Mon Sep 17 00:00:00 2001 From: bytestream Date: Tue, 10 Oct 2023 00:27:38 +0100 Subject: [PATCH 27/38] Chore: update changelog.md --- changelog.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/changelog.md b/changelog.md index 6bbbd5ccb..4680381ae 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,23 @@ +1.20.0 / 2023-10-10 +=================== + +## Additional + * Fixed vinUS validation failing on valid vin numbers [#2460](https://github.com/jquery-validation/jquery-validation/pull/2460) + +## Core + * Fixed race condition in remote validation rules [#2435](https://github.com/jquery-validation/jquery-validation/pull/2435) + * Removed pending class from fields with an aborted request [#2436](https://github.com/jquery-validation/jquery-validation/pull/2436) + * Fixed remote validation error tracking [#2242](https://github.com/jquery-validation/jquery-validation/pull/2242) + * Added escapeHtml option to avoid XSS attacks via showLabel method [#2462](https://github.com/jquery-validation/jquery-validation/pull/2462) + +## Demo + * Fixed minlength validation in ajaxSubmit-integration-demo.html [#2454](https://github.com/jquery-validation/jquery-validation/pull/2454) + +## Localisation + * Improved required translation in pt_BR [#2445](https://github.com/jquery-validation/jquery-validation/pull/2445) + * Added Hindi translation [#2453](https://github.com/jquery-validation/jquery-validation/pull/2453) + * Added French currency translation [#2471](https://github.com/jquery-validation/jquery-validation/pull/2471) + 1.19.5 / 2022-07-01 =================== From 0c811ce17c075bbfb14c6fc8daf02e383eae1ef4 Mon Sep 17 00:00:00 2001 From: Mohamed Baddi Date: Wed, 20 Mar 2024 13:06:54 +0000 Subject: [PATCH 28/38] Localization: Update Arabic translations (#2485) * feat: update arabic messages translations * psr: coding style * wip: coding style --- src/localization/messages_ar.js | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/localization/messages_ar.js b/src/localization/messages_ar.js index dad165e58..d6e1433b1 100644 --- a/src/localization/messages_ar.js +++ b/src/localization/messages_ar.js @@ -19,5 +19,34 @@ $.extend( $.validator.messages, { rangelength: $.validator.format( "عدد الحروف يجب أن يكون بين {0} و {1}" ), range: $.validator.format( "رجاء إدخال عدد قيمته بين {0} و {1}" ), max: $.validator.format( "رجاء إدخال عدد أقل من أو يساوي {0}" ), - min: $.validator.format( "رجاء إدخال عدد أكبر من أو يساوي {0}" ) + min: $.validator.format( "رجاء إدخال عدد أكبر من أو يساوي {0}" ), + step: $.validator.format( "يرجى تقديم قيمة من مضاعفات {0}" ), + maxWords: $.validator.format( "يرجى تقديم ما لا يزيد عن {0} كلمات" ), + minWords: $.validator.format( "يرجى تقديم {0} كلمات على الأقل" ), + rangeWords: $.validator.format( "يرجى تقديم ما بين {0} و{1} كلمة" ), + letterswithbasicpunc: "يرجى تقديم الحروف وعلامات الترقيم فقط", + alphanumeric: "يرجى تقديم الحروف والأرقام والمسافات والتسطير فقط", + lettersonly: "يرجى تقديم الحروف فقط", + nowhitespace: "من فضلك لا تدخل المساحات البيضاء", + ziprange: "يرجى تقديم الرمز البريدي بين 902xx-xxxx و905-xx-xxxx", + integer: "يرجى تقديم رقم غير عشري موجب أو سالب", + vinUS: "يرجى تقديم رقم تعريف المركبة (VIN)", + dateITA: "يرجى تقديم تاريخ صالح", + time: "يرجى تقديم وقت صالح بين 00:00 و23:59", + phoneUS: "الرجاء تقديم رقم هاتف صالح", + phoneUK: "الرجاء تقديم رقم هاتف صالح", + mobileUK: "يرجى تقديم رقم هاتف محمول صالح", + strippedminlength: $.validator.format( "يرجى تقديم {0} حرفًا على الأقل" ), + email2: "يرجى تقديم عنوان بريد إلكتروني صالح", + url2: "يرجى إدخال عنوان بريد إلكتروني صحيح", + creditcardtypes: "يرجى تقديم رقم بطاقة ائتمان صالح", + currency: "يرجى تقديم عملة صالحة", + ipv4: "يرجى تقديم عنوان IP v4 صالح", + ipv6: "يرجى تقديم عنوان IP v6 صالح", + require_from_group: $.validator.format( "يرجى تقديم ما لا يقل عن {0} من هذه الحقول" ), + nifES: "يرجى تقديم رقم TIN صالح", + nieES: "يرجى تقديم رقم NIE صالح", + cifES: "يرجى تقديم رقم CIF صالح", + postalCodeCA: "يرجى تقديم رمز بريدي صالح", + pattern: "التنسيق غير صالح" } ); From 569e62234c321f4da30015f516f09c367c09a804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sylvain=20Monn=C3=A9?= Date: Sun, 21 Apr 2024 10:59:31 +0200 Subject: [PATCH 29/38] Core: fix remote validation when input is the same as in aborted request (#2481) Fixes #2479 --- src/core.js | 3 ++- test/methods.js | 38 +++++++++++++++++++++++++++++++++++++- test/test.js | 10 ++++++++++ 3 files changed, 49 insertions(+), 2 deletions(-) diff --git a/src/core.js b/src/core.js index ab891487b..426b2551a 100644 --- a/src/core.js +++ b/src/core.js @@ -1594,11 +1594,12 @@ $.extend( $.validator, { param = typeof param === "string" && { url: param } || param; optionDataString = $.param( $.extend( { data: value }, param.data ) ); - if ( previous.old === optionDataString ) { + if ( previous.valid !== null && previous.old === optionDataString ) { return previous.valid; } previous.old = optionDataString; + previous.valid = null; validator = this; this.startRequest( element ); data = {}; diff --git a/test/methods.js b/test/methods.js index a65e4b474..b2644f59d 100644 --- a/test/methods.js +++ b/test/methods.js @@ -623,7 +623,7 @@ QUnit.test( "remote, data previous querystring", function( assert ) { rules: { lastname: { remote: { - url: "users.php", + url: "users3.php", type: "POST", data: { firstname: function() { @@ -839,6 +839,42 @@ QUnit.test( "Fix #2434: race condition in remote validation rules", function( as } ); } ); +QUnit.test( "Fix #2479: Remote validation fails when input is the same as in aborted request", function( assert ) { + var e = $( "#username" ), + done1 = assert.async(), + v = $( "#userForm" ).validate( { + rules: { + username: { + remote: { + url: "users.php" + } + } + }, + messages: { + username: { + remote: $.validator.format( "{0} in use" ) + } + } + } ); + + e.val( "Peter" ); + v.element( e ); + assert.equal( e.hasClass( "error" ), false, "Field 'username' should not have the error class" ); + assert.equal( e.hasClass( "pending" ), true, "field 'username' should have the pending class" ); + + e.val( "Peter" ); + v.element( e ); + assert.equal( e.hasClass( "error" ), false, "Field 'username' should not have the error class" ); + assert.equal( e.hasClass( "pending" ), true, "field 'username' should have the pending class" ); + + setTimeout( function() { + assert.equal( v.errorList[ 0 ].message, "Peter in use" ); + assert.equal( e.hasClass( "error" ), true, "Field 'username' should have the error class" ); + assert.equal( e.hasClass( "pending" ), false, "field 'username' should not have the pending class" ); + done1(); + } ); +} ); + QUnit.module( "additional methods" ); QUnit.test( "phone (us)", function( assert ) { diff --git a/test/test.js b/test/test.js index 02462c933..c6f123f69 100644 --- a/test/test.js +++ b/test/test.js @@ -31,6 +31,16 @@ $.mockjax( { responseTime: 1 } ); +$.mockjax( { + url: "users3.php", + data: { + lastname: "last-name" + }, + responseText: "false", + responseStatus: 200, + responseTime: 1 +} ); + $.mockjax( { url: "echo.php", response: function( data ) { From 21951645948cebea491e6b1882b41576fe44e333 Mon Sep 17 00:00:00 2001 From: Kieran Brahney Date: Thu, 13 Jun 2024 14:28:14 +0100 Subject: [PATCH 30/38] Build: Updating the master version to 1.20.2-pre. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f1a027aa7..dfe9a5322 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "jquery-validation", "title": "jQuery Validation Plugin", "description": "Client-side form validation made easy", - "version": "1.20.1-pre", + "version": "1.20.2-pre", "homepage": "https://jqueryvalidation.org/", "license": "MIT", "author": { From 0f8400fc55c801b4201ce41290b2aae21e2b20ec Mon Sep 17 00:00:00 2001 From: Kieran Brahney Date: Thu, 13 Jun 2024 14:37:54 +0100 Subject: [PATCH 31/38] Chore: update changelog --- changelog.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/changelog.md b/changelog.md index 4680381ae..65b392ff8 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,12 @@ +1.20.1 / 2024-06-13 +=================== + +## Core + * Fix remote validation when input is the same as in aborted request [#2481](https://github.com/jquery-validation/jquery-validation/pull/2481) + +## Localisation + * Update Arabic translations [#2485](https://github.com/jquery-validation/jquery-validation/pull/2485) + 1.20.0 / 2023-10-10 =================== From 75f51237e422360e53c5c23ad8da307223fe0b8a Mon Sep 17 00:00:00 2001 From: Daniel Hobi Date: Fri, 28 Jun 2024 17:10:19 +0200 Subject: [PATCH 32/38] Core: Add support for Web Components (#2493) Co-authored-by: Daniel Hobi --- .jscsrc | 5 ++++- .jshintignore | 1 + Gruntfile.js | 12 +++++++++++- package.json | 2 +- src/core.js | 20 +++++++++++--------- test/custom-elements.js | 17 +++++++++++++++++ test/index.html | 4 ++++ test/test.js | 21 +++++++++++++++++++++ 8 files changed, 70 insertions(+), 12 deletions(-) create mode 100644 test/custom-elements.js diff --git a/.jscsrc b/.jscsrc index d50b36c38..018d8ca09 100644 --- a/.jscsrc +++ b/.jscsrc @@ -1,5 +1,8 @@ { "preset": "jquery", "maximumLineLength": null, - "requireCamelCaseOrUpperCaseIdentifiers": null + "requireCamelCaseOrUpperCaseIdentifiers": null, + "excludeFiles": [ + "test/custom-elements.js" + ] } diff --git a/.jshintignore b/.jshintignore index ffdbea7be..420537ee7 100644 --- a/.jshintignore +++ b/.jshintignore @@ -4,3 +4,4 @@ test/qunit/ dist/ demo/ *.min.js +test/custom-elements.js diff --git a/Gruntfile.js b/Gruntfile.js index 18cd73e33..2f4e3ea6c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -115,7 +115,17 @@ grunt.initConfig( { } }, qunit: { - files: "test/index.html" + files: "test/index.html", + options: { + puppeteer: { + args: [ + "--headless", + "--disable-web-security", + "--allow-file-access-from-files" + ] + }, + timeout: 10000 + } }, jshint: { options: { diff --git a/package.json b/package.json index dfe9a5322..26c433102 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "grunt-contrib-concat": "1.0.1", "grunt-contrib-copy": "1.0.0", "grunt-contrib-jshint": "1.0.0", - "grunt-contrib-qunit": "1.2.0", + "grunt-contrib-qunit": "10.0.0", "grunt-contrib-uglify": "1.0.1", "grunt-contrib-watch": "1.0.0", "grunt-jscs": "2.8.0", diff --git a/src/core.js b/src/core.js index 426b2551a..1b8bf875f 100644 --- a/src/core.js +++ b/src/core.js @@ -275,6 +275,7 @@ $.extend( $.validator, { onsubmit: true, ignore: ":hidden", ignoreTitle: false, + customElements: [], onfocusin: function( element ) { this.lastActive = element; @@ -422,17 +423,17 @@ $.extend( $.validator, { settings[ eventType ].call( validator, this, event ); } } - + var focusListeners = [ ":text", "[type='password']", "[type='file']", "select", "textarea", "[type='number']", "[type='search']", + "[type='tel']", "[type='url']", "[type='email']", "[type='datetime']", "[type='date']", "[type='month']", + "[type='week']", "[type='time']", "[type='datetime-local']", "[type='range']", "[type='color']", + "[type='radio']", "[type='checkbox']", "[contenteditable]", "[type='button']" ]; + var clickListeners = [ "select", "option", "[type='radio']", "[type='checkbox']" ]; $( this.currentForm ) - .on( "focusin.validate focusout.validate keyup.validate", - ":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], " + - "[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], " + - "[type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], " + - "[type='radio'], [type='checkbox'], [contenteditable], [type='button']", delegate ) + .on( "focusin.validate focusout.validate keyup.validate", focusListeners.concat( this.settings.customElements ).join( ", " ), delegate ) // Support: Chrome, oldIE // "select" is provided as event.target when clicking a option - .on( "click.validate", "select, option, [type='radio'], [type='checkbox']", delegate ); + .on( "click.validate", clickListeners.concat( this.settings.customElements ).join( ", " ), delegate ); if ( this.settings.invalidHandler ) { $( this.currentForm ).on( "invalid-form.validate", this.settings.invalidHandler ); @@ -629,11 +630,12 @@ $.extend( $.validator, { elements: function() { var validator = this, - rulesCache = {}; + rulesCache = {}, + selectors = [ "input", "select", "textarea", "[contenteditable]" ]; // Select all valid inputs inside the form (no submit or reset buttons) return $( this.currentForm ) - .find( "input, select, textarea, [contenteditable]" ) + .find( selectors.concat( this.settings.customElements ).join( ", " ) ) .not( ":submit, :reset, :image, :disabled" ) .not( this.settings.ignore ) .filter( function() { diff --git a/test/custom-elements.js b/test/custom-elements.js new file mode 100644 index 000000000..7a4afc327 --- /dev/null +++ b/test/custom-elements.js @@ -0,0 +1,17 @@ +class CustomTextElement extends HTMLElement { + static formAssociated = true; + static observedAttributes = ["name", "id"]; + + constructor() { + super(); + this.internals_ = this.attachInternals(); + } + get form() { + return this.internals_ != null ? this.internals_.form : null; + } + get name() { + return this.getAttribute("name"); + } +} + +window.customElements.define("custom-text", CustomTextElement); diff --git a/test/index.html b/test/index.html index 601f6a505..e23e52dfc 100644 --- a/test/index.html +++ b/test/index.html @@ -11,6 +11,7 @@ + @@ -472,6 +473,9 @@

+
+
+ diff --git a/test/test.js b/test/test.js index c6f123f69..f9fbd4bdc 100644 --- a/test/test.js +++ b/test/test.js @@ -2786,3 +2786,24 @@ QUnit.test( "stopRequest() should submit the form once pendingRequests === 0", f // Submit the form $( button ).click(); } ); + +QUnit.test( "Assign rules to customElement via .validate() method", function( assert ) { + var form = $( "#customElementsForm" ); + var v = form.validate( { + customElements: [ "custom-text" ], + rules: { + customTextElement: { + required: true + } + } + } ); + var customTextElementRules = $( "#customTextElement", form ).rules(); + var expectedRules = { required: true }; + + assert.deepEqual( + customTextElementRules, expectedRules, "The rules should be the same" + ); + + v.form(); + assert.equal( v.numberOfInvalids(), 1, "The form has one error" ); +} ); From e837cc49beec2b17f7e18eaa3e1e9676e14c3133 Mon Sep 17 00:00:00 2001 From: Christopher Stieg Date: Sat, 29 Jun 2024 06:11:15 -0400 Subject: [PATCH 33/38] Core: Allow negative decimal with no 0 (#2483) * Core: Allow negative decimal with no 0 * Update regex --------- Co-authored-by: METALCOMPINC\cstieg Co-authored-by: Kieran --- src/core.js | 2 +- test/methods.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core.js b/src/core.js index 1b8bf875f..240e2737b 100644 --- a/src/core.js +++ b/src/core.js @@ -1485,7 +1485,7 @@ $.extend( $.validator, { // https://jqueryvalidation.org/number-method/ number: function( value, element ) { - return this.optional( element ) || /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test( value ); + return this.optional( element ) || /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:-?\.\d+)?$/.test( value ); }, // https://jqueryvalidation.org/digits-method/ diff --git a/test/methods.js b/test/methods.js index b2644f59d..e0d02eef2 100644 --- a/test/methods.js +++ b/test/methods.js @@ -177,6 +177,7 @@ QUnit.test( "number", function( assert ) { assert.ok( method( "123,000.00" ), "Valid decimal" ); assert.ok( method( "-123,000.00" ), "Valid decimal" ); assert.ok( method( ".100" ), "Valid decimal" ); + assert.ok( method( "-.100" ), "Valid decimal" ); assert.ok( !method( "1230,000.00" ), "Invalid decimal" ); assert.ok( !method( "123.0.0,0" ), "Invalid decimal" ); assert.ok( !method( "x123" ), "Invalid decimal" ); From 09f67cbf770d2b83982859950565b4b5eb377389 Mon Sep 17 00:00:00 2001 From: Kieran Date: Wed, 17 Jul 2024 10:18:39 +0100 Subject: [PATCH 34/38] Update package version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 26c433102..e4ee566df 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "jquery-validation", "title": "jQuery Validation Plugin", "description": "Client-side form validation made easy", - "version": "1.20.2-pre", + "version": "1.21.0-pre", "homepage": "https://jqueryvalidation.org/", "license": "MIT", "author": { From bd54405de2c0c820d7903f625a54b157e707f75e Mon Sep 17 00:00:00 2001 From: Kieran Brahney Date: Wed, 17 Jul 2024 10:45:25 +0100 Subject: [PATCH 35/38] Build: Updating the master version to 1.21.1-pre. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e4ee566df..7fd85ca91 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "jquery-validation", "title": "jQuery Validation Plugin", "description": "Client-side form validation made easy", - "version": "1.21.0-pre", + "version": "1.21.1-pre", "homepage": "https://jqueryvalidation.org/", "license": "MIT", "author": { From 6cd68f68e395b1c3a2588e6e7d64f561410c2dc0 Mon Sep 17 00:00:00 2001 From: Kieran Date: Mon, 16 Dec 2024 19:10:59 +0000 Subject: [PATCH 36/38] Update stale.yml --- .github/workflows/stale.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 3e3c347e7..6332ce773 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -35,5 +35,5 @@ jobs: stale-issue-label: 'stale' stale-pr-label: 'stale' exempt-all-milestones: true - exempt-issue-labels: 'Status: Verified' + exempt-issue-labels: 'Status: Verified, Type: Feature' exempt-pr-labels: 'MERGE ME, NEEDS REVIEW' From 07d2594c8201863ea03d901551fb0f17cf11b3c7 Mon Sep 17 00:00:00 2001 From: Kieran Date: Thu, 12 Jun 2025 11:20:12 +0100 Subject: [PATCH 37/38] Chore: downgrade ubuntu (#2518) --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb9551a9c..7b3883f6f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ on: jobs: linux_tests: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 From 707623a5cede70bdce8a911c2925f7786911e97d Mon Sep 17 00:00:00 2001 From: appel <61596+appel@users.noreply.github.com> Date: Thu, 12 Jun 2025 06:22:47 -0400 Subject: [PATCH 38/38] Localization: Additional string translations for messages_nl.js (#2517) * Update messages_nl.js Additional string translations (on par with DE). * Fixes styling issue. Added missing spaces inside the parentheses of $.validator.format() calls. --- src/localization/messages_nl.js | 42 ++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/src/localization/messages_nl.js b/src/localization/messages_nl.js index 2d6a6970e..abee59f9e 100644 --- a/src/localization/messages_nl.js +++ b/src/localization/messages_nl.js @@ -30,5 +30,45 @@ $.extend( $.validator.messages, { postalcodeNL: "Vul hier een geldige postcode in.", bankaccountNL: "Vul hier een geldig bankrekeningnummer in.", giroaccountNL: "Vul hier een geldig gironummer in.", - bankorgiroaccountNL: "Vul hier een geldig bank- of gironummer in." + bankorgiroaccountNL: "Vul hier een geldig bank- of gironummer in.", + + maxWords: $.validator.format( "Vul hier maximaal {0} woorden in." ), + minWords: $.validator.format( "Vul hier minimaal {0} woorden in." ), + rangeWords: $.validator.format( "Vul hier tussen {0} en {1} woorden in." ), + accept: "Vul hier een waarde in met een geldig MIME-type.", + alphanumeric: "Vul hier alleen letters, cijfers of underscores in.", + bic: "Vul hier een geldige BIC-code in.", + creditcardtypes: "Vul hier een geldig creditcardnummer in.", + currency: "Vul hier een geldige valuta in.", + integer: "Vul hier een geheel getal in.", + ipv4: "Vul hier een geldig IPv4-adres in.", + ipv6: "Vul hier een geldig IPv6-adres in.", + lettersonly: "Vul hier alleen letters in.", + letterswithbasicpunc: "Vul hier alleen letters of leestekens in.", + netmask: "Vul hier een geldig netmasker in.", + notEqualTo: "Vul hier een andere waarde in. De waarden mogen niet gelijk zijn.", + nowhitespace: "Spaties zijn niet toegestaan.", + pattern: "Ongeldig formaat.", + require_from_group: $.validator.format( "Vul minimaal {0} van deze velden in." ), + skip_or_fill_minimum: $.validator.format( "Sla deze velden over of vul er minimaal {0} van in." ), + strippedminlength: $.validator.format( "Vul hier minimaal {0} tekens in." ), + time: "Vul hier een geldige tijd in tussen 00:00 en 23:59.", + time12h: "Vul hier een geldige tijd in (12-uursnotatie).", + cifES: "Vul hier een geldig CIF-nummer in.", + cpfBR: "Vul hier een geldig CPF-nummer in.", + mobileUK: "Vul hier een geldig Brits mobiel nummer in.", + nieES: "Vul hier een geldig NIE-nummer in.", + nifES: "Vul hier een geldig NIF-nummer in.", + nipPL: "Vul hier een geldig NIP-nummer in.", + phonesUK: "Vul hier een geldig Brits telefoonnummer in.", + phoneUK: "Vul hier een geldig Brits telefoonnummer in.", + phoneUS: "Vul hier een geldig Amerikaans telefoonnummer in.", + postalcodeBR: "Vul hier een geldige Braziliaanse postcode in.", + postalCodeCA: "Vul hier een geldige Canadese postcode in.", + postalcodeIT: "Vul hier een geldige Italiaanse postcode in.", + postcodeUK: "Vul hier een geldige Britse postcode in.", + stateUS: "Vul hier een geldige Amerikaanse staat in.", + vinUS: "Het opgegeven voertuigidentificatienummer (VIN) is ongeldig.", + zipcodeUS: "De opgegeven Amerikaanse postcode is ongeldig.", + ziprange: "Uw postcode moet binnen het bereik 902xx-xxxx tot 905xx-xxxx liggen." } );