Skip to content

Commit 74f4439

Browse files
author
Zach Shepherd
committed
Mask: fix isValid logic; previously, any call to getValue(true) resulted in isValid being set to true
1 parent 26c1864 commit 74f4439

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

ui/jquery.ui.mask.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ $.widget( "ui.mask", {
124124
this.isEmpty = this.isValid = true;
125125
for ( bufferPosition = 0; bufferPosition < bufferLength; bufferPosition += bufferObject.length ) {
126126
bufferObject = this.buffer[ bufferPosition ];
127-
if ( bufferObject.literal && !raw ) {
128-
if ( bufferPosition < this.optionalPosition || this.isValid ) {
127+
if ( bufferObject.literal ) {
128+
if ( !raw && bufferPosition < this.optionalPosition || this.isValid ) {
129129
value += bufferObject.literal;
130130
}
131131
} else if ( bufferObject.value ) {
@@ -135,9 +135,11 @@ $.widget( "ui.mask", {
135135
for ( counter = bufferObject.value.length; counter < bufferObject.length; counter++ ) {
136136
value += this.options.placeholder;
137137
}
138-
} else if ( !raw ) {
139-
for ( counter = bufferObject.length ; counter; counter-- ) {
140-
value += this.options.placeholder;
138+
} else {
139+
if ( !raw ) {
140+
for ( counter = bufferObject.length ; counter; counter-- ) {
141+
value += this.options.placeholder;
142+
}
141143
}
142144
if ( bufferPosition < this.optionalPosition ) {
143145
this.isValid = false;

0 commit comments

Comments
 (0)