client_side_validations 3.0.14 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/client_side_validations.gemspec +11 -3
  2. data/lib/client_side_validations.rb +4 -4
  3. data/lib/client_side_validations/action_view.rb +4 -3
  4. data/lib/client_side_validations/action_view/form_builder.rb +21 -26
  5. data/lib/client_side_validations/active_model.rb +1 -2
  6. data/lib/client_side_validations/active_record/middleware.rb +2 -10
  7. data/lib/client_side_validations/formtastic.rb +3 -3
  8. data/lib/client_side_validations/middleware.rb +4 -3
  9. data/lib/client_side_validations/version.rb +1 -1
  10. data/lib/generators/client_side_validations/copy_asset_generator.rb +23 -0
  11. data/lib/generators/client_side_validations/install_generator.rb +18 -6
  12. data/lib/generators/templates/client_side_validations/README.rails.3.0 +6 -0
  13. data/lib/generators/templates/client_side_validations/README.rails.3.1 +7 -0
  14. data/lib/generators/templates/client_side_validations/initializer.rb +1 -1
  15. data/test/action_view/cases/helper.rb +29 -13
  16. data/test/action_view/cases/test_helpers.rb +31 -66
  17. data/test/action_view/cases/test_legacy_helpers.rb +1 -1
  18. data/test/active_record/cases/test_middleware.rb +19 -34
  19. data/test/active_record/models/user.rb +1 -1
  20. data/test/base_helper.rb +1 -0
  21. data/test/core_ext/cases/test_core_ext.rb +1 -0
  22. data/test/formtastic/cases/helper.rb +5 -0
  23. data/test/formtastic/cases/test_form_builder.rb +3 -3
  24. data/test/formtastic/cases/test_form_helper.rb +3 -4
  25. data/test/generators/cases/test_generators.rb +31 -0
  26. data/test/javascript/public/test/form_builders/validateFormtastic.js +1 -1
  27. data/test/javascript/server.rb +1 -1
  28. data/test/middleware/cases/helper.rb +2 -0
  29. data/test/mongo_mapper/cases/test_middleware.rb +7 -7
  30. data/test/mongoid/cases/test_middleware.rb +7 -7
  31. data/test/simple_form/cases/helper.rb +3 -0
  32. data/test/simple_form/cases/test_form_helper.rb +2 -0
  33. data/test/test_loader.rb +6 -0
  34. data/vendor/assets/javascripts/rails.validations.js +135 -136
  35. metadata +153 -163
  36. checksums.yaml +0 -7
  37. data/lib/generators/templates/client_side_validations/README +0 -7
  38. data/test/generators/cases/test_install_generator.rb +0 -15
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Rails 3 Client Side Validations - v3.0.13
2
+ * Rails 3 Client Side Validations - v3.1.0
3
3
  * https://github.com/bcardarlela/client_side_validations
4
4
  *
5
5
  * Copyright (c) 2011 Brian Cardarella
@@ -7,76 +7,77 @@
7
7
  * http://www.opensource.org/licenses/mit-license.php
8
8
  */
9
9
 
10
- (function ($) {
11
- $.fn.validate = function () {
12
- return this.filter('form[data-validate]').each(function () {
13
- var form = $(this),
14
- settings = window[form.attr('id')],
15
- addError = function (element, message) {
16
- clientSideValidations.formBuilders[settings.type].add(element, settings, message);
17
- },
18
- removeError = function (element) {
19
- clientSideValidations.formBuilders[settings.type].remove(element, settings);
20
- };
10
+ (function($) {
11
+ $.fn.validate = function() {
12
+ return this.filter('form[data-validate]').each(function() {
13
+ var form = $(this);
14
+ var settings = window[form.attr('id')];
21
15
 
22
16
  // Set up the events for the form
23
17
  form
24
- .submit(function () { return form.isValid(settings.validators); })
25
- .bind('ajax:beforeSend', function () { return form.isValid(settings.validators); } )
18
+ .submit(function() { return form.isValid(settings.validators); })
19
+ .bind('ajax:beforeSend', function() { return form.isValid(settings.validators); })
26
20
  // Callbacks
27
- .bind('form:validate:after', function (eventData) { clientSideValidations.callbacks.form.after( form, eventData); } )
28
- .bind('form:validate:before', function (eventData) { clientSideValidations.callbacks.form.before(form, eventData); } )
29
- .bind('form:validate:fail', function (eventData) { clientSideValidations.callbacks.form.fail( form, eventData); } )
30
- .bind('form:validate:pass', function (eventData) { clientSideValidations.callbacks.form.pass( form, eventData); } )
21
+ .bind('form:validate:after', function(eventData) { clientSideValidations.callbacks.form.after( form, eventData); })
22
+ .bind('form:validate:before', function(eventData) { clientSideValidations.callbacks.form.before(form, eventData); })
23
+ .bind('form:validate:fail', function(eventData) { clientSideValidations.callbacks.form.fail( form, eventData); })
24
+ .bind('form:validate:pass', function(eventData) { clientSideValidations.callbacks.form.pass( form, eventData); })
31
25
 
32
26
  // Set up the events for each validatable form element
33
27
  .find('[data-validate]:input:not(:radio)')
34
- .live('focusout', function () { $(this).isValid(settings.validators); })
35
- .live('change', function () { $(this).data('changed', true); })
28
+ .live('focusout', function() { $(this).isValid(settings.validators); })
29
+ .live('change', function() { $(this).data('changed', true); })
36
30
  // Callbacks
37
- .live('element:validate:after', function (eventData) { clientSideValidations.callbacks.element.after( $(this), eventData); })
38
- .live('element:validate:before', function (eventData) { clientSideValidations.callbacks.element.before($(this), eventData); })
39
- .live('element:validate:fail', function (eventData, message) {
31
+ .live('element:validate:after', function(eventData) { clientSideValidations.callbacks.element.after( $(this), eventData); })
32
+ .live('element:validate:before', function(eventData) { clientSideValidations.callbacks.element.before($(this), eventData); })
33
+ .live('element:validate:fail', function(eventData, message) {
40
34
  var element = $(this);
41
- clientSideValidations.callbacks.element.fail(element, message, function () {
35
+ clientSideValidations.callbacks.element.fail(element, message, function() {
42
36
  addError(element, message);
43
- }, eventData); })
44
- .live('element:validate:pass', function (eventData) {
37
+ }, eventData) })
38
+ .live('element:validate:pass', function(eventData) {
45
39
  var element = $(this);
46
- clientSideValidations.callbacks.element.pass(element, function () {
40
+ clientSideValidations.callbacks.element.pass(element, function() {
47
41
  removeError(element);
48
- }, eventData); })
42
+ }, eventData) })
49
43
  // Checkboxes - Live events don't support filter
50
44
  .end().find('[data-validate]:checkbox')
51
- .live('click', function () { $(this).isValid(settings.validators); })
45
+ .live('click', function() { $(this).isValid(settings.validators); })
52
46
  // Inputs for confirmations
53
- .end().find('[id*=_confirmation]').each(function () {
47
+ .end().find('[id*=_confirmation]').each(function() {
54
48
  var confirmationElement = $(this),
55
49
  element = form.find('#' + this.id.match(/(.+)_confirmation/)[1] + '[data-validate]:input');
56
50
 
57
51
  if (element[0]) {
58
52
  $('#' + confirmationElement.attr('id'))
59
- .live('focusout', function () {
53
+ .live('focusout', function() {
60
54
  element.data('changed', true).isValid(settings.validators);
61
55
  })
62
- .live('keyup', function () {
56
+ .live('keyup', function() {
63
57
  element.data('changed', true).isValid(settings.validators);
64
- });
58
+ })
65
59
  }
66
60
  });
67
61
 
62
+ var addError = function(element, message) {
63
+ clientSideValidations.formBuilders[settings.type].add(element, settings, message);
64
+ }
65
+
66
+ var removeError = function(element) {
67
+ clientSideValidations.formBuilders[settings.type].remove(element, settings);
68
+ }
68
69
  });
69
- };
70
+ }
70
71
 
71
- $.fn.isValid = function (validators) {
72
+ $.fn.isValid = function(validators) {
72
73
  if ($(this[0]).is('form')) {
73
74
  return validateForm($(this[0]), validators);
74
75
  } else {
75
76
  return validateElement($(this[0]), validators[this[0].name]);
76
77
  }
77
- };
78
+ }
78
79
 
79
- var validateForm = function (form, validators) {
80
+ var validateForm = function(form, validators) {
80
81
  var valid = true;
81
82
 
82
83
  form.trigger('form:validate:before').find('[data-validate]:input').each(function() {
@@ -91,47 +92,48 @@
91
92
 
92
93
  form.trigger('form:validate:after');
93
94
  return valid;
94
- },
95
- validateElement = function (element, validators) {
96
- element.trigger('element:validate:before');
97
-
98
- if (element.data('changed') !== false) {
99
- var valid = true;
100
- element.data('changed', false);
101
-
102
- // Because 'length' is defined on the list of validators we cannot call jQuery.each on
103
- // the clientSideValidations.validators.all() object
104
- for (kind in clientSideValidations.validators.all()) {
105
- if (validators[kind] && (message = clientSideValidations.validators.all()[kind](element, validators[kind]))) {
106
- element.trigger('element:validate:fail', message).data('valid', false);
107
- valid = false;
108
- break;
109
- }
110
- }
95
+ }
96
+
97
+ var validateElement = function(element, validators) {
98
+ element.trigger('element:validate:before');
99
+
100
+ if (element.data('changed') !== false) {
101
+ var valid = true;
102
+ element.data('changed', false);
111
103
 
112
- if (valid) { element.data('valid', null); element.trigger('element:validate:pass'); }
104
+ // Because 'length' is defined on the list of validators we cannot call jQuery.each on
105
+ // the clientSideValidations.validators.all() object
106
+ for (kind in clientSideValidations.validators.all()) {
107
+ if (validators[kind] && (message = clientSideValidations.validators.all()[kind](element, validators[kind]))) {
108
+ element.trigger('element:validate:fail', message).data('valid', false);
109
+ valid = false;
110
+ break;
111
+ }
113
112
  }
114
113
 
115
- element.trigger('element:validate:after');
116
- return element.data('valid') === false ? false : true;
117
- };
114
+ if (valid) { element.data('valid', null); element.trigger('element:validate:pass'); }
115
+ }
116
+
117
+ element.trigger('element:validate:after');
118
+ return element.data('valid') === false ? false : true;
119
+ }
118
120
 
119
121
  // Main hook
120
122
  // If new forms are dynamically introduced into the DOM the .validate() method
121
123
  // must be invoked on that form
122
- $(function () { $('form[data-validate]').validate(); });
124
+ $(function() { $('form[data-validate]').validate(); })
123
125
  })(jQuery);
124
126
 
125
127
  var clientSideValidations = {
126
128
  validators: {
127
- all: function() { return jQuery.extend({}, clientSideValidations.validators.local, clientSideValidations.validators.remote); },
129
+ all: function() { return jQuery.extend({}, clientSideValidations.validators.local, clientSideValidations.validators.remote) },
128
130
  local: {
129
- presence: function (element, options) {
131
+ presence: function(element, options) {
130
132
  if (/^\s*$/.test(element.val() || "")) {
131
133
  return options.message;
132
134
  }
133
135
  },
134
- acceptance: function (element, options) {
136
+ acceptance: function(element, options) {
135
137
  switch (element.attr('type')) {
136
138
  case 'checkbox':
137
139
  if (!element.attr('checked')) {
@@ -145,8 +147,8 @@ var clientSideValidations = {
145
147
  break;
146
148
  }
147
149
  },
148
- format: function (element, options) {
149
- if ((message = this.presence(element, options)) && options.allow_blank === true) {
150
+ format: function(element, options) {
151
+ if ((message = this.presence(element, options)) && options.allow_blank == true) {
150
152
  return;
151
153
  } else if (message) {
152
154
  return message;
@@ -158,7 +160,7 @@ var clientSideValidations = {
158
160
  }
159
161
  }
160
162
  },
161
- numericality: function (element, options) {
163
+ numericality: function(element, options) {
162
164
  if (!/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d*)?$/.test(element.val())) {
163
165
  return options.messages.numericality;
164
166
  }
@@ -168,83 +170,82 @@ var clientSideValidations = {
168
170
  }
169
171
 
170
172
  var CHECKS = { greater_than: '>', greater_than_or_equal_to: '>=',
171
- equal_to: '==', less_than: '<', less_than_or_equal_to: '<=' };
173
+ equal_to: '==', less_than: '<', less_than_or_equal_to: '<=' }
172
174
 
173
- for (check in CHECKS) {
174
- if (options[check] !== undefined && !(new Function("return " + element.val() + CHECKS[check] + options[check])())) {
175
+ for (var check in CHECKS) {
176
+ if (options[check] != undefined && !(new Function("return " + element.val() + CHECKS[check] + options[check])())) {
175
177
  return options.messages[check];
176
178
  }
177
179
  }
178
180
 
179
- if (options.odd && !(parseInt(element.val(), 10) % 2)) {
181
+ if (options.odd && !(parseInt(element.val()) % 2)) {
180
182
  return options.messages.odd;
181
183
  }
182
184
 
183
- if (options.even && (parseInt(element.val(), 10) % 2)) {
185
+ if (options.even && (parseInt(element.val()) % 2)) {
184
186
  return options.messages.even;
185
187
  }
186
188
  },
187
- length: function (element, options) {
188
- var blankOptions = {},
189
- CHECKS = { is: '==', minimum: '>=', maximum: '<=' },
190
- tokenizer = options.js_tokenizer || "split('')",
191
- tokenized_length = new Function("element", "return (element.val()." + tokenizer + " || '').length;")(element);
189
+ length: function(element, options) {
190
+ var blankOptions = {};
192
191
  if (options.is) {
193
192
  blankOptions.message = options.messages.is;
194
193
  } else if (options.minimum) {
195
194
  blankOptions.message = options.messages.minimum;
196
195
  }
197
- if ((message = this.presence(element, blankOptions)) && options.allow_blank === true) {
196
+ if ((message = this.presence(element, blankOptions)) && options.allow_blank == true) {
198
197
  return;
199
198
  } else if (message) {
200
199
  return message;
201
200
  } else {
202
- for (check in CHECKS) {
201
+ var CHECKS = { is: '==', minimum: '>=', maximum: '<=' }
202
+ var tokenizer = options.js_tokenizer || "split('')";
203
+ var tokenized_length = new Function("element", "return (element.val()." + tokenizer + " || '').length;")(element);
204
+
205
+ for (var check in CHECKS) {
203
206
  if (options[check] && !(new Function("return " + tokenized_length + CHECKS[check] + options[check])())) {
204
207
  return options.messages[check];
205
208
  }
206
209
  }
207
210
  }
208
211
  },
209
- exclusion: function (element, options) {
210
- var lower = null, upper = null;
211
- if ((message = this.presence(element, options)) && options.allow_blank === true) {
212
+ exclusion: function(element, options) {
213
+ if ((message = this.presence(element, options)) && options.allow_blank == true) {
212
214
  return;
213
215
  } else if (message) {
214
216
  return message;
215
217
  } else {
216
218
  if (options['in']) {
217
- for (i = 0; i < options['in'].length; i = i + 1) {
219
+ for (var i = 0; i < options['in'].length; i++) {
218
220
  if (options['in'][i] == element.val()) {
219
221
  return options.message;
220
222
  }
221
223
  }
222
- } else if (options.range) {
223
- lower = options.range[0];
224
- upper = options.range[1];
224
+ } else if (options['range']) {
225
+ var lower = options['range'][0],
226
+ upper = options['range'][1];
225
227
  if (element.val() >= lower && element.val() <= upper) {
226
228
  return options.message;
227
229
  }
228
230
  }
229
231
  }
230
232
  },
231
- inclusion: function (element, options) {
232
- var lower = null, upper = null;
233
- if ((message = this.presence(element, options)) && options.allow_blank === true) {
233
+ inclusion: function(element, options) {
234
+ if ((message = this.presence(element, options)) && options.allow_blank == true) {
234
235
  return;
235
236
  } else if (message) {
236
237
  return message;
237
238
  } else {
238
239
  if (options['in']) {
239
- for (i = 0; i < options['in'].length; i = i + 1) {
240
+ for (var i = 0; i < options['in'].length; i++) {
240
241
  if (options['in'][i] == element.val()) {
241
242
  return;
242
243
  }
243
244
  }
244
245
  return options.message;
245
- } else if (options.range) {
246
- lower = options.range[0];
247
- upper = options.range[1];
246
+ } else if (options['range']) {
247
+ var lower = options['range'][0],
248
+ upper = options['range'][1];
248
249
 
249
250
  if (element.val() >= lower && element.val() <= upper) {
250
251
  return;
@@ -254,26 +255,25 @@ var clientSideValidations = {
254
255
  }
255
256
  }
256
257
  },
257
- confirmation: function (element, options) {
258
- if (element.val() !== jQuery('#' + element.attr('id') + '_confirmation').val()) {
258
+ confirmation: function(element, options) {
259
+ if (element.val() != jQuery('#' + element.attr('id') + '_confirmation').val()) {
259
260
  return options.message;
260
261
  }
261
262
  }
262
263
  },
263
264
  remote: {
264
- uniqueness: function (element, options) {
265
- var data = {},
266
- name = null;
267
- data.case_sensitive = !!options.case_sensitive;
265
+ uniqueness: function(element, options) {
266
+ var data = {};
267
+ data['case_sensitive'] = !!options.case_sensitive;
268
268
  if (options.id) {
269
- data.id = options.id;
269
+ data['id'] = options.id;
270
270
  }
271
271
 
272
272
  if (options.scope) {
273
- data.scope = {};
273
+ data.scope = {}
274
274
  for (key in options.scope) {
275
- var scoped_element = jQuery('[name="' + element.attr('name').replace(/\[\w+\]$/, '[' + key + ']' + '"]'));
276
- if (scoped_element[0] && scoped_element.val() !== options.scope[key]) {
275
+ var scoped_element = jQuery('[name="' + element.attr('name').replace(/\[\w+]$/, '[' + key + ']' + '"]'));
276
+ if (scoped_element[0] && scoped_element.val() != options.scope[key]) {
277
277
  data.scope[key] = scoped_element.val();
278
278
  scoped_element.unbind('change.' + element.id).bind('change.' + element.id, function() { element.trigger('change'); element.trigger('focusout'); });
279
279
  } else {
@@ -286,24 +286,24 @@ var clientSideValidations = {
286
286
  // e.g. user[records_attributes][0][title] => records[title]
287
287
  // e.g. user[record_attributes][title] => record[title]
288
288
  // Server side handles classifying the resource properly
289
- if (/_attributes\]/.test(element.attr('name'))) {
290
- name = element.attr('name').match(/\[\w+_attributes\]/g).pop().match(/\[(\w+)_attributes\]/).pop();
291
- name += /(\[\w+\])$/.exec(element.attr('name'))[1];
289
+ if (/_attributes]/.test(element.attr('name'))) {
290
+ var name = element.attr('name').match(/\[\w+_attributes]/g).pop().match(/\[(\w+)_attributes]/).pop();
291
+ name += /(\[\w+])$/.exec(element.attr('name'))[1];
292
292
  } else {
293
- name = element.attr('name');
293
+ var name = element.attr('name');
294
294
  }
295
295
 
296
296
  // Override the name if a nested module class is passed
297
297
  if (options['class']) {
298
- name = options['class'] + '[' + name.split('[')[1];
298
+ name = options['class'] + '[' + name.split('[')[1]
299
299
  }
300
300
  data[name] = element.val();
301
301
 
302
302
  if (jQuery.ajax({
303
- url: '/validators/uniqueness.json',
303
+ url: '/validators/uniqueness',
304
304
  data: data,
305
305
  async: false
306
- }).status === 200) {
306
+ }).status == 200) {
307
307
  return options.message;
308
308
  }
309
309
  }
@@ -311,13 +311,13 @@ var clientSideValidations = {
311
311
  },
312
312
  formBuilders: {
313
313
  'ActionView::Helpers::FormBuilder': {
314
- add: function (element, settings, message) {
315
- if (element.data('valid') !== false && jQuery('label.message[for="' + element.attr('id') + '"]')[0] === undefined) {
314
+ add: function(element, settings, message) {
315
+ if (element.data('valid') !== false && jQuery('label.message[for="' + element.attr('id') + '"]')[0] == undefined) {
316
316
  var inputErrorField = jQuery(settings.input_tag),
317
317
  labelErrorField = jQuery(settings.label_tag),
318
318
  label = jQuery('label[for="' + element.attr('id') + '"]:not(.message)');
319
319
 
320
- if (element.attr('autofocus')) { element.attr('autofocus', false); }
320
+ if (element.attr('autofocus')) { element.attr('autofocus', false) };
321
321
  element.before(inputErrorField);
322
322
  inputErrorField.find('span#input_tag').replaceWith(element);
323
323
  inputErrorField.find('label.message').attr('for', element.attr('id'));
@@ -327,7 +327,7 @@ var clientSideValidations = {
327
327
  }
328
328
  jQuery('label.message[for="' + element.attr('id') + '"]').text(message);
329
329
  },
330
- remove: function (element, settings) {
330
+ remove: function(element, settings) {
331
331
  var errorFieldClass = jQuery(settings.input_tag).attr('class'),
332
332
  inputErrorField = element.closest('.' + errorFieldClass),
333
333
  label = jQuery('label[for="' + element.attr('id') + '"]:not(.message)'),
@@ -342,64 +342,63 @@ var clientSideValidations = {
342
342
  }
343
343
  },
344
344
  'SimpleForm::FormBuilder': {
345
- add: function (element, settings, message) {
345
+ add: function(element, settings, message) {
346
346
  if (element.data('valid') !== false) {
347
- var wrapper = element.closest(settings.wrapper_tag),
348
- errorElement = $('<' + settings.error_tag + ' class="' + settings.error_class + '">' + message + '</' + settings.error_tag + '>');
347
+ var wrapper = element.closest(settings.wrapper_tag);
349
348
  wrapper.addClass(settings.wrapper_error_class);
349
+ var errorElement = $('<' + settings.error_tag + ' class="' + settings.error_class + '">' + message + '</' + settings.error_tag + '>');
350
350
  wrapper.append(errorElement);
351
351
  } else {
352
352
  element.parent().find(settings.error_tag + '.' + settings.error_class).text(message);
353
353
  }
354
354
  },
355
- remove: function (element, settings) {
356
- var wrapper = element.closest(settings.wrapper_tag + '.' + settings.wrapper_error_class),
357
- errorElement = wrapper.find(settings.error_tag + '.' + settings.error_class);
355
+ remove: function(element, settings) {
356
+ var wrapper = element.closest(settings.wrapper_tag + '.' + settings.wrapper_error_class);
358
357
  wrapper.removeClass(settings.wrapper_error_class);
358
+ var errorElement = wrapper.find(settings.error_tag + '.' + settings.error_class);
359
359
  errorElement.remove();
360
360
  }
361
361
 
362
362
  },
363
- 'Formtastic::SemanticFormBuilder': {
364
- add: function (element, settings, message) {
363
+ 'Formtastic::FormBuilder': {
364
+ add: function(element, settings, message) {
365
365
  if (element.data('valid') !== false) {
366
- var wrapper = element.closest('li'),
367
- errorElement = jQuery('<p class="' + settings.inline_error_class + '">' + message + '</p>');
366
+ var wrapper = element.closest('li');
368
367
  wrapper.addClass('error');
368
+ var errorElement = $('<p class="' + settings.inline_error_class + '">' + message + '</p>');
369
369
  wrapper.append(errorElement);
370
370
  } else {
371
371
  element.parent().find('p.' + settings.inline_error_class).text(message);
372
372
  }
373
373
  },
374
- remove: function (element, settings) {
375
- var wrapper = element.closest('li.error'),
376
- errorElement = wrapper.find('p.' + settings.inline_error_class);
374
+ remove: function(element, settings) {
375
+ var wrapper = element.closest('li.error');
377
376
  wrapper.removeClass('error');
377
+ var errorElement = wrapper.find('p.' + settings.inline_error_class);
378
378
  errorElement.remove();
379
379
  }
380
380
  },
381
381
  'NestedForm::Builder': {
382
- add: function (element, settings, message) {
382
+ add: function(element, settings, message) {
383
383
  clientSideValidations.formBuilders['ActionView::Helpers::FormBuilder'].add(element, settings, message);
384
384
  },
385
- remove: function (element, settings, message) {
385
+ remove: function(element, settings, message) {
386
386
  clientSideValidations.formBuilders['ActionView::Helpers::FormBuilder'].remove(element, settings, message);
387
387
  }
388
388
  }
389
389
  },
390
390
  callbacks: {
391
391
  element: {
392
- after: function (element, eventData) { },
393
- before: function (element, eventData) { },
394
- fail: function (element, message, addError, eventData) { addError(); },
395
- pass: function (element, removeError, eventData) { removeError(); }
392
+ after: function(element, eventData) { },
393
+ before: function(element, eventData) { },
394
+ fail: function(element, message, addError, eventData) { addError() },
395
+ pass: function(element, removeError, eventData) { removeError() }
396
396
  },
397
397
  form: {
398
- after: function (form, eventData) { },
399
- before: function (form, eventData) { },
400
- fail: function (form, eventData) { },
401
- pass: function (form, eventData) { }
398
+ after: function(form, eventData) { },
399
+ before: function(form, eventData) { },
400
+ fail: function(form, eventData) { },
401
+ pass: function(form, eventData) { }
402
402
  }
403
403
  }
404
404
  };
405
-