Skip to content

Commit f05f268

Browse files
committed
victorjonsson#588 Fix for jquery 3
1 parent 1c0c43b commit f05f268

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

src/main/module-loader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
script.onload = moduleLoadedCallback;
9595
script.src = scriptUrl + ( scriptUrl.slice(-7) === '.dev.js' ? cacheSuffix : '' );
9696
script.onerror = function() {
97-
$.formUtils.warn('Unable to load form validation module '+scriptUrl);
97+
$.formUtils.warn('Unable to load form validation module '+scriptUrl, true);
9898
moduleLoadedCallback();
9999
};
100100
script.onreadystatechange = function () {

src/main/utils.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,15 @@
7575
/**
7676
* Warn user via the console if available
7777
*/
78-
warn: function(msg) {
78+
warn: function(msg, fallbackOnAlert) {
7979
if( 'console' in window ) {
8080
if( typeof window.console.warn === 'function' ) {
8181
window.console.warn(msg);
8282
} else if( typeof window.console.log === 'function' ) {
8383
window.console.log(msg);
8484
}
85-
} else {
85+
} else if (fallbackOnAlert) {
86+
// This is for some old IE version...
8687
alert(msg);
8788
}
8889
},

src/modules/file.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@
7979
$.formUtils.addValidator({
8080
name : 'mime',
8181
validatorFunction : function(str, $input, conf, language) {
82-
8382
if( SUPPORTS_FILE_READER ) {
8483
var valid = true,
8584
files = $input.get(0).files || [],
8685
mime = '',
8786
allowedTypes = _getTypes($input);
87+
console.log(files[0]);
8888

8989
if( files.length ) {
9090
$.each(files, function(i, file) {
@@ -151,7 +151,7 @@
151151
validatorFunction : function(val, $input, conf, language) {
152152
var maxSize = $input.valAttr('max-size');
153153
if( !maxSize ) {
154-
$.formUtils.warn('Input "'+$input.attr('name')+'" is missing data-validation-max-size attribute');
154+
$.formUtils.warn('Input "'+$input.attr('name')+'" is missing data-validation-max-size attribute', true);
155155
return true;
156156
} else if( !SUPPORTS_FILE_READER ) {
157157
return true; // no fallback available

src/modules/security.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
$passwordInput = $form.find('[name="' + passwordInputName + '"]');
4848
if (!$passwordInput.length) {
4949
$.formUtils.warn('Password confirmation validator: could not find an input ' +
50-
'with name "' + passwordInputName + '"');
50+
'with name "' + passwordInputName + '"', true);
5151
return false;
5252
}
5353

@@ -105,7 +105,7 @@
105105
return false;
106106
}
107107
} else {
108-
$.formUtils.warn('Use of unknown credit card "' + cardName + '"');
108+
$.formUtils.warn('Use of unknown credit card "' + cardName + '"', true);
109109
}
110110
});
111111

@@ -558,7 +558,7 @@
558558

559559
$forms.each(function () {
560560
var $form = $(this),
561-
config = $form.context.validationConfig || false;
561+
config = $form.get(0).validationConfig || $form.context.validationConfig || false;
562562

563563
if (config) {
564564
$('[data-validation~="recaptcha"]', $form).each(function () {

0 commit comments

Comments
 (0)