Permalink
Browse files

Core: Don't trim value in min/max/rangelength methods

Fixes #1274
  • Loading branch information...
jzaefferer committed Sep 23, 2014
1 parent 20f3e9f commit 452b823c86a1a106f40625e75323cc8d68395207
Showing with 4 additions and 4 deletions.
  1. +3 −3 src/core.js
  2. +1 −1 test/methods.js
View
@@ -1187,19 +1187,19 @@ $.extend( $.validator, {
// http://jqueryvalidation.org/minlength-method/
minlength: function( value, element, param ) {
- var length = $.isArray( value ) ? value.length : this.getLength( $.trim( value ), element );
+ var length = $.isArray( value ) ? value.length : this.getLength( value, element );
return this.optional( element ) || length >= param;
},
// http://jqueryvalidation.org/maxlength-method/
maxlength: function( value, element, param ) {
- var length = $.isArray( value ) ? value.length : this.getLength( $.trim( value ), element );
+ var length = $.isArray( value ) ? value.length : this.getLength( value, element );
return this.optional( element ) || length <= param;
},
// http://jqueryvalidation.org/rangelength-method/
rangelength: function( value, element, param ) {
- var length = $.isArray( value ) ? value.length : this.getLength( $.trim( value ), element );
+ var length = $.isArray( value ) ? value.length : this.getLength( value, element );
return this.optional( element ) || ( length >= param[ 0 ] && length <= param[ 1 ] );
},
View
@@ -236,7 +236,7 @@ test("minlength", function() {
param = 2,
e = $("#text1, #text1c, #text2, #text3");
ok( method.call( v, e[0].value, e[0], param), "Valid text input" );
- ok(!method.call( v, e[1].value, e[1], param), "Invalid text input" );
+ ok( method.call( v, e[1].value, e[1], param), "Valid text input" );
ok(!method.call( v, e[2].value, e[2], param), "Invalid text input" );
ok( method.call( v, e[3].value, e[3], param), "Valid text input" );

0 comments on commit 452b823

Please sign in to comment.