mirror of
https://github.com/jquery-validation/jquery-validation.git
synced 2025-12-14 20:35:47 +01:00
Core: Fix lint errors, add test
This commit is contained in:
committed by
Daniel Orner
parent
3d0cd6f2a5
commit
b76c83e742
17
src/core.js
17
src/core.js
@@ -555,16 +555,22 @@ $.extend( $.validator, {
|
||||
.not( ":submit, :reset, :image, :disabled" )
|
||||
.not( this.settings.ignore )
|
||||
.filter( function() {
|
||||
if ( !this.name && validator.settings.debug && window.console ) {
|
||||
var name = this.name || $(this).attr("name"); // for contenteditable
|
||||
if ( !name && validator.settings.debug && window.console ) {
|
||||
console.error( "%o has no name assigned", this );
|
||||
}
|
||||
|
||||
// set form expando on contenteditable
|
||||
if (this.hasAttribute("contenteditable")) {
|
||||
this.form = $(this).closest("form")[0];
|
||||
}
|
||||
|
||||
// select only the first element for each name, and only those with rules specified
|
||||
if ( this.name in rulesCache || !validator.objectLength( $( this ).rules() ) ) {
|
||||
if ( name in rulesCache || !validator.objectLength( $( this ).rules() ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
rulesCache[ this.name ] = true;
|
||||
rulesCache[ name ] = true;
|
||||
return true;
|
||||
} );
|
||||
},
|
||||
@@ -608,10 +614,9 @@ $.extend( $.validator, {
|
||||
return element.validity.badInput ? false : $element.val();
|
||||
}
|
||||
|
||||
if (element.hasAttribute('contenteditable')) {
|
||||
if (element.hasAttribute("contenteditable")) {
|
||||
val = $element.text();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
val = $element.val();
|
||||
}
|
||||
if ( typeof val === "string" ) {
|
||||
|
||||
Reference in New Issue
Block a user