Skip to content

Commit c198114

Browse files
committed
Fixed bug in IE8 preventing modules from loading, issue victorjonsson#110
1 parent 703dd55 commit c198114

13 files changed

+33
-39
lines changed

form-validator/date.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* @website http://formvalidator.net/#location-validators
1212
* @license Dual licensed under the MIT or GPL Version 2 licenses
13-
* @version 2.1.63
13+
* @version 2.1.66
1414
*/
1515
(function($) {
1616

form-validator/file.dev.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* @website http://formvalidator.net/
1212
* @license Dual licensed under the MIT or GPL Version 2 licenses
13-
* @version 2.1.63
13+
* @version 2.1.66
1414
*/
1515
(function($, window) {
1616

@@ -56,7 +56,7 @@
5656
return valid;
5757

5858
} else {
59-
return $.formUtils.validators.extension.validatorFunction(str, $input);
59+
return $.formUtils.validators.validate_extension.validatorFunction(str, $input);
6060
}
6161
},
6262
errorMessage : 'The file you are trying to upload is of wrong type',

form-validator/file.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

form-validator/form-test.html

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,13 @@
161161
(<span id="max-len">20</span> chars left)<br />
162162
<textarea id="text-area" class="form-control" name="some-text"></textarea>
163163
</div>
164-
165164
<div class="form-group">
166165
<label class="control-label">Server validation</label>
167166
<input class="form-control" name="code"
168167
data-validation-help="The word is &quot;secret&quot;"
169168
data-validation="alphanumeric server"
170169
data-validation-url="http://formvalidator.net/validate-email.php" />
171170
</div>
172-
173171
<div class="form-group">
174172
<label class="control-label">File validation</label>
175173
<input type="file" name="some-file1" class="form-control"
@@ -179,19 +177,6 @@
179177
data-validation-allowing="jpg, png, ico"
180178
data-validation-max-size="100kb" />
181179
</div>
182-
183-
<div class="form-group">
184-
<label class="control-label">File validation (multiple)</label>
185-
<input type="file" multiple="multiple" name="some-file2" class="form-control"
186-
data-validation="size mime required length"
187-
data-validation-length="min2"
188-
data-validation-size-error-msg="The images may be max 100kb"
189-
data-validation-length-error-msg="You have to upload at least (two) images"
190-
data-validation-error-msg="You have to upload at least two images"
191-
data-validation-allowing="jpg, png, ico"
192-
data-validation-max-size="100kb" />
193-
</div>
194-
195180
<div class="form-group">
196181
<label class="control-label">
197182
Callback validation, set this value to &quot;1&quot; and
@@ -324,7 +309,7 @@ <h2>HTML5 attributes</h2>
324309
<script>
325310
(function($, window) {
326311

327-
var dev = window.location.hash.indexOf('dev') > -1 ? '.dev' : '';
312+
var dev = '.dev'; //window.location.hash.indexOf('dev') > -1 ? '.dev' : '';
328313

329314
// setup datepicker
330315
$("#datepicker").datepicker();

form-validator/html5.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*
1818
* @website http://formvalidator.net/
1919
* @license Dual licensed under the MIT or GPL Version 2 licenses
20-
* @version 2.1.63
20+
* @version 2.1.66
2121
*/
2222
(function($, window) {
2323

form-validator/jquery.form-validator.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* @website http://formvalidator.net/
77
* @license Dual licensed under the MIT or GPL Version 2 licenses
8-
* @version 2.1.63
8+
* @version 2.1.66
99
*/
1010
(function($) {
1111

@@ -538,11 +538,12 @@
538538
.unbind('submit.validation')
539539
.unbind('reset.validation')
540540
.find('input[data-validation],textarea[data-validation]')
541-
.unbind('blur.validation')
541+
.unbind('blur.validation');
542542

543543
// Validate when submitted
544544
$form.bind('submit.validation', function() {
545545
var $form = $(this);
546+
546547
if($.formUtils.isLoadingModules) {
547548
setTimeout(function() {
548549
$form.trigger('submit.validation');
@@ -699,6 +700,7 @@
699700

700701
var hasLoadedAnyModule = false,
701702
loadModuleScripts = function(modules, path) {
703+
702704
var moduleList = $.split(modules),
703705
numModules = moduleList.length,
704706
moduleLoadedCallback = function() {
@@ -743,8 +745,11 @@
743745
script.src = scriptUrl + ( scriptUrl.substr(-7) == '.dev.js' ? cacheSuffix:'' );
744746
script.onreadystatechange = function() {
745747
// IE 7 fix
746-
if( this.readyState == 'complete' ) {
748+
if( this.readyState == 'complete' || this.readyState == 'loaded' ) {
747749
moduleLoadedCallback();
750+
// Handle memory leak in IE
751+
this.onload = null;
752+
this.onreadystatechange = null;
748753
}
749754
};
750755
appendToElement.appendChild( script );

form-validator/jquery.form-validator.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

form-validator/location.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* @website http://formvalidator.net/#location-validators
1212
* @license Dual licensed under the MIT or GPL Version 2 licenses
13-
* @version 2.1.63
13+
* @version 2.1.66
1414
*/
1515
(function($) {
1616

form-validator/qunit.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@
231231
{val:input('4000000000000002', {'allowing':'mastercard, discover, visa', '':'creditcard'}), isValid:true},
232232
{val:input('501800000009', {'allowing':'maestro', '':'creditcard'}), isValid:true},
233233
{val:input('501800000009', {'allowing':'visa', '':'creditcard'}), isValid:false},
234-
{val:input('501800000009', {'allowing':'jadajada,maestro,master', '':'creditcard'}), isValid:true},
234+
{val:input('501800000009', {'allowing':'jadajada,maestro,mastercard', '':'creditcard'}), isValid:true},
235235
{val:input('5100000000000008', {'allowing':'mastercard', '':'creditcard'}), isValid:true},
236236
{val:input('6011000000000004', {'allowing':'discover', '':'creditcard'}), isValid:true},
237237
{val:input('6011000000000005', {'allowing':'discover', '':'creditcard'}), isValid:false}

form-validator/security.dev.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
* - strength
1111
* - backend
1212
* - credit card
13+
* - cvv
1314
*
1415
* @website http://formvalidator.net/#security-validators
15-
* @version 2.1.63
16+
* @version 2.1.66
1617
*/
17-
(function($) {
18+
(function($, window) {
1819

1920
'use strict';
2021

@@ -62,11 +63,9 @@
6263
validatorFunction : function(value, $el, config, language, $form) {
6364
var cards = {
6465
'amex' : [15,15],
65-
'diners_club_carte_blanche' : [14,14],
66-
'diners_club_international' : [14,14],
66+
'diners_club' : [14,14],
6767
'cjb' : [16,16],
6868
'laser' : [16,19],
69-
'visa_electron' : [16,16],
7069
'visa' : [16,16],
7170
'mastercard' : [16,16],
7271
'maestro' : [12,19],
@@ -324,8 +323,13 @@
324323
cache : false,
325324
data : $element.attr('name')+'='+val,
326325
dataType : 'json',
326+
error : function(error) {
327+
alert('Server validation failed due to: '+error.statusText);
328+
if( window.JSON && window.JSON.stringify ) {
329+
alert(window.JSON.stringify(error));
330+
}
331+
},
327332
success : function(response) {
328-
329333
if(response.valid) {
330334
$element.valAttr('backend-valid', 'true');
331335
}
@@ -435,4 +439,4 @@
435439
return this;
436440
};
437441

438-
})(jQuery);
442+
})(jQuery, window);

0 commit comments

Comments
 (0)