From d9840a5e61ddb7bedf017716ab14c7cf5f2ef9f2 Mon Sep 17 00:00:00 2001
From: Markus Staab
Date: Wed, 28 Nov 2018 19:27:18 +0100
Subject: [PATCH 01/67] Build: Updating the master version to 1.19.1-pre.
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index fa5835e3b..1393208bb 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.0-pre",
+ "version": "1.19.1-pre",
"homepage": "https://jqueryvalidation.org/",
"license": "MIT",
"author": {
From d1c73fe289d7d8f19c5b0ee91ece9b25a0949a6c Mon Sep 17 00:00:00 2001
From: Ryan Chang
Date: Fri, 14 Dec 2018 03:43:54 +0800
Subject: [PATCH 02/67] Localization: Add zh_TW translation for step message
(#2245)
---
src/localization/messages_zh_TW.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/localization/messages_zh_TW.js b/src/localization/messages_zh_TW.js
index f6d46c235..638a5452e 100644
--- a/src/localization/messages_zh_TW.js
+++ b/src/localization/messages_zh_TW.js
@@ -19,6 +19,7 @@ $.extend( $.validator.messages, {
minlength: $.validator.format( "最少 {0} 個字" ),
rangelength: $.validator.format( "請輸入長度為 {0} 至 {1} 之間的字串" ),
range: $.validator.format( "請輸入 {0} 至 {1} 之間的數值" ),
+ step: $.validator.format( "請輸入 {0} 的整數倍值" ),
max: $.validator.format( "請輸入不大於 {0} 的數值" ),
min: $.validator.format( "請輸入不小於 {0} 的數值" )
} );
From a9c20ec280ce3a968abbca5611dcd63f412b5d34 Mon Sep 17 00:00:00 2001
From: Stephen Scott
Date: Thu, 13 Dec 2018 19:46:59 +0000
Subject: [PATCH 03/67] Core: change focus() to trigger("focus") (#2243)
Change focus() to trigger("focus") so that jQuery Migrate 3.x doesn't flag it as deprecated.
---
src/core.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core.js b/src/core.js
index 08352d41c..ccb8d4cbe 100644
--- a/src/core.js
+++ b/src/core.js
@@ -602,7 +602,7 @@ $.extend( $.validator, {
try {
$( this.findLastActive() || this.errorList.length && this.errorList[ 0 ].element || [] )
.filter( ":visible" )
- .focus()
+ .trigger( "focus" )
// Manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find
.trigger( "focusin" );
From 824c9897b28f42a5dabc735a11f03c02cd5446cb Mon Sep 17 00:00:00 2001
From: Dusan Orlovic
Date: Sun, 20 Jan 2019 22:28:06 +0100
Subject: [PATCH 04/67] Localization: Adding Serbian translation for step
method message (#2251)
---
src/localization/messages_sr.js | 3 ++-
src/localization/messages_sr_lat.js | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/localization/messages_sr.js b/src/localization/messages_sr.js
index 7cdd4297c..d6f9bec61 100644
--- a/src/localization/messages_sr.js
+++ b/src/localization/messages_sr.js
@@ -19,5 +19,6 @@ $.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}." )
} );
diff --git a/src/localization/messages_sr_lat.js b/src/localization/messages_sr_lat.js
index f12bfb5e6..43666f98d 100644
--- a/src/localization/messages_sr_lat.js
+++ b/src/localization/messages_sr_lat.js
@@ -19,5 +19,6 @@ $.extend( $.validator.messages, {
rangelength: $.validator.format( "Unesite vrednost dugačku između {0} i {1} karaktera." ),
range: $.validator.format( "Unesite vrednost između {0} i {1}." ),
max: $.validator.format( "Unesite vrednost manju ili jednaku {0}." ),
- min: $.validator.format( "Unesite vrednost veću ili jednaku {0}." )
+ min: $.validator.format( "Unesite vrednost veću ili jednaku {0}." ),
+ step: $.validator.format( "Unesite vrednost koja je umnožak broja {0}." )
} );
From 01ca87912d5e73eb15e285037fd46bdc023a5618 Mon Sep 17 00:00:00 2001
From: Ahmed Gaber
Date: Sat, 26 Jan 2019 16:42:09 +0200
Subject: [PATCH 05/67] Build: Set jQuery as a peer dependency (#2248)
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 1393208bb..3ad550d54 100644
--- a/package.json
+++ b/package.json
@@ -35,7 +35,7 @@
"dist/jquery.validate.min.js"
],
"main": "dist/jquery.validate.js",
- "dependencies": {
+ "peerDependencies": {
"jquery": "^1.7 || ^2.0 || ^3.1"
},
"devDependencies": {
From 05e35ea40d8053ea93038dae8a867c3ec685b5d2 Mon Sep 17 00:00:00 2001
From: Markus Staab
Date: Sat, 15 Jun 2019 08:26:58 +0200
Subject: [PATCH 06/67] Build: Updating the master version to 1.19.2-pre.
---
changelog.md | 35 +++++++++++++++++++++++++++++++++++
package.json | 2 +-
2 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/changelog.md b/changelog.md
index b4f142f8c..4d3fdff3f 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,3 +1,38 @@
+1.19.1 / 2019-06-15
+===================
+
+## Core
+ * Change focus() to trigger("focus") (#2243)
+
+## Build
+ * Set jQuery as a peer dependency (#2248)
+
+## Localization
+ * Add zh_TW translation for step message (#2245)
+ * Adding Serbian translation for step method message (#2251)
+
+1.19.0 / 2018-11-28
+===================
+
+## Subresource Integrity hashes
+
+As of 1.18.0, we started to provide Subresource Integrity hashes of all distribution files.
+
+The hashes for the 1.19.0 release can be found in the file [`jquery-validation-sri.json`](https://raw.githubusercontent.com/jquery-validation/jquery-validation/1.19.0/dist/jquery-validation-sri.json) under `dist` folder.
+
+## Additional
+ * Don't fail when field is optional in CNPJBR & CPFBR rules (#2236)
+ * Add validation rule for mobile number of Russia Federation (#2207)
+ * Add Brazillian CNPJ validation rule (#2222)
+ * Add Brazillian CNH number (Carteira Nacional de Habilitacao) (#2234)
+ * Add ABA Routing Number Validation (#2216)
+
+## Core
+ * Fix contenteditable detection's regression introduced in #2142 (#2235)
+
+## Localization
+ * Add Swedish translation for pattern (#2227)
+
1.18.0 / 2018-09-09
===================
diff --git a/package.json b/package.json
index 3ad550d54..fdecee0fc 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.1-pre",
+ "version": "1.19.2-pre",
"homepage": "https://jqueryvalidation.org/",
"license": "MIT",
"author": {
From 5426dcbd8cef2f8a8fac834f7f9b68754b5a4185 Mon Sep 17 00:00:00 2001
From: Markus Staab
Date: Sat, 15 Jun 2019 08:40:07 +0200
Subject: [PATCH 07/67] chore: updated build docs (#2288)
---
build/release.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/build/release.js b/build/release.js
index a9576181f..7d78e7e61 100644
--- a/build/release.js
+++ b/build/release.js
@@ -1,9 +1,9 @@
/* Release checklist
- Run `git changelog` and edit to match previous output (this should make use of jquey-release instead)
- make sure the correct 'x.y.z-pre' version is defined in package.json
-- cd into your local https://github.com/jquery/jquery-release fork
-- pull latest https://github.com/jquery/jquery-release
-- disable _generateChangelog task in release.js (BOOOO)
+- `cd jquery-release` into your local https://github.com/jquery/jquery-release fork
+- `git pull` latest https://github.com/jquery/jquery-release
+- disable _generateChangelog task in release.js (BOOOO), by commenting this lines: https://github.com/jquery/jquery-release/blob/a9823df8a5dff4c96d1f6645b09daa591adc2f06/release.js#L43-L44
- run
node release.js --remote=jquery-validation/jquery-validation
- Wait a while, verify and confirm each step
From 25a0f146dc860e8de69d16cd95d0f5987f86e51c Mon Sep 17 00:00:00 2001
From: Markus Staab
Date: Sat, 15 Jun 2019 08:50:18 +0200
Subject: [PATCH 08/67] Create FUNDING.yml
---
.github/FUNDING.yml | 1 +
1 file changed, 1 insertion(+)
create mode 100644 .github/FUNDING.yml
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 000000000..978bc43f5
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1 @@
+github: [staabm, Arkni]
From d3748a2271223be1c23742dbf79dd918eb2158ee Mon Sep 17 00:00:00 2001
From: Brighton Balfrey
Date: Wed, 13 May 2020 13:47:44 -0700
Subject: [PATCH 09/67] Core: Fixes deprecated calls to jQuery trim (#2328)
Fixes #2327
Co-authored-by: Brighton Balfrey
---
src/core.js | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/core.js b/src/core.js
index ccb8d4cbe..b7b8f3b9b 100644
--- a/src/core.js
+++ b/src/core.js
@@ -198,18 +198,25 @@ $.extend( $.fn, {
}
} );
+// JQuery trim is deprecated, provide a trim method based on String.prototype.trim
+var trim = function( str ) {
+
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trim#Polyfill
+ return str.replace( /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "" );
+};
+
// Custom selectors
$.extend( $.expr.pseudos || $.expr[ ":" ], { // '|| $.expr[ ":" ]' here enables backwards compatibility to jQuery 1.7. Can be removed when dropping jQ 1.7.x support
// https://jqueryvalidation.org/blank-selector/
blank: function( a ) {
- return !$.trim( "" + $( a ).val() );
+ return !trim( "" + $( a ).val() );
},
// https://jqueryvalidation.org/filled-selector/
filled: function( a ) {
var val = $( a ).val();
- return val !== null && !!$.trim( "" + val );
+ return val !== null && !!trim( "" + val );
},
// https://jqueryvalidation.org/unchecked-selector/
From cd1ce52f794d86154917403c83d1ff83b829da4b Mon Sep 17 00:00:00 2001
From: Markus Staab
Date: Sat, 23 May 2020 10:32:41 +0200
Subject: [PATCH 10/67] Build: Updating the master version to 1.19.3-pre.
---
changelog.md | 6 ++++++
package.json | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/changelog.md b/changelog.md
index 4d3fdff3f..f36c5b70a 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,3 +1,9 @@
+1.19.2 / 2020-05-23
+===================
+
+## Core
+ * Core: Fixes deprecated calls to jQuery trim for compat with newer jQuery core versions (#2328)
+
1.19.1 / 2019-06-15
===================
diff --git a/package.json b/package.json
index fdecee0fc..3becbbc83 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.2-pre",
+ "version": "1.19.3-pre",
"homepage": "https://jqueryvalidation.org/",
"license": "MIT",
"author": {
From af445b30fc6bbe7431fd8677ddad1008b866bdda Mon Sep 17 00:00:00 2001
From: Markus Staab
Date: Sat, 23 May 2020 10:36:03 +0200
Subject: [PATCH 11/67] chore: added more release tasks
---
build/release.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/build/release.js b/build/release.js
index 7d78e7e61..a12d7c838 100644
--- a/build/release.js
+++ b/build/release.js
@@ -13,6 +13,7 @@
git fetch --tags upstream
git checkout tags/X.YY.Z
npm publish
+- double check NPM for new release https://www.npmjs.com/package/jquery-validation
- Update MS CDN (Ping Chris Sfanos)
- Check jsdelivr CDN: new git tags are automatically pulled, tested & merged via https://github.com/jsdelivr/jsdelivr/pulls
- Check cdnjs CDN: new git tags are automatically committed into https://github.com/cdnjs/cdnjs/commits/master or ping @cdnjs
From 79bed393e6f4bf6876d0e917baed7ef6447efe6a Mon Sep 17 00:00:00 2001
From: Kieran Brahney
Date: Tue, 23 Jun 2020 12:25:10 +0100
Subject: [PATCH 12/67] Core: Replaced deprecated jQuery functions
Replaced $.isArray and $.isFunction
---
src/core.js | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/core.js b/src/core.js
index b7b8f3b9b..4674710f4 100644
--- a/src/core.js
+++ b/src/core.js
@@ -1313,7 +1313,7 @@ $.extend( $.validator, {
// Evaluate parameters
$.each( rules, function( rule, parameter ) {
- rules[ rule ] = $.isFunction( parameter ) && rule !== "normalizer" ? parameter( element ) : parameter;
+ rules[ rule ] = typeof parameter === "function" && rule !== "normalizer" ? parameter( element ) : parameter;
} );
// Clean number parameters
@@ -1325,7 +1325,7 @@ $.extend( $.validator, {
$.each( [ "rangelength", "range" ], function() {
var parts;
if ( rules[ this ] ) {
- if ( $.isArray( rules[ this ] ) ) {
+ if ( Array.isArray( rules[ this ] ) ) {
rules[ this ] = [ Number( rules[ this ][ 0 ] ), Number( rules[ this ][ 1 ] ) ];
} else if ( typeof rules[ this ] === "string" ) {
parts = rules[ this ].replace( /[\[\]]/g, "" ).split( /[\s,]+/ );
@@ -1454,19 +1454,19 @@ $.extend( $.validator, {
// https://jqueryvalidation.org/minlength-method/
minlength: function( value, element, param ) {
- var length = $.isArray( value ) ? value.length : this.getLength( value, element );
+ var length = Array.isArray( value ) ? value.length : this.getLength( value, element );
return this.optional( element ) || length >= param;
},
// https://jqueryvalidation.org/maxlength-method/
maxlength: function( value, element, param ) {
- var length = $.isArray( value ) ? value.length : this.getLength( value, element );
+ var length = Array.isArray( value ) ? value.length : this.getLength( value, element );
return this.optional( element ) || length <= param;
},
// https://jqueryvalidation.org/rangelength-method/
rangelength: function( value, element, param ) {
- var length = $.isArray( value ) ? value.length : this.getLength( value, element );
+ var length = Array.isArray( value ) ? value.length : this.getLength( value, element );
return this.optional( element ) || ( length >= param[ 0 ] && length <= param[ 1 ] );
},
From b0e3b11324a542813adf9a93c432a31d818f7c80 Mon Sep 17 00:00:00 2001
From: Joe Watkins
Date: Tue, 18 Aug 2020 01:10:33 -0700
Subject: [PATCH 13/67] Add Accessibility section to Readme (#2149)
* Add accessibility section to readme - speaks to errorElement
* Add link to errorElement in doc
Co-authored-by: Joe Watkins
---
README.md | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/README.md b/README.md
index f02786c1c..bf109300a 100644
--- a/README.md
+++ b/README.md
@@ -73,6 +73,27 @@ $("#myForm").validate({
});
```
+## Accessibility
+For an invalid field, the default output for the jQuery Validation Plugin is an error message in a `
Password
-
+
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 45/67] 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 46/67] 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 47/67] 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 @@
+