mirror of
https://github.com/jquery-validation/jquery-validation.git
synced 2025-12-14 20:35:47 +01:00
Core: Stop trimming value inside required method
There was never much of a point anyway, and it causes problems. Fixes #1498
This commit is contained in:
@@ -1143,7 +1143,7 @@ $.extend( $.validator, {
|
|||||||
if ( this.checkable( element ) ) {
|
if ( this.checkable( element ) ) {
|
||||||
return this.getLength( value, element ) > 0;
|
return this.getLength( value, element ) > 0;
|
||||||
}
|
}
|
||||||
return $.trim( value ).length > 0;
|
return value.length > 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
// http://jqueryvalidation.org/email-method/
|
// http://jqueryvalidation.org/email-method/
|
||||||
|
|||||||
@@ -203,7 +203,7 @@
|
|||||||
</form>
|
</form>
|
||||||
<form id="form" action="formaction">
|
<form id="form" action="formaction">
|
||||||
<input type="text" name="action" value="Test" id="text1">
|
<input type="text" name="action" value="Test" id="text1">
|
||||||
<input type="text" name="text2" value=" " id="text1b">
|
<input type="text" name="text2" value="" id="text1b">
|
||||||
<input type="text" name="text2" value="T " id="text1c">
|
<input type="text" name="text2" value="T " id="text1c">
|
||||||
<input type="text" name="text2" value="T" id="text2">
|
<input type="text" name="text2" value="T" id="text2">
|
||||||
<input type="text" name="text2" value="TestTestTest" id="text3">
|
<input type="text" name="text2" value="TestTestTest" id="text3">
|
||||||
|
|||||||
@@ -186,10 +186,10 @@ test("required", function() {
|
|||||||
e = $("#text1, #text1b, #hidden2, #select1, #select2");
|
e = $("#text1, #text1b, #hidden2, #select1, #select2");
|
||||||
ok( method.call( v, e[0].value, e[0]), "Valid text input" );
|
ok( method.call( v, e[0].value, e[0]), "Valid text input" );
|
||||||
ok(!method.call( v, e[1].value, e[1]), "Invalid text input" );
|
ok(!method.call( v, e[1].value, e[1]), "Invalid text input" );
|
||||||
ok(!method.call( v, e[1].value, e[2]), "Invalid text input" );
|
ok(!method.call( v, e[2].value, e[2]), "Invalid text input" );
|
||||||
|
|
||||||
ok(!method.call( v, e[2].value, e[3]), "Invalid select" );
|
ok(!method.call( v, e[3].value, e[3]), "Invalid select" );
|
||||||
ok( method.call( v, e[3].value, e[4]), "Valid select" );
|
ok( method.call( v, e[4].value, e[4]), "Valid select" );
|
||||||
|
|
||||||
e = $("#area1, #area2, #pw1, #pw2");
|
e = $("#area1, #area2, #pw1, #pw2");
|
||||||
ok( method.call( v, e[0].value, e[0]), "Valid textarea" );
|
ok( method.call( v, e[0].value, e[0]), "Valid textarea" );
|
||||||
|
|||||||
Reference in New Issue
Block a user