Core: Fix lint errors, add test

This commit is contained in:
Daniel Orner
2015-02-27 15:51:19 -05:00
committed by Daniel Orner
parent 3d0cd6f2a5
commit b76c83e742
3 changed files with 28 additions and 6 deletions

View File

@@ -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" ) {