From d69e003fb27905549bd40773ef279ad79aa8649f Mon Sep 17 00:00:00 2001 From: Abdullah Ibeid Date: Fri, 23 Sep 2016 16:39:35 +0300 Subject: [PATCH 1/4] Localization: fixed typo in arabien language file. the message is not appearing because {0} is written (0}. Closes #1868. --- .gitignore | 1 + package.json | 116 ++++++++++++++--------------- src/additional/nisBR.js | 59 +++++++++++++++ src/localization/messages_ar.js | 4 +- src/localization/messages_pt_BR.js | 3 +- test/methods.js | 13 ++++ 6 files changed, 135 insertions(+), 61 deletions(-) create mode 100644 src/additional/nisBR.js diff --git a/.gitignore b/.gitignore index de4d1f007..a284d1362 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ dist node_modules +.idea diff --git a/package.json b/package.json index 866149d42..e1bc130aa 100644 --- a/package.json +++ b/package.json @@ -1,60 +1,60 @@ { - "name": "jquery-validation", - "title": "jQuery Validation Plugin", - "description": "Client-side form validation made easy", - "version": "1.15.2-pre", - "homepage": "http://jqueryvalidation.org/", - "license": "MIT", - "author": { - "name": "Jörn Zaefferer", - "email": "joern.zaefferer@gmail.com", - "url": "http://bassistance.de" - }, - "repository": { - "type": "git", - "url": "git://github.com/jzaefferer/jquery-validation.git" - }, - "bugs": { - "url": "https://github.com/jzaefferer/jquery-validation/issues" - }, - "licenses": [ - { - "type": "MIT", - "url": "http://www.opensource.org/licenses/MIT" - } - ], - "scripts": { - "test": "grunt", - "prepublish": "grunt" - }, - "files": [ - "dist/localization/", - "dist/additional-methods.js", - "dist/jquery.validate.js" - ], - "main": "dist/jquery.validate.js", - "dependencies": { - "jquery": "^1.7 || ^2.0" - }, - "devDependencies": { - "commitplease": "2.3.1", - "grunt": "1.0.1", - "grunt-contrib-compress": "1.2.0", - "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-uglify": "1.0.1", - "grunt-contrib-watch": "1.0.0", - "grunt-jscs": "2.8.0", - "grunt-text-replace": "0.4.0", - "qunitjs": "2.0.0" - }, - "keywords": [ - "jquery", - "jquery-plugin", - "forms", - "validation", - "validate" - ] + "name": "jquery-validation", + "title": "jQuery Validation Plugin", + "description": "Client-side form validation made easy", + "version": "1.15.2-pre", + "homepage": "http://jqueryvalidation.org/", + "license": "MIT", + "author": { + "name": "Jörn Zaefferer", + "email": "joern.zaefferer@gmail.com", + "url": "http://bassistance.de" + }, + "repository": { + "type": "git", + "url": "git://github.com/jzaefferer/jquery-validation.git" + }, + "bugs": { + "url": "https://github.com/jzaefferer/jquery-validation/issues" + }, + "licenses": [ + { + "type": "MIT", + "url": "http://www.opensource.org/licenses/MIT" + } + ], + "scripts": { + "test": "grunt", + "prepublish": "grunt" + }, + "files": [ + "dist/localization/", + "dist/additional-methods.js", + "dist/jquery.validate.js" + ], + "main": "dist/jquery.validate.js", + "dependencies": { + "jquery": "^1.7 || ^2.0" + }, + "devDependencies": { + "commitplease": "2.3.1", + "grunt": "1.0.1", + "grunt-contrib-compress": "1.2.0", + "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-uglify": "^2.0.0", + "grunt-contrib-watch": "1.0.0", + "grunt-jscs": "2.8.0", + "grunt-text-replace": "0.4.0", + "qunitjs": "2.0.0" + }, + "keywords": [ + "jquery", + "jquery-plugin", + "forms", + "validation", + "validate" + ] } diff --git a/src/additional/nisBR.js b/src/additional/nisBR.js new file mode 100644 index 000000000..2614770fc --- /dev/null +++ b/src/additional/nisBR.js @@ -0,0 +1,59 @@ +/** + * Created for project jquery-validation. + * @Description Brazillian PIS or NIS number (Número de Identificação Social Pis ou Pasep) is the equivalent of a + * Brazilian tax registration number NIS of PIS numbers have 11 digits in total: 10 numbers followed + * by 1 check numbers that are being used for validation. + * @copyright (c) 25/10/2016 22:40, Cleiton da Silva Mendonça + * @author Cleiton da Silva Mendonça + * @link http://gitlab.com/csmendonca Gitlab of Cleiton da Silva Mendonça + * @link http://github.com/csmendonca Github of Cleiton da Silva Mendonça + */ + +$.validator.addMethod( "nisBR", function( value ) { + + var number; + var cn; + var sum = 0; + var dv; + var count; + var multiplier; + + // Removing special characters from value + value = value.replace( /([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g, "" ); + + // Checking value to have 11 digits only + if ( value.length !== 11 ) { + return false; + } + + //Get check number of value + cn = parseInt( value.substring( 10, 11 ), 10 ); + + //Get number with 10 digits of the value + number = parseInt( value.substring( 0, 10 ), 10 ); + + for ( count = 2; count < 12; count++ ) { + multiplier = count; + if ( count === 10 ) { + multiplier = 2; + } + if ( count === 11 ) { + multiplier = 3; + } + sum += ( ( number % 10 ) * multiplier ); + number = parseInt( number / 10, 10 ); + } + dv = ( sum % 11 ); + + if ( dv > 1 ) { + dv = ( 11 - dv ); + } else { + dv = 0; + } + + if ( cn === dv ) { + return true; + } else { + return false; + } +}, "Please specify a valid NIS/PIS number" ); diff --git a/src/localization/messages_ar.js b/src/localization/messages_ar.js index c7b5c2a87..dad165e58 100644 --- a/src/localization/messages_ar.js +++ b/src/localization/messages_ar.js @@ -18,6 +18,6 @@ $.extend( $.validator.messages, { minlength: $.validator.format( "الحد الأدنى لعدد الحروف هو {0}" ), rangelength: $.validator.format( "عدد الحروف يجب أن يكون بين {0} و {1}" ), range: $.validator.format( "رجاء إدخال عدد قيمته بين {0} و {1}" ), - max: $.validator.format( "رجاء إدخال عدد أقل من أو يساوي (0}" ), - min: $.validator.format( "رجاء إدخال عدد أكبر من أو يساوي (0}" ) + max: $.validator.format( "رجاء إدخال عدد أقل من أو يساوي {0}" ), + min: $.validator.format( "رجاء إدخال عدد أكبر من أو يساوي {0}" ) } ); diff --git a/src/localization/messages_pt_BR.js b/src/localization/messages_pt_BR.js index a7eeec10c..ef34b8095 100644 --- a/src/localization/messages_pt_BR.js +++ b/src/localization/messages_pt_BR.js @@ -71,5 +71,6 @@ $.extend( $.validator.messages, { vinUS: "O número de identificação de veículo informada (VIN) é inválido.", zipcodeUS: "Por favor, forneceça um código postal americano válido.", ziprange: "O código postal deve estar entre 902xx-xxxx e 905xx-xxxx", - cpfBR: "Por favor, forneça um CPF válido." + cpfBR: "Por favor, forneça um CPF válido.", + nisBR: "Por favor, forne$ccedil;a um NIS/PIS v$aacute;lido" } ); diff --git a/test/methods.js b/test/methods.js index 0c059f895..aaa55f56a 100644 --- a/test/methods.js +++ b/test/methods.js @@ -1537,3 +1537,16 @@ QUnit.test( "file accept - invalid mime type", function( assert ) { proxy = $.proxy( $.validator.methods.accept, new $.validator( {}, $form[ 0 ] ), null, input, "application/vnd.google-earth.kml+xml" ); assert.equal( proxy(), false, "the selected file for upload has invalid mime type" ); } ); + +QUnit.test( "nisBR", function( assert ) { + var method = methodTest( "nisBR" ); + assert.ok( method( "10757995753" ), "Valid NIS/PIS Number" ); + assert.ok( method( "107.57995.75-3" ), "Valid NIS/PIS Number" ); + assert.ok( method( "107.579.957-53" ), "Valid NIS/PIS Number" ); + assert.ok( method( "107-579-957-53" ), "Valid NIS/PIS Number" ); + assert.ok( method( "107.579.957.5-3" ), "Valid NIS/PIS Number" ); + assert.ok( !method( "99999999999" ), "Invalid NIS/PIS Number: dump data" ); + assert.ok( !method( "1075799575" ), "Invalid NIS/PIS Number: < 11 digits" ); + assert.ok( !method( "111444777355" ), "Invalid NIS/PIS Number: > 11 digits" ); + assert.ok( !method( "10757995752" ), "Invalid NIS/PIS Number: check number failed" ); +} ); From a4eb7368df675bc6571717264ce3627ce68d5364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cleiton=20da=20Silva=20Mendon=C3=A7a?= Date: Wed, 26 Oct 2016 00:18:11 -0300 Subject: [PATCH 2/4] Issue #1879: Alter description of method --- src/additional/nisBR.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/additional/nisBR.js b/src/additional/nisBR.js index 2614770fc..dabcc0cf2 100644 --- a/src/additional/nisBR.js +++ b/src/additional/nisBR.js @@ -1,8 +1,8 @@ /** * Created for project jquery-validation. * @Description Brazillian PIS or NIS number (Número de Identificação Social Pis ou Pasep) is the equivalent of a - * Brazilian tax registration number NIS of PIS numbers have 11 digits in total: 10 numbers followed - * by 1 check numbers that are being used for validation. + * Brazilian tax registration number NIS of PIS numbers have 11 digits in total: 10 numbers followed by 1 check numbers + * that are being used for validation. * @copyright (c) 25/10/2016 22:40, Cleiton da Silva Mendonça * @author Cleiton da Silva Mendonça * @link http://gitlab.com/csmendonca Gitlab of Cleiton da Silva Mendonça From 6daede91034526950a9c632da70d2118c7bb65be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cleiton=20da=20Silva=20Mendon=C3=A7a?= Date: Wed, 26 Oct 2016 01:10:16 -0300 Subject: [PATCH 3/4] Issue #1879: Alter message for user --- 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 ef34b8095..25c267652 100644 --- a/src/localization/messages_pt_BR.js +++ b/src/localization/messages_pt_BR.js @@ -72,5 +72,5 @@ $.extend( $.validator.messages, { zipcodeUS: "Por favor, forneceça um código postal americano válido.", 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$ccedil;a um NIS/PIS v$aacute;lido" + nisBR: "Por favor, forneça um NIS/PIS válido" } ); From e8887091121e9c9a4978deab37477f71a0a7a6a7 Mon Sep 17 00:00:00 2001 From: Cleiton da Silva Mendonca Date: Wed, 1 Aug 2018 04:05:02 +0100 Subject: [PATCH 4/4] Additional Methods: Inclusion new method nisBr (#1880) Fixes new implementation Fixes #1880 --- .github/ISSUE_TEMPLATE.md | 16 +- .github/PULL_REQUEST_TEMPLATE.md | 4 +- .github/stale.yml | 24 + .travis.yml | 2 +- CONTRIBUTING.md | 12 +- Gruntfile.js | 26 +- README.md | 40 +- bower.json | 4 +- build/release.js | 14 +- changelog.md | 75 +- demo/ajaxSubmit-integration-demo.html | 2 +- demo/bootstrap/index-bs4.html | 164 + demo/bootstrap/index.html | 2 +- demo/cinema/index.html | 4 +- demo/custom-messages-data-demo.html | 2 +- demo/custom-methods-demo.html | 2 +- demo/dynamic-totals.html | 2 +- demo/errorcontainer-demo.html | 2 +- demo/errors-within-labels.html | 2 +- demo/index.html | 2 +- demo/jquerymobile.html | 6 +- demo/milk/index.html | 2 +- demo/multipart/index.html | 2 +- demo/radio-checkbox-select-demo.html | 2 +- demo/requirejs/index.html | 4 +- demo/semantic-ui/index.html | 2 +- demo/themerollered.html | 4 +- lib/jquery-3.1.1.js | 10220 ++++++++++++++++ lib/jquery.js | 2 +- lib/jquery.mockjax-1.5.3.js | 598 + lib/jquery.mockjax-2.2.1.js | 1003 ++ lib/jquery.mockjax.js | 611 +- package-lock.json | 3904 ++++++ package.json | 119 +- src/additional/accept.js | 2 +- src/additional/cifES.js | 135 +- src/additional/creditcard.js | 6 +- src/additional/creditcardtypes.js | 2 +- src/additional/greaterThan.js | 11 + src/additional/greaterThanEqual.js | 11 + src/additional/lessThan.js | 11 + src/additional/lessThanEqual.js | 11 + src/additional/maxfiles.js | 14 + src/additional/maxsize.js | 18 + src/additional/maxsizetotal.js | 22 + src/additional/netmask.js | 3 + src/additional/nieES.js | 49 +- src/additional/nifES.js | 8 +- src/additional/nipPL.js | 22 + src/additional/phonePL.js | 23 + src/additional/phoneUS.js | 2 +- src/core.js | 219 +- .../{messages_az => messages_az.js} | 0 src/localization/messages_bg.js | 2 +- src/localization/messages_da.js | 22 +- src/localization/messages_de.js | 58 +- src/localization/messages_fa.js | 13 +- src/localization/messages_fr.js | 4 +- src/localization/messages_hu.js | 3 +- src/localization/messages_ja.js | 1 + src/localization/messages_nl.js | 1 + src/localization/messages_no.js | 16 +- src/localization/messages_pl.js | 2 + src/localization/messages_pt_BR.js | 29 +- src/localization/messages_sd.js | 23 + src/localization/messages_sv.js | 1 + src/localization/messages_tr.js | 2 +- src/localization/messages_ur.js | 23 + src/localization/messages_vi.js | 2 +- src/localization/messages_zh.js | 1 + src/localization/methods_it.js | 12 + src/localization/methods_nl.js | 3 + test/additional/netmask.js | 19 + test/aria.js | 37 - test/index.html | 35 +- test/methods.js | 374 +- test/rules.js | 74 +- test/test.js | 397 +- validation.jquery.json | 6 +- 79 files changed, 17585 insertions(+), 1024 deletions(-) create mode 100644 .github/stale.yml create mode 100644 demo/bootstrap/index-bs4.html create mode 100644 lib/jquery-3.1.1.js create mode 100644 lib/jquery.mockjax-1.5.3.js create mode 100644 lib/jquery.mockjax-2.2.1.js create mode 100644 package-lock.json create mode 100644 src/additional/greaterThan.js create mode 100644 src/additional/greaterThanEqual.js create mode 100644 src/additional/lessThan.js create mode 100644 src/additional/lessThanEqual.js create mode 100644 src/additional/maxfiles.js create mode 100644 src/additional/maxsize.js create mode 100644 src/additional/maxsizetotal.js create mode 100644 src/additional/netmask.js create mode 100644 src/additional/nipPL.js create mode 100644 src/additional/phonePL.js rename src/localization/{messages_az => messages_az.js} (100%) create mode 100644 src/localization/messages_sd.js create mode 100644 src/localization/messages_ur.js create mode 100644 src/localization/methods_it.js create mode 100644 test/additional/netmask.js diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 5bac57838..478023c77 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,19 +1,23 @@ + ### Subject of the issue -Describe your issue here. + ### Your environment -* version of `jquery-validate` -* which browser and its version +* version of `jquery-validate`: +* which browser and its version: ### Steps to reproduce -Tell us how to reproduce this issue. If pssible, please provide a working demo in JSFiddle (https://jsfiddle.net) or JSBin (https://jsbin.com/). + ### Expected behaviour -Tell us what should happen + ### Actual behaviour -Tell us what happens instead + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 45afa2e04..d67f5b16e 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,3 +1,4 @@ + #### Description -Please describe your pull request. + Thank you! diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 000000000..c6fd0c20b --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,24 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 60 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 7 +# Issues with these labels will never be considered stale +exemptLabels: + - bug + - "help wanted" + - "MERGE ME" + - "NEEDS REVIEW" +# Ignore issues in a milestone +exemptMilestones: true +# Label to use when marking an issue as stale +staleLabel: stale +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue/proposal has been automatically marked as idle and stale because it hasn't + had any recent activity. It will be automtically 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. + + Thank you for contributing :) +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false diff --git a/.travis.yml b/.travis.yml index 57665d998..e328e33da 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: node_js node_js: - - 0.12 + - 6 sudo: false diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f6d10ab3d..d317b2ab7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,12 +3,12 @@ ## Reporting an Issue 1. Make sure the problem you're addressing is reproducible. -2. Use http://jsbin.com or http://jsfiddle.net to provide a test page. +2. Use https://jsbin.com or https://jsfiddle.net to provide a test page. 3. Indicate what browsers the issue can be reproduced in. **Note: IE Compatibilty mode issues will not be addressed. Make sure you test in a real browser!** 4. What version of the plug-in is the issue reproducible in. Is it reproducible after updating to the latest version. -Documentation issues are also tracked at the [jQuery Validation](https://github.com/jzaefferer/jquery-validation/issues) issue tracker. -Pull Requests to improve the docs are welcome at the [jQuery Validation docs](https://github.com/jzaefferer/validation-content) repository, though. +Documentation issues are also tracked at the [jQuery Validation](https://github.com/jquery-validation/jquery-validation/issues) issue tracker. +Pull Requests to improve the docs are welcome at the [jQuery Validation docs](https://github.com/jquery-validation/validation-content) repository, though. **IMPORTANT NOTE ABOUT EMAIL VALIDATION**. As of version 1.12.0 this plugin is using the same regular expression that the [HTML5 specification suggests for browsers to use](https://html.spec.whatwg.org/multipage/forms.html#valid-e-mail-address). We will follow their lead and use the same check. If you think the specification is wrong, please report the issue to them. If you have different requirements, consider [using a custom method](http://jqueryvalidation.org/jQuery.validator.addMethod/). In case you need to adjust the built-in validation regular expression patterns, please [follow the documentation](http://jqueryvalidation.org/jQuery.validator.methods/). @@ -26,7 +26,7 @@ Thanks for contributing! Here's a few guidelines to help your contribution get l ## Build setup 1. Install [NodeJS](http://nodejs.org). -2. Install the Grunt CLI To install by running `npm install -g grunt-cli`. More details are available on their website http://gruntjs.com/getting-started. +2. Install the Grunt CLI by running `npm install -g grunt-cli`. More details are available on their website http://gruntjs.com/getting-started. 3. Install the NPM dependencies by running `npm install`. 4. The build can now be called by running `grunt`. @@ -46,8 +46,8 @@ Start with one browser while developing the fix, then run against others before ## Documentation -Please report documentation issues at the [jQuery Validation](https://github.com/jzaefferer/jquery-validation/issues) issue tracker. -In case your pull request implements or changes public API it would be a plus you would provide a pull request against the [jQuery Validation docs](https://github.com/jzaefferer/validation-content) repository. +Please report documentation issues at the [jQuery Validation](https://github.com/jquery-validation/jquery-validation/issues) issue tracker. +In case your pull request implements or changes public API it would be a plus you would provide a pull request against the [jQuery Validation docs](https://github.com/jquery-validation/validation-content) repository. ## Linting diff --git a/Gruntfile.js b/Gruntfile.js index ceec20959..c5fe1df1e 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -76,7 +76,7 @@ grunt.initConfig( { "<%= grunt.template.today('m/d/yyyy') %>\n" + " * <%= pkg.homepage %>\n" + " * Copyright (c) <%= grunt.template.today('yyyy') %> <%= pkg.author.name %>;" + - " Licensed <%= _.pluck(pkg.licenses, 'type').join(', ') %> */\n" + " Licensed <%= _.map(pkg.licenses, 'type').join(', ') %> */\n" }, dist: { files: { @@ -171,6 +171,27 @@ grunt.initConfig( { } ] } + }, + + // Generate the sub-resource integrity hashes of the distribution files + sri: { + options: { + algorithms: [ "sha256", "sha384", "sha512" ], + + // The target json file + dest: "dist/jquery-validation-sri.json", + + // Stringify the JSON output in a pretty format + pretty: true + }, + + all: { + src: [ + "dist/jquery.validate.{min.js,js}", + "dist/additional-methods.{min.js,js}", + "dist/localization/*.js" + ] + } } } ); @@ -183,9 +204,10 @@ grunt.loadNpmTasks( "grunt-contrib-watch" ); grunt.loadNpmTasks( "grunt-jscs" ); grunt.loadNpmTasks( "grunt-contrib-copy" ); grunt.loadNpmTasks( "grunt-text-replace" ); +grunt.loadNpmTasks( "grunt-sri" ); grunt.registerTask( "default", [ "concat", "copy", "jscs", "jshint", "qunit" ] ); -grunt.registerTask( "release", [ "default", "uglify", "replace", "compress" ] ); +grunt.registerTask( "release", [ "default", "uglify", "replace", "compress", "sri" ] ); grunt.registerTask( "start", [ "concat", "watch" ] ); }; diff --git a/README.md b/README.md index 18918e270..f02786c1c 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@ -[jQuery Validation Plugin](http://jqueryvalidation.org/) - Form validation made easy +[jQuery Validation Plugin](https://jqueryvalidation.org/) - Form validation made easy ================================ -[![Build Status](https://secure.travis-ci.org/jzaefferer/jquery-validation.svg)](http://travis-ci.org/jzaefferer/jquery-validation) -[![devDependency Status](https://david-dm.org/jzaefferer/jquery-validation/dev-status.svg?theme=shields.io)](https://david-dm.org/jzaefferer/jquery-validation#info=devDependencies) -[![Join the chat at https://gitter.im/jzaefferer/jquery-validation](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/jzaefferer/jquery-validation) +[![release](https://img.shields.io/github/release/jquery-validation/jquery-validation.svg)](https://github.com/jquery-validation/jquery-validation/releases/latest) +[![Build Status](https://secure.travis-ci.org/jquery-validation/jquery-validation.svg)](https://travis-ci.org/jquery-validation/jquery-validation) +[![devDependency Status](https://david-dm.org/jquery-validation/jquery-validation/dev-status.svg?theme=shields.io)](https://david-dm.org/jquery-validation/jquery-validation#info=devDependencies) +[![jsDelivr Hits](https://data.jsdelivr.com/v1/package/npm/jquery-validation/badge?style=rounded)](https://www.jsdelivr.com/package/npm/jquery-validation) The jQuery Validation Plugin provides drop-in validation for your existing forms, while making all kinds of customizations to fit your application really easy. @@ -11,13 +12,13 @@ The jQuery Validation Plugin provides drop-in validation for your existing forms ### Downloading the prebuilt files -Prebuilt files can be downloaded from http://jqueryvalidation.org/ +Prebuilt files can be downloaded from https://jqueryvalidation.org/ ### Downloading the latest changes The unreleased development files can be obtained by: - 1. [Downloading](https://github.com/jzaefferer/jquery-validation/archive/master.zip) or Forking this repository + 1. [Downloading](https://github.com/jquery-validation/jquery-validation/archive/master.zip) or Forking this repository 2. [Setup the build](CONTRIBUTING.md#build-setup) 3. Run `grunt` to create the built files in the "dist" directory @@ -32,7 +33,7 @@ Include jQuery and the plugin on a page. Then select a form to validate and call ``` @@ -44,14 +45,33 @@ define(["jquery", "jquery.validate"], function( $ ) { }); ``` -For more information on how to setup a rules and customizations, [check the documentation](http://jqueryvalidation.org/documentation/). +For more information on how to setup a rules and customizations, [check the documentation](https://jqueryvalidation.org/documentation/). ## Reporting issues and contributing code See the [Contributing Guidelines](CONTRIBUTING.md) for details. -**IMPORTANT NOTE ABOUT EMAIL VALIDATION**. As of version 1.12.0 this plugin is using the same regular expression that the [HTML5 specification suggests for browsers to use](https://html.spec.whatwg.org/multipage/forms.html#valid-e-mail-address). We will follow their lead and use the same check. If you think the specification is wrong, please report the issue to them. If you have different requirements, consider [using a custom method](http://jqueryvalidation.org/jQuery.validator.addMethod/). -In case you need to adjust the built-in validation regular expression patterns, please [follow the documentation](http://jqueryvalidation.org/jQuery.validator.methods/). +**IMPORTANT NOTE ABOUT EMAIL VALIDATION**. As of version 1.12.0 this plugin is using the same regular expression that the [HTML5 specification suggests for browsers to use](https://html.spec.whatwg.org/multipage/forms.html#valid-e-mail-address). We will follow their lead and use the same check. If you think the specification is wrong, please report the issue to them. If you have different requirements, consider [using a custom method](https://jqueryvalidation.org/jQuery.validator.addMethod/). +In case you need to adjust the built-in validation regular expression patterns, please [follow the documentation](https://jqueryvalidation.org/jQuery.validator.methods/). + +**IMPORTANT NOTE ABOUT REQUIRED METHOD**. As of version 1.14.0 this plugin stops trimming white spaces from the value of the attached element. If you want to achieve the same result, you can use the [`normalizer`](https://jqueryvalidation.org/normalizer/) that can be used to transform the value of an element before validation. This feature was available since `v1.15.0`. In other words, you can do something like this: +``` js +$("#myForm").validate({ + rules: { + username: { + required: true, + // Using the normalizer to trim the value of the element + // before validating it. + // + // The value of `this` inside the `normalizer` is the corresponding + // DOMElement. In this example, `this` references the `username` element. + normalizer: function(value) { + return $.trim(value); + } + } + } +}); +``` ## License Copyright © Jörn Zaefferer
diff --git a/bower.json b/bower.json index b8f06fbd9..b456095de 100644 --- a/bower.json +++ b/bower.json @@ -1,9 +1,9 @@ { "name": "jquery-validation", - "homepage": "http://jqueryvalidation.org/", + "homepage": "https://jqueryvalidation.org/", "repository": { "type": "git", - "url": "git://github.com/jzaefferer/jquery-validation.git" + "url": "git://github.com/jquery-validation/jquery-validation.git" }, "authors": [ "Jörn Zaefferer " diff --git a/build/release.js b/build/release.js index db0c544e4..7ba8a04fc 100644 --- a/build/release.js +++ b/build/release.js @@ -1,18 +1,19 @@ /* 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 - pull latest https://github.com/jquery/jquery-release - disable _generateChangelog task in release.js (BOOOO) - run - node release.js --remote=jzaefferer/jquery-validation + node release.js --remote=jquery-validation/jquery-validation - Wait a while, verify and confirm each step - Create GitHub release: Pick the new tag, add changelog, upload zip - Upload to NPM - git fetch --tags jzaefferer + git fetch --tags jquery-validation git checkout tags/X.YY.Z npm publish - 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 +- Check cdnjs CDN: new git tags are automatically committed into https://github.com/cdnjs/cdnjs/commits/master or ping @cdnjs - Update validation-content/pages/index.html (may have to hold off on CDN updates until available) - Write blog post: Some highlights, changelog, download links */ @@ -35,11 +36,16 @@ Release.define({ generateArtifacts: function( done ) { Release.exec( "grunt release", "Grunt command failed" ); + // Keep this list of files in sync with package.json's files key done([ + "dist/localization/", "dist/additional-methods.js", "dist/additional-methods.min.js", "dist/jquery.validate.js", - "dist/jquery.validate.min.js" + "dist/jquery.validate.min.js", + + // The sub-resource integrity hashes of the distribution files + "dist/jquery-validation-sri.json" ]); }, diff --git a/changelog.md b/changelog.md index 18bca7bef..cc7be908b 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,74 @@ +1.17.0 / 2017-07-20 +================== + +## Core + * Pass on the value of the used submit button for scripted submits (#2019) + * Removed aria-required attribute (#2012) + * Assign rules to contenteditable via `.validate()` and `.rules()` (#1947) + * Count invalid fields with empty message in `numberOfInvalids()` (#1942) + * Added support for button elements with descendants (#1901) + * Add support for defining a global normalizer (#1905) + +## Additional + * Add localized number validation to methods_nl.js (#2014) + * Remove unreachable return from `cifES.js` (#1994) + * Add optional support to cifES, nifES and nieES (#1966) + * Add netmask validation method (#1955) + * Add Polish tax id validation method (#1850) + * Fixed validation for specific case for Spanish NIFs (#1914) + +## Localization + * Added Step Range Validation to messages_ja (#1936) + * Add hungarian step message (#1888) + * Add Sindhi locale (#1900) + * Added norsk step translation (#1918) + * Add missing french step translation (#1928) + * Added nl- translation for "step" property (#1902) + * Add French translation for notEqualTo method (#2033) + +## Readme + * Add note about trimming whitespaces inside required method (#2028) + +## 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 + +## Build + * Upgrade QUnit to 2.3.3 (#2018) + +1.16.0 / 2016-12-01 +================== + +## Additional + * Refine cifES and nieES algorithms. Closes #1826 + +## Build + * Include Minified Version in NPM Package + * Bump dev-dependencies to latest versions + +## Core + * Add binding for input with button type. Closes #1891 + * Support jquery3. Closes #1866 + * Change jQuery alias 'expr[":"]' to 'expr.pseudos' + +## Localisation + * Add Urdu translation. Closes #1873. + +## Localization + * Fixed wrong file-extension for az translation. Closes #1890. + * Added missing translation in pt-BR (Closes #1897) + * Fixed typo in arabien language file. + +## Tests + * Upgrade QUnit to 2.0. + +## UMD + * Better support for CommonJS. + 1.15.1 / 2016-07-22 ================== @@ -24,7 +95,7 @@ ## Tests * Added regression unit tests for PR #1760 - + 1.15.0 / 2016-02-24 ================== @@ -73,7 +144,7 @@ * Update Malay translation * Included messages from additional methods * Improving pt_BR translation and fixing a typo on the 'cifES' key. - + 1.14.0 / 2015-06-30 ================== diff --git a/demo/ajaxSubmit-integration-demo.html b/demo/ajaxSubmit-integration-demo.html index 207f9adf1..057f18dbe 100644 --- a/demo/ajaxSubmit-integration-demo.html +++ b/demo/ajaxSubmit-integration-demo.html @@ -63,7 +63,7 @@ -

jQuery Validation Plugin Demo

+

jQuery Validation Plugin Demo

diff --git a/demo/bootstrap/index-bs4.html b/demo/bootstrap/index-bs4.html new file mode 100644 index 000000000..8c9afc7cc --- /dev/null +++ b/demo/bootstrap/index-bs4.html @@ -0,0 +1,164 @@ + + + + JQuery-validation demo | Bootstrap + + + + + + + +
+
+
+
+ +
+ +
+
+
Simple Form
+
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+
+ + +
+
+
+ +
+
+ +
+
+ +
+
+
+
+
+ + + diff --git a/demo/bootstrap/index.html b/demo/bootstrap/index.html index 4b44693a0..36505b50e 100644 --- a/demo/bootstrap/index.html +++ b/demo/bootstrap/index.html @@ -16,7 +16,7 @@
diff --git a/demo/cinema/index.html b/demo/cinema/index.html index 0ef1ecddb..bcdf6c890 100755 --- a/demo/cinema/index.html +++ b/demo/cinema/index.html @@ -3,9 +3,9 @@ Retro Cinema Registration - + - + - + + + -

jQuery Validation Plugin Demo

+

jQuery Validation Plugin Demo

diff --git a/demo/themerollered.html b/demo/themerollered.html index 450c5c77e..2a817ed4f 100644 --- a/demo/themerollered.html +++ b/demo/themerollered.html @@ -3,7 +3,7 @@ jQuery validation plug-in - ThemeRolldered demo - +