Nu har vi lagt till ett web-projekt ASP MVC
This commit is contained in:
85
MVCUI/Scripts/jquery.validate.js
vendored
85
MVCUI/Scripts/jquery.validate.js
vendored
@ -1,9 +1,9 @@
|
||||
/*!
|
||||
* jQuery Validation Plugin v1.19.1
|
||||
* jQuery Validation Plugin v1.17.0
|
||||
*
|
||||
* https://jqueryvalidation.org/
|
||||
*
|
||||
* Copyright (c) 2019 Jörn Zaefferer
|
||||
* Copyright (c) 2017 Jörn Zaefferer
|
||||
* Released under the MIT license
|
||||
*/
|
||||
(function( factory ) {
|
||||
@ -67,7 +67,6 @@ $.extend( $.fn, {
|
||||
// Prevent form submit to be able to see console output
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
function handle() {
|
||||
var hidden, result;
|
||||
|
||||
@ -83,7 +82,7 @@ $.extend( $.fn, {
|
||||
.appendTo( validator.currentForm );
|
||||
}
|
||||
|
||||
if ( validator.settings.submitHandler && !validator.settings.debug ) {
|
||||
if ( validator.settings.submitHandler ) {
|
||||
result = validator.settings.submitHandler.call( validator, validator.currentForm, event );
|
||||
if ( hidden ) {
|
||||
|
||||
@ -143,7 +142,6 @@ $.extend( $.fn, {
|
||||
// https://jqueryvalidation.org/rules/
|
||||
rules: function( command, argument ) {
|
||||
var element = this[ 0 ],
|
||||
isContentEditable = typeof this.attr( "contenteditable" ) !== "undefined" && this.attr( "contenteditable" ) !== "false",
|
||||
settings, staticRules, existingRules, data, param, filtered;
|
||||
|
||||
// If nothing is selected, return empty object; can't chain anyway
|
||||
@ -151,7 +149,7 @@ $.extend( $.fn, {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !element.form && isContentEditable ) {
|
||||
if ( !element.form && element.hasAttribute( "contenteditable" ) ) {
|
||||
element.form = this.closest( "form" )[ 0 ];
|
||||
element.name = this.attr( "name" );
|
||||
}
|
||||
@ -395,8 +393,7 @@ $.extend( $.validator, {
|
||||
this.invalid = {};
|
||||
this.reset();
|
||||
|
||||
var currentForm = this.currentForm,
|
||||
groups = ( this.groups = {} ),
|
||||
var groups = ( this.groups = {} ),
|
||||
rules;
|
||||
$.each( this.settings.groups, function( key, value ) {
|
||||
if ( typeof value === "string" ) {
|
||||
@ -412,20 +409,13 @@ $.extend( $.validator, {
|
||||
} );
|
||||
|
||||
function delegate( event ) {
|
||||
var isContentEditable = typeof $( this ).attr( "contenteditable" ) !== "undefined" && $( this ).attr( "contenteditable" ) !== "false";
|
||||
|
||||
// Set form expando on contenteditable
|
||||
if ( !this.form && isContentEditable ) {
|
||||
if ( !this.form && this.hasAttribute( "contenteditable" ) ) {
|
||||
this.form = $( this ).closest( "form" )[ 0 ];
|
||||
this.name = $( this ).attr( "name" );
|
||||
}
|
||||
|
||||
// Ignore the element if it belongs to another form. This will happen mainly
|
||||
// when setting the `form` attribute of an input to the id of another form.
|
||||
if ( currentForm !== this.form ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var validator = $.data( this.form, "validator" ),
|
||||
eventType = "on" + event.type.replace( /^validate/, "" ),
|
||||
settings = validator.settings;
|
||||
@ -620,7 +610,7 @@ $.extend( $.validator, {
|
||||
try {
|
||||
$( this.findLastActive() || this.errorList.length && this.errorList[ 0 ].element || [] )
|
||||
.filter( ":visible" )
|
||||
.trigger( "focus" )
|
||||
.focus()
|
||||
|
||||
// Manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find
|
||||
.trigger( "focusin" );
|
||||
@ -649,23 +639,16 @@ $.extend( $.validator, {
|
||||
.not( this.settings.ignore )
|
||||
.filter( function() {
|
||||
var name = this.name || $( this ).attr( "name" ); // For contenteditable
|
||||
var isContentEditable = typeof $( this ).attr( "contenteditable" ) !== "undefined" && $( this ).attr( "contenteditable" ) !== "false";
|
||||
|
||||
if ( !name && validator.settings.debug && window.console ) {
|
||||
console.error( "%o has no name assigned", this );
|
||||
}
|
||||
|
||||
// Set form expando on contenteditable
|
||||
if ( isContentEditable ) {
|
||||
if ( this.hasAttribute( "contenteditable" ) ) {
|
||||
this.form = $( this ).closest( "form" )[ 0 ];
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
// Ignore elements that belong to other/nested forms
|
||||
if ( this.form !== validator.currentForm ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Select only the first element for each name, and only those with rules specified
|
||||
if ( name in rulesCache || !validator.objectLength( $( this ).rules() ) ) {
|
||||
return false;
|
||||
@ -711,7 +694,6 @@ $.extend( $.validator, {
|
||||
elementValue: function( element ) {
|
||||
var $element = $( element ),
|
||||
type = element.type,
|
||||
isContentEditable = typeof $element.attr( "contenteditable" ) !== "undefined" && $element.attr( "contenteditable" ) !== "false",
|
||||
val, idx;
|
||||
|
||||
if ( type === "radio" || type === "checkbox" ) {
|
||||
@ -720,7 +702,7 @@ $.extend( $.validator, {
|
||||
return element.validity.badInput ? "NaN" : $element.val();
|
||||
}
|
||||
|
||||
if ( isContentEditable ) {
|
||||
if ( element.hasAttribute( "contenteditable" ) ) {
|
||||
val = $element.text();
|
||||
} else {
|
||||
val = $element.val();
|
||||
@ -781,6 +763,10 @@ $.extend( $.validator, {
|
||||
if ( normalizer ) {
|
||||
val = normalizer.call( element, val );
|
||||
|
||||
if ( typeof val !== "string" ) {
|
||||
throw new TypeError( "The normalizer should return a string value." );
|
||||
}
|
||||
|
||||
// Delete the normalizer from rules to avoid treating it as a pre-defined method.
|
||||
delete rules.normalizer;
|
||||
}
|
||||
@ -1156,19 +1142,7 @@ $.extend( $.validator, {
|
||||
.removeData( "validator" )
|
||||
.find( ".validate-equalTo-blur" )
|
||||
.off( ".validate-equalTo" )
|
||||
.removeClass( "validate-equalTo-blur" )
|
||||
.find( ".validate-lessThan-blur" )
|
||||
.off( ".validate-lessThan" )
|
||||
.removeClass( "validate-lessThan-blur" )
|
||||
.find( ".validate-lessThanEqual-blur" )
|
||||
.off( ".validate-lessThanEqual" )
|
||||
.removeClass( "validate-lessThanEqual-blur" )
|
||||
.find( ".validate-greaterThanEqual-blur" )
|
||||
.off( ".validate-greaterThanEqual" )
|
||||
.removeClass( "validate-greaterThanEqual-blur" )
|
||||
.find( ".validate-greaterThan-blur" )
|
||||
.off( ".validate-greaterThan" )
|
||||
.removeClass( "validate-greaterThan-blur" );
|
||||
.removeClass( "validate-equalTo-blur" );
|
||||
}
|
||||
|
||||
},
|
||||
@ -1272,12 +1246,6 @@ $.extend( $.validator, {
|
||||
|
||||
for ( method in $.validator.methods ) {
|
||||
value = $element.data( "rule" + method.charAt( 0 ).toUpperCase() + method.substring( 1 ).toLowerCase() );
|
||||
|
||||
// Cast empty attributes like `data-rule-required` to `true`
|
||||
if ( value === "" ) {
|
||||
value = true;
|
||||
}
|
||||
|
||||
this.normalizeAttributeRule( rules, type, method, value );
|
||||
}
|
||||
return rules;
|
||||
@ -1403,7 +1371,7 @@ $.extend( $.validator, {
|
||||
if ( this.checkable( element ) ) {
|
||||
return this.getLength( value, element ) > 0;
|
||||
}
|
||||
return value !== undefined && value !== null && value.length > 0;
|
||||
return value.length > 0;
|
||||
},
|
||||
|
||||
// https://jqueryvalidation.org/email-method/
|
||||
@ -1427,26 +1395,9 @@ $.extend( $.validator, {
|
||||
},
|
||||
|
||||
// https://jqueryvalidation.org/date-method/
|
||||
date: ( function() {
|
||||
var called = false;
|
||||
|
||||
return function( value, element ) {
|
||||
if ( !called ) {
|
||||
called = true;
|
||||
if ( this.settings.debug && window.console ) {
|
||||
console.warn(
|
||||
"The `date` method is deprecated and will be removed in version '2.0.0'.\n" +
|
||||
"Please don't use it, since it relies on the Date constructor, which\n" +
|
||||
"behaves very differently across browsers and locales. Use `dateISO`\n" +
|
||||
"instead or one of the locale specific methods in `localizations/`\n" +
|
||||
"and `additional-methods.js`."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return this.optional( element ) || !/Invalid|NaN/.test( new Date( value ).toString() );
|
||||
};
|
||||
}() ),
|
||||
date: function( value, element ) {
|
||||
return this.optional( element ) || !/Invalid|NaN/.test( new Date( value ).toString() );
|
||||
},
|
||||
|
||||
// https://jqueryvalidation.org/dateISO-method/
|
||||
dateISO: function( value, element ) {
|
||||
|
||||
Reference in New Issue
Block a user