PageSourceSearch

https://www.svta.org/wp-content/plugins/e-signature/assets/js/jquery.validate.js?ver=2.1.7.2

js svta.org collected 2026-09-24 21:07:50 UTC 55,273 bytes, 1,790 lines download raw bytes

vendor: 55,273 bytes, lines 1-1790
1/*!
2 * jQuery Validation Plugin v1.22.1
3 *
4 * https://jqueryvalidation.org/
5 *
6 * Copyright (c) 2026 Jörn Zaefferer
7 * Released under the MIT license
8 */
9(function( factory ) {
10	if ( typeof define === "function" && define.amd ) {
11		define( ["jquery"], factory );
12	} else if (typeof module === "object" && module.exports) {
13		module.exports = factory( require( "jquery" ) );
14	} else {
15		factory( jQuery );
16	}
17}(function( $ ) {
18
19$.extend( $.fn, {
20
21	// https://jqueryvalidation.org/validate/
22	validate: function( options ) {
23
24		// If nothing is selected, return nothing; can't chain anyway
25		if ( !this.length ) {
26			if ( options && options.debug && window.console ) {
27				console.warn( "Nothing selected, can't validate, returning nothing." );
28			}
29			return;
30		}
31
32		// Check if a validator for this form was already created
33		var validator = $.data( this[ 0 ], "validator" );
34		if ( validator ) {
35			return validator;
36		}
37
38		// Add novalidate tag if HTML5.
39		this.attr( "novalidate", "novalidate" );
40
41		validator = new $.validator( options, this[ 0 ] );
42		$.data( this[ 0 ], "validator", validator );
43
44		if ( validator.settings.onsubmit ) {
45
46			this.on( "click.validate", ":submit", function( event ) {
47
48				// Track the used submit button to properly handle scripted
49				// submits later.
50				validator.submitButton = event.currentTarget;
51
52				// Allow suppressing validation by adding a cancel class to the submit button
53				if ( $( this ).hasClass( "cancel" ) ) {
54					validator.cancelSubmit = true;
55				}
56
57				// Allow suppressing validation by adding the html5 formnovalidate attribute to the submit button
58				if ( $( this ).attr( "formnovalidate" ) !== undefined ) {
59					validator.cancelSubmit = true;
60				}
61			} );
62
63			// Validate the form on submit
64			this.on( "submit.validate", function( event ) {
65				if ( validator.settings.debug ) {
66
67					// Prevent form submit to be able to see console output
68					event.preventDefault();
69				}
70
71				function handle() {
72					var hidden, result;
73
74					// Insert a hidden input as a replacement for the missing submit button
75					// The hidden input is inserted in two cases:
76					//   - A user defined a `submitHandler`
77					//   - There was a pending request due to `remote` method and `stopRequest()`
78					//     was called to submit the form in case it's valid
79					if ( validator.submitButton && ( validator.settings.submitHandler || validator.formSubmitted ) ) {
80						hidden = $( "<input type='hidden'/>" )
81							.attr( "name", validator.submitButton.name )
82							.val( $( validator.submitButton ).val() )
83							.appendTo( validator.currentForm );
84					}
85
86					if ( validator.settings.submitHandler && !validator.settings.debug ) {
87						result = validator.settings.submitHandler.call( validator, validator.currentForm, event );
88						if ( hidden ) {
89
90							// And clean up afterwards; thanks to no-block-scope, hidden can be referenced
91							hidden.remove();
92						}
93						if ( result !== undefined ) {
94							return result;
95						}
96						return false;
97					}
98					return true;
99				}
100
101				// Prevent submit for invalid forms or custom submit handlers
102				if ( validator.cancelSubmit ) {
103					validator.cancelSubmit = false;
104					return handle();
105				}
106				if ( validator.form() ) {
107					if ( validator.pendingRequest ) {
108						validator.formSubmitted = true;
109						return false;
110					}
111					return handle();
112				} else {
113					validator.focusInvalid();
114					return false;
115				}
116			} );
117		}
118
119		return validator;
120	},
121
122	// https://jqueryvalidation.org/valid/
123	valid: function() {
124		var valid, validator, errorList;
125
126		if ( $( this[ 0 ] ).is( "form" ) ) {
127			valid = this.validate().form();
128		} else {
129			errorList = [];
130			valid = true;
131			validator = $( this[ 0 ].form ).validate();
132			this.each( function() {
133				valid = validator.element( this ) && valid;
134				if ( !valid ) {
135					errorList = errorList.concat( validator.errorList );
136				}
137			} );
138			validator.errorList = errorList;
139		}
140		return valid;
141	},
142
143	// https://jqueryvalidation.org/rules/
144	rules: function( command, argument ) {
145		var element = this[ 0 ],
146			isContentEditable = typeof this.attr( "contenteditable" ) !== "undefined" && this.attr( "contenteditable" ) !== "false",
147			settings, staticRules, existingRules, data, param, filtered;
148
149		// If nothing is selected, return empty object; can't chain anyway
150		if ( element == null ) {
151			return;
152		}
153
154		if ( !element.form && isContentEditable ) {
155			element.form = this.closest( "form" )[ 0 ];
156			element.name = this.attr( "name" );
157		}
158
159		if ( element.form == null ) {
160			return;
161		}
162
163		if ( command ) {
164			settings = $.data( element.form, "validator" ).settings;
165			staticRules = settings.rules;
166			existingRules = $.validator.staticRules( element );
167			switch ( command ) {
168			case "add":
169				$.extend( existingRules, $.validator.normalizeRule( argument ) );
170
171				// Remove messages from rules, but allow them to be set separately
172				delete existingRules.messages;
173				staticRules[ element.name ] = existingRules;
174				if ( argument.messages ) {
175					settings.messages[ element.name ] = $.extend( settings.messages[ element.name ], argument.messages );
176				}
177				break;
178			case "remove":
179				if ( !argument ) {
180					delete staticRules[ element.name ];
181					return existingRules;
182				}
183				filtered = {};
184				$.each( argument.split( /\s/ ), function( index, method ) {
185					filtered[ method ] = existingRules[ method ];
186					delete existingRules[ method ];
187				} );
188				return filtered;
189			}
190		}
191
192		data = $.validator.normalizeRules(
193		$.extend(
194			{},
195			$.validator.classRules( element ),
196			$.validator.attributeRules( element ),
197			$.validator.dataRules( element ),
198			$.validator.staticRules( element )
199		), element );
200
201		// Make sure required is at front
202		if ( data.required ) {
203			param = data.required;
204			delete data.required;
205			data = $.extend( { required: param }, data );
206		}
207
208		// Make sure remote is at back
209		if ( data.remote ) {
210			param = data.remote;
211			delete data.remote;
212			data = $.extend( data, { remote: param } );
213		}
214
215		return data;
216	}
217} );
218
219// JQuery trim is deprecated, provide a trim method based on String.prototype.trim
220var trim = function( str ) {
221
222	// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trim#Polyfill
223	return str.replace( /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "" );
224};
225
226// Custom selectors
227$.extend( $.expr.pseudos || $.expr[ ":" ], {		// '|| $.expr[ ":" ]' here enables backwards compatibility to jQuery 1.7. Can be removed when dropping jQ 1.7.x support
228
229	// https://jqueryvalidation.org/blank-selector/
230	blank: function( a ) {
231		return !trim( "" + $( a ).val() );
232	},
233
234	// https://jqueryvalidation.org/filled-selector/
235	filled: function( a ) {
236		var val = $( a ).val();
237		return val !== null && !!trim( "" + val );
238	},
239
240	// https://jqueryvalidation.org/unchecked-selector/
241	unchecked: function( a ) {
242		return !$( a ).prop( "checked" );
243	}
244} );
245
246// Constructor for validator
247$.validator = function( options, form ) {
248	this.settings = $.extend( true, {}, $.validator.defaults, options );
249	this.currentForm = form;
250	this.init();
251};
252
253// https://jqueryvalidation.org/jQuery.validator.format/
254$.validator.format = function( source, params ) {
255	if ( arguments.length === 1 ) {
256		return function() {
257			var args = $.makeArray( arguments );
258			args.unshift( source );
259			return $.validator.format.apply( this, args );
260		};
261	}
262	if ( params === undefined ) {
263		return source;
264	}
265	if ( arguments.length > 2 && params.constructor !== Array  ) {
266		params = $.makeArray( arguments ).slice( 1 );
267	}
268	if ( params.constructor !== Array ) {
269		params = [ params ];
270	}
271	$.each( params, function( i, n ) {
272		source = source.replace( new RegExp( "\\{" + i + "\\}", "g" ), function() {
273			return n;
274		} );
275	} );
276	return source;
277};
278
279$.extend( $.validator, {
280
281	defaults: {
282		messages: {},
283		groups: {},
284		rules: {},
285		errorClass: "error",
286		pendingClass: "pending",
287		validClass: "valid",
288		errorElement: "label",
289		focusCleanup: false,
290		focusInvalid: true,
291		ariaDescribedByCleanup: false,
292		errorContainer: $( [] ),
293		errorLabelContainer: $( [] ),
294		onsubmit: true,
295		ignore: ":hidden",
296		ignoreTitle: false,
297		customElements: [],
298		onfocusin: function( element ) {
299			this.lastActive = element;
300
301			// Hide error label and remove error class on focus if enabled
302			if ( this.settings.focusCleanup ) {
303				if ( this.settings.unhighlight ) {
304					this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass );
305				}
306				this.hideThese( this.errorsFor( element ) );
307			}
308		},
309		onfocusout: function( element ) {
310			if ( !this.checkable( element ) && ( element.name in this.submitted || !this.optional( element ) ) ) {
311				this.element( element );
312			}
313		},
314		onkeyup: function( element, event ) {
315
316			// Avoid revalidate the field when pressing one of the following keys
317			// Shift       => 16
318			// Ctrl        => 17
319			// Alt         => 18
320			// Caps lock   => 20
321			// End         => 35
322			// Home        => 36
323			// Left arrow  => 37
324			// Up arrow    => 38
325			// Right arrow => 39
326			// Down arrow  => 40
327			// Insert      => 45
328			// Num lock    => 144
329			// AltGr key   => 225
330			var excludedKeys = [
331				16, 17, 18, 20, 35, 36, 37,
332				38, 39, 40, 45, 144, 225
333			];
334
335			if ( event.which === 9 && this.elementValue( element ) === "" || $.inArray( event.keyCode, excludedKeys ) !== -1 ) {
336				return;
337			} else if ( element.name in this.submitted || element.name in this.invalid ) {
338				this.element( element );
339			}
340		},
341		onclick: function( element ) {
342
343			// Click on selects, radiobuttons and checkboxes
344			if ( element.name in this.submitted ) {
345				this.element( element );
346
347			// Or option elements, check parent select in that case
348			} else if ( element.parentNode.name in this.submitted ) {
349				this.element( element.parentNode );
350			}
351		},
352		highlight: function( element, errorClass, validClass ) {
353			if ( element.type === "radio" ) {
354				this.findByName( element.name ).addClass( errorClass ).removeClass( validClass );
355			} else {
356				$( element ).addClass( errorClass ).removeClass( validClass );
357			}
358		},
359		unhighlight: function( element, errorClass, validClass ) {
360			if ( element.type === "radio" ) {
361				this.findByName( element.name ).removeClass( errorClass ).addClass( validClass );
362			} else {
363				$( element ).removeClass( errorClass ).addClass( validClass );
364			}
365		}
366	},
367
368	// https://jqueryvalidation.org/jQuery.validator.setDefaults/
369	setDefaults: function( settings ) {
370		$.extend( $.validator.defaults, settings );
371	},
372
373	messages: {
374		required: "This field is required.",
375		remote: "Please fix this field.",
376		email: "Please enter a valid email address.",
377		url: "Please enter a valid URL.",
378		date: "Please enter a valid date.",
379		dateISO: "Please enter a valid date (ISO).",
380		number: "Please enter a valid number.",
381		digits: "Please enter only digits.",
382		equalTo: "Please enter the same value again.",
383		maxlength: $.validator.format( "Please enter no more than {0} characters." ),
384		minlength: $.validator.format( "Please enter at least {0} characters." ),
385		rangelength: $.validator.format( "Please enter a value between {0} and {1} characters long." ),
386		range: $.validator.format( "Please enter a value between {0} and {1}." ),
387		max: $.validator.format( "Please enter a value less than or equal to {0}." ),
388		min: $.validator.format( "Please enter a value greater than or equal to {0}." ),
389		step: $.validator.format( "Please enter a multiple of {0}." )
390	},
391
392	autoCreateRanges: false,
393
394	prototype: {
395
396		init: function() {
397			this.labelContainer = $( this.settings.errorLabelContainer );
398			this.errorContext = this.labelContainer.length && this.labelContainer || $( this.currentForm );
399			this.containers = $( this.settings.errorContainer ).add( this.settings.errorLabelContainer );
400			this.submitted = {};
401			this.valueCache = {};
402			this.pendingRequest = 0;
403			this.pending = {};
404			this.invalid = {};
405			this.reset();
406
407			var currentForm = this.currentForm,
408				groups = ( this.groups = {} ),
409				rules;
410			$.each( this.settings.groups, function( key, value ) {
411				if ( typeof value === "string" ) {
412					value = value.split( /\s/ );
413				}
414				$.each( value, function( index, name ) {
415					groups[ name ] = key;
416				} );
417			} );
418			rules = this.settings.rules;
419			$.each( rules, function( key, value ) {
420				rules[ key ] = $.validator.normalizeRule( value );
421			} );
422
423			function delegate( event ) {
424				var isContentEditable = typeof $( this ).attr( "contenteditable" ) !== "undefined" && $( this ).attr( "contenteditable" ) !== "false";
425
426				// Set form expando on contenteditable
427				if ( !this.form && isContentEditable ) {
428					this.form = $( this ).closest( "form" )[ 0 ];
429					this.name = $( this ).attr( "name" );
430				}
431
432				// Ignore the element if it belongs to another form. This will happen mainly
433				// when setting the `form` attribute of an input to the id of another form.
434				if ( currentForm !== this.form ) {
435					return;
436				}
437
438				var validator = $.data( this.form, "validator" ),
439					eventType = "on" + event.type.replace( /^validate/, "" ),
440					settings = validator.settings;
441				if ( settings[ eventType ] && !$( this ).is( settings.ignore ) ) {
442					settings[ eventType ].call( validator, this, event );
443				}
444			}
445			var focusListeners = [ ":text", "[type='password']", "[type='file']", "select", "textarea", "[type='number']", "[type='search']",
446								"[type='tel']", "[type='url']", "[type='email']", "[type='datetime']", "[type='date']", "[type='month']",
447								"[type='week']", "[type='time']", "[type='datetime-local']", "[type='range']", "[type='color']",
448								"[type='radio']", "[type='checkbox']", "[contenteditable]", "[type='button']" ];
449			var clickListeners = [ "select", "option", "[type='radio']", "[type='checkbox']" ];
450			$( this.currentForm )
451				.on( "focusin.validate focusout.validate keyup.validate", focusListeners.concat( this.settings.customElements ).join( ", " ), delegate )
452
453				// Support: Chrome, oldIE
454				// "select" is provided as event.target when clicking a option
455				.on( "click.validate", clickListeners.concat( this.settings.customElements ).join( ", " ), delegate );
456
457			if ( this.settings.invalidHandler ) {
458				$( this.currentForm ).on( "invalid-form.validate", this.settings.invalidHandler );
459			}
460		},
461
462		// https://jqueryvalidation.org/Validator.form/
463		form: function() {
464			this.checkForm();
465			$.extend( this.submitted, this.errorMap );
466			this.invalid = $.extend( {}, this.errorMap );
467			if ( !this.valid() ) {
468				$( this.currentForm ).triggerHandler( "invalid-form", [ this ] );
469			}
470			this.showErrors();
471			return this.valid();
472		},
473
474		checkForm: function() {
475			this.prepareForm();
476			for ( var i = 0, elements = ( this.currentElements = this.elements() ); elements[ i ]; i++ ) {
477				this.check( elements[ i ] );
478			}
479			return this.valid();
480		},
481
482		// https://jqueryvalidation.org/Validator.element/
483		element: function( element ) {
484			var cleanElement = this.clean( element ),
485				checkElement = this.validationTargetFor( cleanElement ),
486				v = this,
487				result = true,
488				rs, group;
489
490			if ( checkElement === undefined ) {
491				delete this.invalid[ cleanElement.name ];
492			} else {
493				this.prepareElement( checkElement );
494				this.currentElements = $( checkElement );
495
496				// If this element is grouped, then validate all group elements already
497				// containing a value
498				group = this.groups[ checkElement.name ];
499				if ( group ) {
500					$.each( this.groups, function( name, testgroup ) {
501						if ( testgroup === group && name !== checkElement.name ) {
502							cleanElement = v.validationTargetFor( v.clean( v.findByName( name ) ) );
503
504							// Don't want to check fields if a user hasn't gotten to them yet
505							if ( cleanElement && cleanElement.name in v.invalid ) {
506								v.currentElements.pushStack( cleanElement );
507								result = v.check( cleanElement ) && result;
508							}
509						}
510					} );
511				}
512
513				rs = this.check( checkElement ) !== false;
514				result = result && rs;
515				if ( rs ) {
516					this.invalid[ checkElement.name ] = false;
517				} else {
518					this.invalid[ checkElement.name ] = true;
519				}
520
521				if ( !this.numberOfInvalids() ) {
522
523					// Hide error containers on last error
524					this.toHide = this.toHide.add( this.containers );
525				}
526				this.showErrors();
527
528				// Add aria-invalid status for screen readers
529				$( element ).attr( "aria-invalid", !rs );
530			}
531
532			return result;
533		},
534
535		// https://jqueryvalidation.org/Validator.showErrors/
536		showErrors: function( errors ) {
537			if ( errors ) {
538				var validator = this;
539
540				// Add items to error list and map
541				$.extend( this.errorMap, errors );
542				this.errorList = $.map( this.errorMap, function( message, name ) {
543					return {
544						message: message,
545						element: validator.findByName( name )[ 0 ]
546					};
547				} );
548
549				// Remove items from success list
550				this.successList = $.grep( this.successList, function( element ) {
551					return !( element.name in errors );
552				} );
553			}
554			if ( this.settings.showErrors ) {
555				this.settings.showErrors.call( this, this.errorMap, this.errorList );
556			} else {
557				this.defaultShowErrors();
558			}
559		},
560
561		// https://jqueryvalidation.org/Validator.resetForm/
562		resetForm: function() {
563			if ( $.fn.resetForm ) {
564				$( this.currentForm ).resetForm();
565			}
566			this.invalid = {};
567			this.submitted = {};
568			this.prepareForm();
569			this.hideErrors();
570			var elements = this.elements()
571				.removeData( "previousValue" )
572				.removeAttr( "aria-invalid" );
573
574			this.resetElements( elements );
575		},
576
577		resetElements: function( elements ) {
578			var i;
579
580			if ( this.settings.unhighlight ) {
581				for ( i = 0; elements[ i ]; i++ ) {
582					this.settings.unhighlight.call( this, elements[ i ],
583						this.settings.errorClass, "" );
584					this.findByName( elements[ i ].name ).removeClass( this.settings.validClass );
585				}
586			} else {
587				elements
588					.removeClass( this.settings.errorClass )
589					.removeClass( this.settings.validClass );
590			}
591		},
592
593		numberOfInvalids: function() {
594			return this.objectLength( this.invalid );
595		},
596
597		objectLength: function( obj ) {
598			/* jshint unused: false */
599			var count = 0,
600				i;
601			for ( i in obj ) {
602
603				// This check allows counting elements with empty error
604				// message as invalid elements
605				if ( obj[ i ] !== undefined && obj[ i ] !== null && obj[ i ] !== false ) {
606					count++;
607				}
608			}
609			return count;
610		},
611
612		hideErrors: function() {
613			this.hideThese( this.toHide );
614		},
615		addErrorAriaDescribedBy: function( element, error, updateGroupMembers ) {
616			updateGroupMembers = ( updateGroupMembers === undefined ) ? false : updateGroupMembers;
617
618			var errorID, v, group,
619				describedBy = $( element ).attr( "aria-describedby" );
620				errorID = error.attr( "id" );
621
622			// Respect existing non-error aria-describedby
623			if ( !describedBy ) {
624				describedBy = errorID;
625			} else if ( !describedBy.match( new RegExp( "\\b" + this.escapeCssMeta( errorID ) + "\\b" ) ) ) {
626
627				// Add to end of list if not already present
628				describedBy += " " + errorID;
629			}
630
631			$( element ).attr( "aria-describedby", describedBy );
632
633			if ( updateGroupMembers ) {
634
635				// If this element is grouped, then assign to all elements in the same group
636				group = this.groups[ element.name ];
637				if ( group ) {
638					v = this;
639					$.each( v.groups, function( name, testgroup ) {
640						if ( testgroup === group ) {
641							v.addErrorAriaDescribedBy( $( "[name='" + v.escapeCssMeta( name ) + "']", v.currentForm ), error, false );
642						}
643					} );
644				}
645			}
646		},
647
648		removeErrorAriaDescribedBy: function( element, error ) {
649
650			var describedBy = $( element ).attr( "aria-describedby" ),
651				describedByIds = describedBy.split( " " ),
652				errorID = error.attr( "id" ),
653				ind = describedByIds.indexOf( errorID );
654
655			if ( ind > -1 ) {
656				describedByIds.splice( ind, 1 );
657			}
658
659			if ( describedByIds.length ) {
660				$( element ).attr( "aria-describedby", describedByIds.join( " " ) );
661			} else {
662				$( element ).removeAttr( "aria-describedby" );
663			}
664
665		},
666
667		hideThese: function( errors ) {
668
669			for ( var i = 0; errors[ i ]; i++ ) {
670				var error = $( errors[ i ] ),
671					errorID = error.attr( "id" ) ? this.escapeCssMeta( error.attr( "id" ) ) : undefined,
672					element = ( errorID ) ? this.elements().filter( '[aria-describedby~="' + errorID + '"]' ) : [];
673
674				if ( this.settings.ariaDescribedByCleanup && element.length ) {
675					this.removeErrorAriaDescribedBy( element, error );
676				}
677
678				if ( !error.is( this.containers ) ) {
679					error.text( "" );
680				}
681
682				this.addWrapper( error ).hide();
683			}
684
685		},
686
687		valid: function() {
688			return this.size() === 0;
689		},
690
691		size: function() {
692			return this.errorList.length;
693		},
694
695		focusInvalid: function() {
696			if ( this.settings.focusInvalid ) {
697				try {
698					$( this.findLastActive() || this.errorList.length && this.errorList[ 0 ].element || [] )
699					.filter( ":visible" )
700					.trigger( "focus" )
701
702					// Manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find
703					.trigger( "focusin" );
704				} catch ( e ) {
705
706					// Ignore IE throwing errors when focusing hidden elements
707				}
708			}
709		},
710
711		findLastActive: function() {
712			var lastActive = this.lastActive;
713			return lastActive && $.grep( this.errorList, function( n ) {
714				return n.element.name === lastActive.name;
715			} ).length === 1 && lastActive;
716		},
717
718		elements: function() {
719			var validator = this,
720				rulesCache = {},
721				selectors = [ "input", "select", "textarea", "[contenteditable]" ],
722				formId = this.currentForm.getAttribute( "id" ),
723				elements;
724
725			// Select all valid inputs inside the form (no submit or reset buttons)
726			elements = $( this.currentForm )
727			.find( selectors.concat( this.settings.customElements ).join( ", " ) )
728			.not( ":submit, :reset, :image, :disabled" )
729			.not( this.settings.ignore );
730
731			// If the form has an ID, also include elements outside the form that have
732			// a form attribute pointing to this form
733			if ( formId ) {
734				elements = elements.add(
735					$( selectors.concat( this.settings.customElements ).join( ", " ) )
736					.filter( "[form='" + validator.escapeCssMeta( formId ) + "']" )
737					.not( ":submit, :reset, :image, :disabled" )
738					.not( this.settings.ignore )
739				);
740			}
741
742			return elements.filter( function() {
743				var name = this.name || $( this ).attr( "name" ); // For contenteditable
744				var isContentEditable = typeof $( this ).attr( "contenteditable" ) !== "undefined" && $( this ).attr( "contenteditable" ) !== "false";
745
746				if ( !name && validator.settings.debug && window.console ) {
747					console.error( "%o has no name assigned", this );
748				}
749
750				// Set form expando on contenteditable
751				if ( isContentEditable ) {
752					this.form = $( this ).closest( "form" )[ 0 ];
753					this.name = name;
754				}
755
756				// Ignore elements that belong to other/nested forms
757				if ( this.form !== validator.currentForm ) {
758					return false;
759				}
760
761				// Select only the first element for each name, and only those with rules specified
762				if ( name in rulesCache || !validator.objectLength( $( this ).rules() ) ) {
763					return false;
764				}
765
766				rulesCache[ name ] = true;
767				return true;
768			} );
769		},
770
771		clean: function( selector ) {
772			return $( selector )[ 0 ];
773		},
774
775		errors: function() {
776			var errorClass = this.settings.errorClass.split( " " ).join( "." );
777			return $( this.settings.errorElement + "." + errorClass, this.errorContext );
778		},
779
780		resetInternals: function() {
781			this.successList = [];
782			this.errorList = [];
783			this.errorMap = {};
784			this.toShow = $( [] );
785			this.toHide = $( [] );
786		},
787
788		reset: function() {
789			this.resetInternals();
790			this.currentElements = $( [] );
791		},
792
793		prepareForm: function() {
794			this.reset();
795			this.toHide = this.errors().add( this.containers );
796		},
797
798		prepareElement: function( element ) {
799			this.reset();
800			this.toHide = this.errorsFor( element );
801		},
802
803		elementValue: function( element ) {
804			var $element = $( element ),
805				type = element.type,
806				isContentEditable = typeof $element.attr( "contenteditable" ) !== "undefined" && $element.attr( "contenteditable" ) !== "false",
807				val, idx;
808
809			if ( type === "radio" || type === "checkbox" ) {
810				return this.findByName( element.name ).filter( ":checked" ).val();
811			} else if ( type === "number" && typeof element.validity !== "undefined" ) {
812				return element.validity.badInput ? "NaN" : $element.val();
813			}
814
815			if ( isContentEditable ) {
816				val = $element.text();
817			} else {
818				val = $element.val();
819			}
820
821			if ( type === "file" ) {
822
823				// Modern browser (chrome & safari)
824				if ( val.substr( 0, 12 ) === "C:\\fakepath\\" ) {
825					return val.substr( 12 );
826				}
827
828				// Legacy browsers
829				// Unix-based path
830				idx = val.lastIndexOf( "/" );
831				if ( idx >= 0 ) {
832					return val.substr( idx + 1 );
833				}
834
835				// Windows-based path
836				idx = val.lastIndexOf( "\\" );
837				if ( idx >= 0 ) {
838					return val.substr( idx + 1 );
839				}
840
841				// Just the file name
842				return val;
843			}
844
845			if ( typeof val === "string" ) {
846				return val.replace( /\r/g, "" );
847			}
848			return val;
849		},
850
851		check: function( element ) {
852			element = this.validationTargetFor( this.clean( element ) );
853
854			var rules = $( element ).rules(),
855				rulesCount = $.map( rules, function( n, i ) {
856					return i;
857				} ).length,
858				dependencyMismatch = false,
859				val = this.elementValue( element ),
860				result, method, rule, normalizer;
861
862			// Abort any pending Ajax request from a previous call to this method.
863			this.abortRequest( element );
864
865			// Prioritize the local normalizer defined for this element over the global one
866			// if the former exists, otherwise user the global one in case it exists.
867			if ( typeof rules.normalizer === "function" ) {
868				normalizer = rules.normalizer;
869			} else if (	typeof this.settings.normalizer === "function" ) {
870				normalizer = this.settings.normalizer;
871			}
872
873			// If normalizer is defined, then call it to retreive the changed value instead
874			// of using the real one.
875			// Note that `this` in the normalizer is `element`.
876			if ( normalizer ) {
877				val = normalizer.call( element, val );
878
879				// Delete the normalizer from rules to avoid treating it as a pre-defined method.
880				delete rules.normalizer;
881			}
882
883			for ( method in rules ) {
884				rule = { method: method, parameters: rules[ method ] };
885				try {
886					result = $.validator.methods[ method ].call( this, val, element, rule.parameters );
887
888					// If a method indicates that the field is optional and therefore valid,
889					// don't mark it as valid when there are no other rules
890					if ( result === "dependency-mismatch" && rulesCount === 1 ) {
891						dependencyMismatch = true;
892						continue;
893					}
894					dependencyMismatch = false;
895
896					if ( result === "pending" ) {
897						this.toHide = this.toHide.not( this.errorsFor( element ) );
898						return;
899					}
900
901					if ( !result ) {
902						this.formatAndAdd( element, rule );
903						return false;
904					}
905				} catch ( e ) {
906					if ( this.settings.debug && window.console ) {
907						console.log( "Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.", e );
908					}
909					if ( e instanceof TypeError ) {
910						e.message += ".  Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.";
911					}
912
913					throw e;
914				}
915			}
916			if ( dependencyMismatch ) {
917				return;
918			}
919			if ( this.objectLength( rules ) ) {
920				this.successList.push( element );
921			}
922			return true;
923		},
924
925		// Return the custom message for the given element and validation method
926		// specified in the element's HTML5 data attribute
927		// return the generic message if present and no method specific message is present
928		customDataMessage: function( element, method ) {
929			return $( element ).data( "msg" + method.charAt( 0 ).toUpperCase() +
930				method.substring( 1 ).toLowerCase() ) || $( element ).data( "msg" );
931		},
932
933		// Return the custom message for the given element name and validation method
934		customMessage: function( name, method ) {
935			var m = this.settings.messages[ name ];
936			return m && ( m.constructor === String ? m : m[ method ] );
937		},
938
939		// Return the first defined argument, allowing empty strings
940		findDefined: function() {
941			for ( var i = 0; i < arguments.length; i++ ) {
942				if ( arguments[ i ] !== undefined ) {
943					return arguments[ i ];
944				}
945			}
946			return undefined;
947		},
948
949		// The second parameter 'rule' used to be a string, and extended to an object literal
950		// of the following form:
951		// rule = {
952		//     method: "method name",
953		//     parameters: "the given method parameters"
954		// }
955		//
956		// The old behavior still supported, kept to maintain backward compatibility with
957		// old code, and will be removed in the next major release.
958		defaultMessage: function( element, rule ) {
959			if ( typeof rule === "string" ) {
960				rule = { method: rule };
961			}
962
963			var message = this.findDefined(
964					this.customMessage( element.name, rule.method ),
965					this.customDataMessage( element, rule.method ),
966
967					// 'title' is never undefined, so handle empty string as undefined
968					!this.settings.ignoreTitle && element.title || undefined,
969					$.validator.messages[ rule.method ],
970					"<strong>Warning: No message defined for " + element.name + "</strong>"
971				),
972				theregex = /\$?\{(\d+)\}/g;
973			if ( typeof message === "function" ) {
974				message = message.call( this, rule.parameters, element );
975			} else if ( theregex.test( message ) ) {
976				message = $.validator.format( message.replace( theregex, "{$1}" ), rule.parameters );
977			}
978
979			return message;
980		},
981
982		formatAndAdd: function( element, rule ) {
983			var message = this.defaultMessage( element, rule );
984
985			this.errorList.push( {
986				message: message,
987				element: element,
988				method: rule.method
989			} );
990
991			this.errorMap[ element.name ] = message;
992			this.submitted[ element.name ] = message;
993		},
994
995		addWrapper: function( toToggle ) {
996			if ( this.settings.wrapper ) {
997				toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) );
998			}
999			return toToggle;
1000		},
1001
1002		defaultShowErrors: function() {
1003			var i, elements, error;
1004
1005			for ( i = 0; this.errorList[ i ]; i++ ) {
1006				error = this.errorList[ i ];
1007				if ( this.settings.highlight ) {
1008					this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass );
1009				}
1010				this.showLabel( error.element, error.message );
1011			}
1012
1013			if ( this.errorList.length ) {
1014				this.toShow = this.toShow.add( this.containers );
1015			}
1016
1017			if ( this.settings.success ) {
1018				for ( i = 0; this.successList[ i ]; i++ ) {
1019					this.showLabel( this.successList[ i ] );
1020				}
1021			}
1022
1023			if ( this.settings.unhighlight ) {
1024				for ( i = 0, elements = this.validElements(); elements[ i ]; i++ ) {
1025					this.settings.unhighlight.call( this, elements[ i ], this.settings.errorClass, this.settings.validClass );
1026				}
1027			}
1028
1029			this.toHide = this.toHide.not( this.toShow );
1030			this.hideErrors();
1031			this.addWrapper( this.toShow ).show();
1032		},
1033
1034		validElements: function() {
1035			return this.currentElements.not( this.invalidElements() );
1036		},
1037
1038		invalidElements: function() {
1039			return $( this.errorList ).map( function() {
1040				return this.element;
1041			} );
1042		},
1043
1044		showLabel: function( element, message ) {
1045			var place,
1046				error = this.errorsFor( element ),
1047				elementID = this.idOrName( element ),
1048				describedBy = $( element ).attr( "aria-describedby" );
1049
1050			if ( error.length ) {
1051
1052				// Non-label error exists but is not currently associated with element via aria-describedby
1053				if ( error.closest( "label[for='" + this.escapeCssMeta( elementID ) + "']" ).length === 0 && ( describedBy === undefined || describedBy.split( " " ).indexOf( error.attr( "id" ) ) === -1 ) ) {
1054					this.addErrorAriaDescribedBy( element, error, true );
1055				}
1056
1057				// Refresh error/success class
1058				error.removeClass( this.settings.validClass ).addClass( this.settings.errorClass );
1059
1060				// Replace message on existing label
1061				if ( this.settings && this.settings.escapeHtml ) {
1062					error.text( message || "" );
1063				} else {
1064					error.html( message || "" );
1065				}
1066			} else {
1067
1068				// Create error element
1069				error = $( "<" + this.settings.errorElement + ">" )
1070					.attr( "id", elementID + "-error" )
1071					.addClass( this.settings.errorClass );
1072
1073				if ( this.settings && this.settings.escapeHtml ) {
1074					error.text( message || "" );
1075				} else {
1076					error.html( message || "" );
1077				}
1078
1079				// Maintain reference to the element to be placed into the DOM
1080				place = error;
1081				if ( this.settings.wrapper ) {
1082
1083					// Make sure the element is visible, even in IE
1084					// actually showing the wrapped element is handled elsewhere
1085					place = error.hide().show().wrap( "<" + this.settings.wrapper + "/>" ).parent();
1086				}
1087				if ( this.labelContainer.length ) {
1088					this.labelContainer.append( place );
1089				} else if ( this.settings.errorPlacement ) {
1090					this.settings.errorPlacement.call( this, place, $( element ) );
1091				} else {
1092					place.insertAfter( element );
1093				}
1094
1095				// Link error back to the element
1096				if ( error.is( "label" ) ) {
1097
1098					// If the error is a label, then associate using 'for'
1099					error.attr( "for", elementID );
1100
1101				// If the element is not a child of an associated label, then it's necessary
1102				// to explicitly apply aria-describedby
1103				} else if ( error.parents( "label[for='" + this.escapeCssMeta( elementID ) + "']" ).length === 0 ) {
1104					this.addErrorAriaDescribedBy( element, error, true );
1105				}
1106			}
1107			if ( !message && this.settings.success ) {
1108				error.text( "" );
1109				if ( typeof this.settings.success === "string" ) {
1110					error.addClass( this.settings.success );
1111				} else {
1112					this.settings.success( error, element );
1113				}
1114			}
1115			this.toShow = this.toShow.add( error );
1116		},
1117
1118		errorsFor: function( element ) {
1119			var name = this.escapeCssMeta( this.idOrName( element ) ),
1120				describer = $( element ).attr( "aria-describedby" ),
1121				selector = "label[for='" + name + "'], label[for='" + name + "'] *";
1122
1123			// 'aria-describedby' should directly reference the error element
1124			if ( describer ) {
1125				selector = selector + ", #" + this.escapeCssMeta( describer )
1126					.replace( /\s+/g, ", #" );
1127			}
1128
1129			// There may be hidden error elements not currently associated via aria-describedby (if ariaDescribedByCleanup is true)
1130			selector = selector + ", #" + name + "-error";
1131
1132			return this
1133				.errors()
1134				.filter( selector );
1135		},
1136
1137		// See https://api.jquery.com/category/selectors/, for CSS
1138		// meta-characters that should be escaped in order to be used with JQuery
1139		// as a literal part of a name/id or any selector.
1140		escapeCssMeta: function( string ) {
1141			if ( string === undefined ) {
1142				return "";
1143			}
1144
1145			return string.replace( /([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g, "\\$1" );
1146		},
1147
1148		idOrName: function( element ) {
1149			return this.groups[ element.name ] || ( this.checkable( element ) ? element.name : element.id || element.name );
1150		},
1151
1152		validationTargetFor: function( element ) {
1153
1154			// If radio/checkbox, validate first element in group instead
1155			if ( this.checkable( element ) ) {
1156				element = this.findByName( element.name );
1157			}
1158
1159			// Always apply ignore filter
1160			return $( element ).not( this.settings.ignore )[ 0 ];
1161		},
1162
1163		checkable: function( element ) {
1164			return ( /radio|checkbox/i ).test( element.type );
1165		},
1166
1167		findByName: function( name ) {
1168			var formId = this.currentForm.getAttribute( "id" ),
1169				selector = "[name='" + this.escapeCssMeta( name ) + "']",
1170				elements = $( this.currentForm ).find( selector );
1171
1172			// If the form has an ID, also include elements outside the form that have
1173			// a form attribute pointing to this form
1174			if ( formId ) {
1175				elements = elements.add(
1176					$( selector )
1177					.filter( "[form='" + this.escapeCssMeta( formId ) + "']" )
1178				);
1179			}
1180
1181			return elements;
1182		},
1183
1184		getLength: function( value, element ) {
1185			switch ( element.nodeName.toLowerCase() ) {
1186			case "select":
1187				return $( "option:selected", element ).length;
1188			case "input":
1189				if ( this.checkable( element ) ) {
1190					return this.findByName( element.name ).filter( ":checked" ).length;
1191				}
1192			}
1193			return value.length;
1194		},
1195
1196		depend: function( param, element ) {
1197			return this.dependTypes[ typeof param ] ? this.dependTypes[ typeof param ]( param, element ) : true;
1198		},
1199
1200		dependTypes: {
1201			"boolean": function( param ) {
1202				return param;
1203			},
1204			"string": function( param, element ) {
1205				return !!$( param, element.form ).length;
1206			},
1207			"function": function( param, element ) {
1208				return param( element );
1209			}
1210		},
1211
1212		optional: function( element ) {
1213			var val = this.elementValue( element );
1214			return !$.validator.methods.required.call( this, val, element ) && "dependency-mismatch";
1215		},
1216
1217		elementAjaxPort: function( element ) {
1218			return "validate" + element.name;
1219		},
1220
1221		startRequest: function( element ) {
1222			if ( !this.pending[ element.name ] ) {
1223				this.pendingRequest++;
1224				$( element ).addClass( this.settings.pendingClass );
1225				this.pending[ element.name ] = true;
1226			}
1227		},
1228
1229		stopRequest: function( element, valid ) {
1230			this.pendingRequest--;
1231
1232			// Sometimes synchronization fails, make sure pendingRequest is never < 0
1233			if ( this.pendingRequest < 0 ) {
1234				this.pendingRequest = 0;
1235			}
1236			delete this.pending[ element.name ];
1237			$( element ).removeClass( this.settings.pendingClass );
1238			if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() && this.pendingRequest === 0 ) {
1239				$( this.currentForm ).trigger( "submit" );
1240
1241				// Remove the hidden input that was used as a replacement for the
1242				// missing submit button. The hidden input is added by `handle()`
1243				// to ensure that the value of the used submit button is passed on
1244				// for scripted submits triggered by this method
1245				if ( this.submitButton ) {
1246					$( "input:hidden[name='" + this.submitButton.name + "']", this.currentForm ).remove();
1247				}
1248
1249				this.formSubmitted = false;
1250			} else if ( !valid && this.pendingRequest === 0 && this.formSubmitted ) {
1251				$( this.currentForm ).triggerHandler( "invalid-form", [ this ] );
1252				this.formSubmitted = false;
1253			}
1254		},
1255
1256		abortRequest: function( element ) {
1257			var port;
1258
1259			if ( this.pending[ element.name ] ) {
1260				port = this.elementAjaxPort( element );
1261				$.ajaxAbort( port );
1262
1263				this.pendingRequest--;
1264
1265				// Sometimes synchronization fails, make sure pendingRequest is never < 0
1266				if ( this.pendingRequest < 0 ) {
1267					this.pendingRequest = 0;
1268				}
1269
1270				delete this.pending[ element.name ];
1271				$( element ).removeClass( this.settings.pendingClass );
1272			}
1273		},
1274
1275		previousValue: function( element, method ) {
1276			method = typeof method === "string" && method || "remote";
1277
1278			return $.data( element, "previousValue" ) || $.data( element, "previousValue", {
1279				old: null,
1280				valid: true,
1281				message: this.defaultMessage( element, { method: method } )
1282			} );
1283		},
1284
1285		// Cleans up all forms and elements, removes validator-specific events
1286		destroy: function() {
1287			this.resetForm();
1288
1289			$( this.currentForm )
1290				.off( ".validate" )
1291				.removeData( "validator" )
1292				.find( ".validate-equalTo-blur" )
1293					.off( ".validate-equalTo" )
1294					.removeClass( "validate-equalTo-blur" )
1295				.find( ".validate-lessThan-blur" )
1296					.off( ".validate-lessThan" )
1297					.removeClass( "validate-lessThan-blur" )
1298				.find( ".validate-lessThanEqual-blur" )
1299					.off( ".validate-lessThanEqual" )
1300					.removeClass( "validate-lessThanEqual-blur" )
1301				.find( ".validate-greaterThanEqual-blur" )
1302					.off( ".validate-greaterThanEqual" )
1303					.removeClass( "validate-greaterThanEqual-blur" )
1304				.find( ".validate-greaterThan-blur" )
1305					.off( ".validate-greaterThan" )
1306					.removeClass( "validate-greaterThan-blur" );
1307		}
1308
1309	},
1310
1311	classRuleSettings: {
1312		required: { required: true },
1313		email: { email: true },
1314		url: { url: true },
1315		date: { date: true },
1316		dateISO: { dateISO: true },
1317		number: { number: true },
1318		digits: { digits: true },
1319		creditcard: { creditcard: true }
1320	},
1321
1322	addClassRules: function( className, rules ) {
1323		if ( className.constructor === String ) {
1324			this.classRuleSettings[ className ] = rules;
1325		} else {
1326			$.extend( this.classRuleSettings, className );
1327		}
1328	},
1329
1330	classRules: function( element ) {
1331		var rules = {},
1332			classes = $( element ).attr( "class" );
1333
1334		if ( classes ) {
1335			$.each( classes.split( " " ), function() {
1336				if ( this in $.validator.classRuleSettings ) {
1337					$.extend( rules, $.validator.classRuleSettings[ this ] );
1338				}
1339			} );
1340		}
1341		return rules;
1342	},
1343
1344	normalizeAttributeRule: function( rules, type, method, value ) {
1345
1346		// Convert the value to a number for number inputs, and for text for backwards compability
1347		// allows type="date" and others to be compared as strings
1348		if ( /min|max|step/.test( method ) && ( type === null || /number|range|text/.test( type ) ) ) {
1349			value = Number( value );
1350
1351			// Support Opera Mini, which returns NaN for undefined minlength
1352			if ( isNaN( value ) ) {
1353				value = undefined;
1354			}
1355		}
1356
1357		if ( value || value === 0 ) {
1358			rules[ method ] = value;
1359		} else if ( type === method && type !== "range" ) {
1360
1361			// Exception: the jquery validate 'range' method
1362			// does not test for the html5 'range' type
1363			rules[ type === "date" ? "dateISO" : method ] = true;
1364		}
1365	},
1366
1367	attributeRules: function( element ) {
1368		var rules = {},
1369			$element = $( element ),
1370			type = element.getAttribute( "type" ),
1371			method, value;
1372
1373		for ( method in $.validator.methods ) {
1374
1375			// Support for <input required> in both html5 and older browsers
1376			if ( method === "required" ) {
1377				value = element.getAttribute( method );
1378
1379				// Some browsers return an empty string for the required attribute
1380				// and non-HTML5 browsers might have required="" markup
1381				if ( value === "" ) {
1382					value = true;
1383				}
1384
1385				// Force non-HTML5 browsers to return bool
1386				value = !!value;
1387			} else {
1388				value = $element.attr( method );
1389			}
1390
1391			this.normalizeAttributeRule( rules, type, method, value );
1392		}
1393
1394		// 'maxlength' may be returned as -1, 2147483647 ( IE ) and 524288 ( safari ) for text inputs
1395		if ( rules.maxlength && /-1|2147483647|524288/.test( rules.maxlength ) ) {
1396			delete rules.maxlength;
1397		}
1398
1399		return rules;
1400	},
1401
1402	dataRules: function( element ) {
1403		var rules = {},
1404			$element = $( element ),
1405			type = element.getAttribute( "type" ),
1406			method, value;
1407
1408		for ( method in $.validator.methods ) {
1409			value = $element.data( "rule" + method.charAt( 0 ).toUpperCase() + method.substring( 1 ).toLowerCase() );
1410
1411			// Cast empty attributes like `data-rule-required` to `true`
1412			if ( value === "" ) {
1413				value = true;
1414			}
1415
1416			this.normalizeAttributeRule( rules, type, method, value );
1417		}
1418		return rules;
1419	},
1420
1421	staticRules: function( element ) {
1422		var rules = {},
1423			validator = $.data( element.form, "validator" );
1424
1425		if ( validator.settings.rules ) {
1426			rules = $.validator.normalizeRule( validator.settings.rules[ element.name ] ) || {};
1427		}
1428		return rules;
1429	},
1430
1431	normalizeRules: function( rules, element ) {
1432
1433		// Handle dependency check
1434		$.each( rules, function( prop, val ) {
1435
1436			// Ignore rule when param is explicitly false, eg. required:false
1437			if ( val === false ) {
1438				delete rules[ prop ];
1439				return;
1440			}
1441			if ( val.param || val.depends ) {
1442				var keepRule = true;
1443				switch ( typeof val.depends ) {
1444				case "string":
1445					keepRule = !!$( val.depends, element.form ).length;
1446					break;
1447				case "function":
1448					keepRule = val.depends.call( element, element );
1449					break;
1450				}
1451				if ( keepRule ) {
1452					rules[ prop ] = val.param !== undefined ? val.param : true;
1453				} else {
1454					$.data( element.form, "validator" ).resetElements( $( element ) );
1455					delete rules[ prop ];
1456				}
1457			}
1458		} );
1459
1460		// Evaluate parameters
1461		$.each( rules, function( rule, parameter ) {
1462			rules[ rule ] = typeof parameter === "function" && rule !== "normalizer" ? parameter( element ) : parameter;
1463		} );
1464
1465		// Clean number parameters
1466		$.each( [ "minlength", "maxlength" ], function() {
1467			if ( rules[ this ] ) {
1468				rules[ this ] = Number( rules[ this ] );
1469			}
1470		} );
1471		$.each( [ "rangelength", "range" ], function() {
1472			var parts;
1473			if ( rules[ this ] ) {
1474				if ( Array.isArray( rules[ this ] ) ) {
1475					rules[ this ] = [ Number( rules[ this ][ 0 ] ), Number( rules[ this ][ 1 ] ) ];
1476				} else if ( typeof rules[ this ] === "string" ) {
1477					parts = rules[ this ].replace( /[\[\]]/g, "" ).split( /[\s,]+/ );
1478					rules[ this ] = [ Number( parts[ 0 ] ), Number( parts[ 1 ] ) ];
1479				}
1480			}
1481		} );
1482
1483		if ( $.validator.autoCreateRanges ) {
1484
1485			// Auto-create ranges
1486			if ( rules.min != null && rules.max != null ) {
1487				rules.range = [ rules.min, rules.max ];
1488				delete rules.min;
1489				delete rules.max;
1490			}
1491			if ( rules.minlength != null && rules.maxlength != null ) {
1492				rules.rangelength = [ rules.minlength, rules.maxlength ];
1493				delete rules.minlength;
1494				delete rules.maxlength;
1495			}
1496		}
1497
1498		return rules;
1499	},
1500
1501	// Converts a simple string to a {string: true} rule, e.g., "required" to {required:true}
1502	normalizeRule: function( data ) {
1503		if ( typeof data === "string" ) {
1504			var transformed = {};
1505			$.each( data.split( /\s/ ), function() {
1506				transformed[ this ] = true;
1507			} );
1508			data = transformed;
1509		}
1510		return data;
1511	},
1512
1513	// https://jqueryvalidation.org/jQuery.validator.addMethod/
1514	addMethod: function( name, method, message ) {
1515		$.validator.methods[ name ] = method;
1516		$.validator.messages[ name ] = message !== undefined ? message : $.validator.messages[ name ];
1517		if ( method.length < 3 ) {
1518			$.validator.addClassRules( name, $.validator.normalizeRule( name ) );
1519		}
1520	},
1521
1522	// https://jqueryvalidation.org/jQuery.validator.methods/
1523	methods: {
1524
1525		// https://jqueryvalidation.org/required-method/
1526		required: function( value, element, param ) {
1527
1528			// Check if dependency is met
1529			if ( !this.depend( param, element ) ) {
1530				return "dependency-mismatch";
1531			}
1532			if ( element.nodeName.toLowerCase() === "select" ) {
1533
1534				// Could be an array for select-multiple or a string, both are fine this way
1535				var val = $( element ).val();
1536				return val && val.length > 0;
1537			}
1538			if ( this.checkable( element ) ) {
1539				return this.getLength( value, element ) > 0;
1540			}
1541			return value !== undefined && value !== null && value.length > 0;
1542		},
1543
1544		// https://jqueryvalidation.org/email-method/
1545		email: function( value, element ) {
1546
1547			// From https://html.spec.whatwg.org/multipage/forms.html#valid-e-mail-address
1548			// Retrieved 2014-01-14
1549			// If you have a problem with this implementation, report a bug against the above spec
1550			// Or use custom methods to implement your own email validation
1551			return this.optional( element ) || /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test( value );
1552		},
1553
1554		// https://jqueryvalidation.org/url-method/
1555		url: function( value, element ) {
1556
1557			// Copyright (c) 2010-2013 Diego Perini, MIT licensed
1558			// https://gist.github.com/dperini/729294
1559			// see also https://mathiasbynens.be/demo/url-regex
1560			// modified to allow protocol-relative URLs
1561			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 );
1562		},
1563
1564		// https://jqueryvalidation.org/date-method/
1565		date: ( function() {
1566			var called = false;
1567
1568			return function( value, element ) {
1569				if ( !called ) {
1570					called = true;
1571					if ( this.settings.debug && window.console ) {
1572						console.warn(
1573							"The `date` method is deprecated and will be removed in version '2.0.0'.\n" +
1574							"Please don't use it, since it relies on the Date constructor, which\n" +
1575							"behaves very differently across browsers and locales. Use `dateISO`\n" +
1576							"instead or one of the locale specific methods in `localizations/`\n" +
1577							"and `additional-methods.js`."
1578						);
1579					}
1580				}
1581
1582				return this.optional( element ) || !/Invalid|NaN/.test( new Date( value ).toString() );
1583			};
1584		}() ),
1585
1586		// https://jqueryvalidation.org/dateISO-method/
1587		dateISO: function( value, element ) {
1588			return this.optional( element ) || /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test( value );
1589		},
1590
1591		// https://jqueryvalidation.org/number-method/
1592		number: function( value, element ) {
1593			return this.optional( element ) || /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:-?\.\d+)?$/.test( value );
1594		},
1595
1596		// https://jqueryvalidation.org/digits-method/
1597		digits: function( value, element ) {
1598			return this.optional( element ) || /^\d+$/.test( value );
1599		},
1600
1601		// https://jqueryvalidation.org/minlength-method/
1602		minlength: function( value, element, param ) {
1603			var length = Array.isArray( value ) ? value.length : this.getLength( value, element );
1604			return this.optional( element ) || length >= param;
1605		},
1606
1607		// https://jqueryvalidation.org/maxlength-method/
1608		maxlength: function( value, element, param ) {
1609			var length = Array.isArray( value ) ? value.length : this.getLength( value, element );
1610			return this.optional( element ) || length <= param;
1611		},
1612
1613		// https://jqueryvalidation.org/rangelength-method/
1614		rangelength: function( value, element, param ) {
1615			var length = Array.isArray( value ) ? value.length : this.getLength( value, element );
1616			return this.optional( element ) || ( length >= param[ 0 ] && length <= param[ 1 ] );
1617		},
1618
1619		// https://jqueryvalidation.org/min-method/
1620		min: function( value, element, param ) {
1621			return this.optional( element ) || value >= param;
1622		},
1623
1624		// https://jqueryvalidation.org/max-method/
1625		max: function( value, element, param ) {
1626			return this.optional( element ) || value <= param;
1627		},
1628
1629		// https://jqueryvalidation.org/range-method/
1630		range: function( value, element, param ) {
1631			return this.optional( element ) || ( value >= param[ 0 ] && value <= param[ 1 ] );
1632		},
1633
1634		// https://jqueryvalidation.org/step-method/
1635		step: function( value, element, param ) {
1636			var type = $( element ).attr( "type" ),
1637				errorMessage = "Step attribute on input type " + type + " is not supported.",
1638				supportedTypes = [ "text", "number", "range" ],
1639				re = new RegExp( "\\b" + type + "\\b" ),
1640				notSupported = type && !re.test( supportedTypes.join() ),
1641				decimalPlaces = function( num ) {
1642					var match = ( "" + num ).match( /(?:\.(\d+))?$/ );
1643					if ( !match ) {
1644						return 0;
1645					}
1646
1647					// Number of digits right of decimal point.
1648					return match[ 1 ] ? match[ 1 ].length : 0;
1649				},
1650				toInt = function( num ) {
1651					return Math.round( num * Math.pow( 10, decimals ) );
1652				},
1653				valid = true,
1654				decimals;
1655
1656			// Works only for text, number and range input types
1657			// TODO find a way to support input types date, datetime, datetime-local, month, time and week
1658			if ( notSupported ) {
1659				throw new Error( errorMessage );
1660			}
1661
1662			decimals = decimalPlaces( param );
1663
1664			// Value can't have too many decimals
1665			if ( decimalPlaces( value ) > decimals || toInt( value ) % toInt( param ) !== 0 ) {
1666				valid = false;
1667			}
1668
1669			return this.optional( element ) || valid;
1670		},
1671
1672		// https://jqueryvalidation.org/equalTo-method/
1673		equalTo: function( value, element, param ) {
1674
1675			// Bind to the blur event of the target in order to revalidate whenever the target field is updated
1676			var target = $( param );
1677			if ( this.settings.onfocusout && target.not( ".validate-equalTo-blur" ).length ) {
1678				target.addClass( "validate-equalTo-blur" ).on( "blur.validate-equalTo", function() {
1679					$( element ).valid();
1680				} );
1681			}
1682			return value === target.val();
1683		},
1684
1685		// https://jqueryvalidation.org/remote-method/
1686		remote: function( value, element, param, method ) {
1687			if ( this.optional( element ) ) {
1688				return "dependency-mismatch";
1689			}
1690
1691			method = typeof method === "string" && method || "remote";
1692
1693			var previous = this.previousValue( element, method ),
1694				validator, data, optionDataString;
1695
1696			if ( !this.settings.messages[ element.name ] ) {
1697				this.settings.messages[ element.name ] = {};
1698			}
1699			previous.originalMessage = previous.originalMessage || this.settings.messages[ element.name ][ method ];
1700			this.settings.messages[ element.name ][ method ] = previous.message;
1701
1702			param = typeof param === "string" && { url: param } || param;
1703			optionDataString = $.param( $.extend( { data: value }, param.data ) );
1704			if ( previous.valid !== null && previous.old === optionDataString ) {
1705				return previous.valid;
1706			}
1707
1708			previous.old = optionDataString;
1709			previous.valid = null;
1710			validator = this;
1711			this.startRequest( element );
1712			data = {};
1713			data[ element.name ] = value;
1714			$.ajax( $.extend( true, {
1715				mode: "abort",
1716				port: this.elementAjaxPort( element ),
1717				dataType: "json",
1718				data: data,
1719				context: validator.currentForm,
1720				success: function( response ) {
1721					var valid = response === true || response === "true",
1722						errors, message, submitted;
1723
1724					validator.settings.messages[ element.name ][ method ] = previous.originalMessage;
1725					if ( valid ) {
1726						submitted = validator.formSubmitted;
1727						validator.toHide = validator.errorsFor( element );
1728						validator.formSubmitted = submitted;
1729						validator.successList.push( element );
1730						validator.invalid[ element.name ] = false;
1731						validator.showErrors();
1732					} else {
1733						errors = {};
1734						message = response || validator.defaultMessage( element, { method: method, parameters: value } );
1735						errors[ element.name ] = previous.message = message;
1736						validator.invalid[ element.name ] = true;
1737						validator.showErrors( errors );
1738					}
1739					previous.valid = valid;
1740					validator.stopRequest( element, valid );
1741				}
1742			}, param ) );
1743			return "pending";
1744		}
1745	}
1746
1747} );
1748
1749// Ajax mode: abort
1750// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]});
1751//        $.ajaxAbort( port );
1752// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort()
1753
1754var pendingRequests = {},
1755	ajax;
1756
1757// Use a prefilter if available (1.5+)
1758if ( $.ajaxPrefilter ) {
1759	$.ajaxPrefilter( function( settings, _, xhr ) {
1760		var port = settings.port;
1761		if ( settings.mode === "abort" ) {
1762			$.ajaxAbort( port );
1763			pendingRequests[ port ] = xhr;
1764		}
1765	} );
1766} else {
1767
1768	// Proxy ajax
1769	ajax = $.ajax;
1770	$.ajax = function( settings ) {
1771		var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode,
1772			port = ( "port" in settings ? settings : $.ajaxSettings ).port;
1773		if ( mode === "abort" ) {
1774			$.ajaxAbort( port );
1775			pendingRequests[ port ] = ajax.apply( this, arguments );
1776			return pendingRequests[ port ];
1777		}
1778		return ajax.apply( this, arguments );
1779	};
1780}
1781
1782// Abort the previous request without sending a new one
1783$.ajaxAbort = function( port ) {
1784	if ( pendingRequests[ port ] ) {
1785		pendingRequests[ port ].abort();
1786		delete pendingRequests[ port ];
1787	}
1788};
1789return $;
1790}))

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.