Skip to content

Commit

Permalink
Fixed bug in IE8 preventing modules from loading, issue victorjonsson…
Browse files Browse the repository at this point in the history
  • Loading branch information
victorjonsson committed May 6, 2014
1 parent 703dd55 commit c198114
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 39 deletions.
2 changes: 1 addition & 1 deletion form-validator/date.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
* @website http://formvalidator.net/#location-validators
* @license Dual licensed under the MIT or GPL Version 2 licenses
* @version 2.1.63
* @version 2.1.66
*/
(function($) {

Expand Down
4 changes: 2 additions & 2 deletions form-validator/file.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
* @website http://formvalidator.net/
* @license Dual licensed under the MIT or GPL Version 2 licenses
* @version 2.1.63
* @version 2.1.66
*/
(function($, window) {

Expand Down Expand Up @@ -56,7 +56,7 @@
return valid;

} else {
return $.formUtils.validators.extension.validatorFunction(str, $input);
return $.formUtils.validators.validate_extension.validatorFunction(str, $input);
}
},
errorMessage : 'The file you are trying to upload is of wrong type',
Expand Down
2 changes: 1 addition & 1 deletion form-validator/file.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 1 addition & 16 deletions form-validator/form-test.html
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,13 @@
(<span id="max-len">20</span> chars left)<br />
<textarea id="text-area" class="form-control" name="some-text"></textarea>
</div>

<div class="form-group">
<label class="control-label">Server validation</label>
<input class="form-control" name="code"
data-validation-help="The word is &quot;secret&quot;"
data-validation="alphanumeric server"
data-validation-url="http://formvalidator.net/validate-email.php" />
</div>

<div class="form-group">
<label class="control-label">File validation</label>
<input type="file" name="some-file1" class="form-control"
Expand All @@ -179,19 +177,6 @@
data-validation-allowing="jpg, png, ico"
data-validation-max-size="100kb" />
</div>

<div class="form-group">
<label class="control-label">File validation (multiple)</label>
<input type="file" multiple="multiple" name="some-file2" class="form-control"
data-validation="size mime required length"
data-validation-length="min2"
data-validation-size-error-msg="The images may be max 100kb"
data-validation-length-error-msg="You have to upload at least (two) images"
data-validation-error-msg="You have to upload at least two images"
data-validation-allowing="jpg, png, ico"
data-validation-max-size="100kb" />
</div>

<div class="form-group">
<label class="control-label">
Callback validation, set this value to &quot;1&quot; and
Expand Down Expand Up @@ -324,7 +309,7 @@ <h2>HTML5 attributes</h2>
<script>
(function($, window) {

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

// setup datepicker
$("#datepicker").datepicker();
Expand Down
2 changes: 1 addition & 1 deletion form-validator/html5.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
* @website http://formvalidator.net/
* @license Dual licensed under the MIT or GPL Version 2 licenses
* @version 2.1.63
* @version 2.1.66
*/
(function($, window) {

Expand Down
11 changes: 8 additions & 3 deletions form-validator/jquery.form-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* @website http://formvalidator.net/
* @license Dual licensed under the MIT or GPL Version 2 licenses
* @version 2.1.63
* @version 2.1.66
*/
(function($) {

Expand Down Expand Up @@ -538,11 +538,12 @@
.unbind('submit.validation')
.unbind('reset.validation')
.find('input[data-validation],textarea[data-validation]')
.unbind('blur.validation')
.unbind('blur.validation');

// Validate when submitted
$form.bind('submit.validation', function() {
var $form = $(this);

if($.formUtils.isLoadingModules) {
setTimeout(function() {
$form.trigger('submit.validation');
Expand Down Expand Up @@ -699,6 +700,7 @@

var hasLoadedAnyModule = false,
loadModuleScripts = function(modules, path) {

var moduleList = $.split(modules),
numModules = moduleList.length,
moduleLoadedCallback = function() {
Expand Down Expand Up @@ -743,8 +745,11 @@
script.src = scriptUrl + ( scriptUrl.substr(-7) == '.dev.js' ? cacheSuffix:'' );
script.onreadystatechange = function() {
// IE 7 fix
if( this.readyState == 'complete' ) {
if( this.readyState == 'complete' || this.readyState == 'loaded' ) {
moduleLoadedCallback();
// Handle memory leak in IE
this.onload = null;
this.onreadystatechange = null;
}
};
appendToElement.appendChild( script );
Expand Down
6 changes: 3 additions & 3 deletions form-validator/jquery.form-validator.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion form-validator/location.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
* @website http://formvalidator.net/#location-validators
* @license Dual licensed under the MIT or GPL Version 2 licenses
* @version 2.1.63
* @version 2.1.66
*/
(function($) {

Expand Down
2 changes: 1 addition & 1 deletion form-validator/qunit.html
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@
{val:input('4000000000000002', {'allowing':'mastercard, discover, visa', '':'creditcard'}), isValid:true},
{val:input('501800000009', {'allowing':'maestro', '':'creditcard'}), isValid:true},
{val:input('501800000009', {'allowing':'visa', '':'creditcard'}), isValid:false},
{val:input('501800000009', {'allowing':'jadajada,maestro,master', '':'creditcard'}), isValid:true},
{val:input('501800000009', {'allowing':'jadajada,maestro,mastercard', '':'creditcard'}), isValid:true},
{val:input('5100000000000008', {'allowing':'mastercard', '':'creditcard'}), isValid:true},
{val:input('6011000000000004', {'allowing':'discover', '':'creditcard'}), isValid:true},
{val:input('6011000000000005', {'allowing':'discover', '':'creditcard'}), isValid:false}
Expand Down
18 changes: 11 additions & 7 deletions form-validator/security.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
* - strength
* - backend
* - credit card
* - cvv
*
* @website http://formvalidator.net/#security-validators
* @version 2.1.63
* @version 2.1.66
*/
(function($) {
(function($, window) {

'use strict';

Expand Down Expand Up @@ -62,11 +63,9 @@
validatorFunction : function(value, $el, config, language, $form) {
var cards = {
'amex' : [15,15],
'diners_club_carte_blanche' : [14,14],
'diners_club_international' : [14,14],
'diners_club' : [14,14],
'cjb' : [16,16],
'laser' : [16,19],
'visa_electron' : [16,16],
'visa' : [16,16],
'mastercard' : [16,16],
'maestro' : [12,19],
Expand Down Expand Up @@ -324,8 +323,13 @@
cache : false,
data : $element.attr('name')+'='+val,
dataType : 'json',
error : function(error) {
alert('Server validation failed due to: '+error.statusText);
if( window.JSON && window.JSON.stringify ) {
alert(window.JSON.stringify(error));
}
},
success : function(response) {

if(response.valid) {
$element.valAttr('backend-valid', 'true');
}
Expand Down Expand Up @@ -435,4 +439,4 @@
return this;
};

})(jQuery);
})(jQuery, window);
Loading

0 comments on commit c198114

Please sign in to comment.