fomantic-ui 2.9.1-beta.21 → 2.9.1-beta.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/.eslintrc.js +95 -75
  2. package/.github/workflows/ci.yml +2 -2
  3. package/.github/workflows/nightly.yml +1 -1
  4. package/.github/workflows/release.yml +1 -1
  5. package/.stylelintrc.js +6 -7
  6. package/dist/components/accordion.css +1 -1
  7. package/dist/components/accordion.js +7 -7
  8. package/dist/components/accordion.min.css +1 -1
  9. package/dist/components/accordion.min.js +2 -2
  10. package/dist/components/ad.css +1 -1
  11. package/dist/components/ad.min.css +1 -1
  12. package/dist/components/api.js +54 -53
  13. package/dist/components/api.min.js +2 -2
  14. package/dist/components/breadcrumb.css +1 -1
  15. package/dist/components/breadcrumb.min.css +1 -1
  16. package/dist/components/button.css +1 -1
  17. package/dist/components/button.min.css +1 -1
  18. package/dist/components/calendar.css +3 -3
  19. package/dist/components/calendar.js +119 -99
  20. package/dist/components/calendar.min.css +2 -2
  21. package/dist/components/calendar.min.js +2 -2
  22. package/dist/components/card.css +1 -1
  23. package/dist/components/card.min.css +1 -1
  24. package/dist/components/checkbox.css +1 -1
  25. package/dist/components/checkbox.js +8 -8
  26. package/dist/components/checkbox.min.css +1 -1
  27. package/dist/components/checkbox.min.js +2 -2
  28. package/dist/components/comment.css +1 -1
  29. package/dist/components/comment.min.css +1 -1
  30. package/dist/components/container.css +1 -1
  31. package/dist/components/container.min.css +1 -1
  32. package/dist/components/dimmer.css +1 -1
  33. package/dist/components/dimmer.js +16 -18
  34. package/dist/components/dimmer.min.css +1 -1
  35. package/dist/components/dimmer.min.js +2 -2
  36. package/dist/components/divider.css +1 -1
  37. package/dist/components/divider.min.css +1 -1
  38. package/dist/components/dropdown.css +1 -1
  39. package/dist/components/dropdown.js +87 -87
  40. package/dist/components/dropdown.min.css +1 -1
  41. package/dist/components/dropdown.min.js +2 -2
  42. package/dist/components/embed.css +1 -1
  43. package/dist/components/embed.js +17 -23
  44. package/dist/components/embed.min.css +1 -1
  45. package/dist/components/embed.min.js +2 -2
  46. package/dist/components/feed.css +1 -1
  47. package/dist/components/feed.min.css +1 -1
  48. package/dist/components/flag.css +1 -1
  49. package/dist/components/flag.min.css +1 -1
  50. package/dist/components/flyout.css +2 -2
  51. package/dist/components/flyout.js +32 -30
  52. package/dist/components/flyout.min.css +1 -1
  53. package/dist/components/flyout.min.js +2 -2
  54. package/dist/components/form.css +2 -2
  55. package/dist/components/form.js +113 -89
  56. package/dist/components/form.min.css +2 -2
  57. package/dist/components/form.min.js +2 -2
  58. package/dist/components/grid.css +1 -1
  59. package/dist/components/grid.min.css +1 -1
  60. package/dist/components/header.css +1 -1
  61. package/dist/components/header.min.css +1 -1
  62. package/dist/components/icon.css +1 -1
  63. package/dist/components/icon.min.css +1 -1
  64. package/dist/components/image.css +1 -1
  65. package/dist/components/image.min.css +1 -1
  66. package/dist/components/input.css +1 -1
  67. package/dist/components/input.min.css +1 -1
  68. package/dist/components/item.css +1 -1
  69. package/dist/components/item.min.css +1 -1
  70. package/dist/components/label.css +1 -1
  71. package/dist/components/label.min.css +1 -1
  72. package/dist/components/list.css +1 -1
  73. package/dist/components/list.min.css +1 -1
  74. package/dist/components/loader.css +1 -1
  75. package/dist/components/loader.min.css +1 -1
  76. package/dist/components/message.css +1 -1
  77. package/dist/components/message.min.css +1 -1
  78. package/dist/components/modal.css +1 -1
  79. package/dist/components/modal.js +22 -22
  80. package/dist/components/modal.min.css +1 -1
  81. package/dist/components/modal.min.js +2 -2
  82. package/dist/components/nag.css +1 -1
  83. package/dist/components/nag.js +18 -16
  84. package/dist/components/nag.min.css +1 -1
  85. package/dist/components/nag.min.js +2 -2
  86. package/dist/components/placeholder.css +1 -1
  87. package/dist/components/placeholder.min.css +1 -1
  88. package/dist/components/popup.css +1 -1
  89. package/dist/components/popup.js +30 -30
  90. package/dist/components/popup.min.css +1 -1
  91. package/dist/components/popup.min.js +2 -2
  92. package/dist/components/progress.css +1 -1
  93. package/dist/components/progress.js +23 -21
  94. package/dist/components/progress.min.css +1 -1
  95. package/dist/components/progress.min.js +2 -2
  96. package/dist/components/rail.css +1 -1
  97. package/dist/components/rail.min.css +1 -1
  98. package/dist/components/rating.css +1 -1
  99. package/dist/components/rating.js +8 -8
  100. package/dist/components/rating.min.css +1 -1
  101. package/dist/components/rating.min.js +2 -2
  102. package/dist/components/reset.css +1 -1
  103. package/dist/components/reset.min.css +1 -1
  104. package/dist/components/reveal.css +1 -1
  105. package/dist/components/reveal.min.css +1 -1
  106. package/dist/components/search.css +1 -1
  107. package/dist/components/search.js +41 -46
  108. package/dist/components/search.min.css +1 -1
  109. package/dist/components/search.min.js +2 -2
  110. package/dist/components/segment.css +1 -1
  111. package/dist/components/segment.min.css +1 -1
  112. package/dist/components/shape.css +1 -1
  113. package/dist/components/shape.js +9 -9
  114. package/dist/components/shape.min.css +1 -1
  115. package/dist/components/shape.min.js +2 -2
  116. package/dist/components/sidebar.css +1 -1
  117. package/dist/components/sidebar.js +21 -19
  118. package/dist/components/sidebar.min.css +1 -1
  119. package/dist/components/sidebar.min.js +2 -2
  120. package/dist/components/site.css +1 -1
  121. package/dist/components/site.js +11 -10
  122. package/dist/components/site.min.css +1 -1
  123. package/dist/components/site.min.js +2 -2
  124. package/dist/components/slider.js +39 -42
  125. package/dist/components/slider.min.js +2 -2
  126. package/dist/components/state.js +7 -7
  127. package/dist/components/state.min.js +2 -2
  128. package/dist/components/statistic.css +1 -1
  129. package/dist/components/statistic.min.css +1 -1
  130. package/dist/components/step.css +1 -1
  131. package/dist/components/step.min.css +1 -1
  132. package/dist/components/sticky.css +1 -1
  133. package/dist/components/sticky.js +7 -7
  134. package/dist/components/sticky.min.css +1 -1
  135. package/dist/components/sticky.min.js +2 -2
  136. package/dist/components/tab.css +1 -1
  137. package/dist/components/tab.js +36 -38
  138. package/dist/components/tab.min.css +1 -1
  139. package/dist/components/tab.min.js +2 -2
  140. package/dist/components/table.css +1 -1
  141. package/dist/components/table.min.css +1 -1
  142. package/dist/components/text.css +1 -1
  143. package/dist/components/text.min.css +1 -1
  144. package/dist/components/toast.css +1 -1
  145. package/dist/components/toast.js +20 -17
  146. package/dist/components/toast.min.css +1 -1
  147. package/dist/components/toast.min.js +2 -2
  148. package/dist/components/transition.css +7 -7
  149. package/dist/components/transition.js +27 -21
  150. package/dist/components/transition.min.css +1 -1
  151. package/dist/components/transition.min.js +2 -2
  152. package/dist/components/visibility.js +8 -8
  153. package/dist/components/visibility.min.js +2 -2
  154. package/dist/semantic.css +60 -60
  155. package/dist/semantic.js +780 -735
  156. package/dist/semantic.min.css +2 -2
  157. package/dist/semantic.min.js +2 -2
  158. package/examples/.eslintrc.js +6 -0
  159. package/examples/responsive.html +1 -1
  160. package/gulpfile.js +1 -1
  161. package/package.json +5 -4
  162. package/scripts/nightly-version.js +3 -3
  163. package/src/definitions/behaviors/api.js +53 -52
  164. package/src/definitions/behaviors/form.js +112 -88
  165. package/src/definitions/behaviors/state.js +6 -6
  166. package/src/definitions/behaviors/visibility.js +7 -7
  167. package/src/definitions/collections/menu.less +2 -2
  168. package/src/definitions/elements/button.less +2 -2
  169. package/src/definitions/elements/loader.less +4 -4
  170. package/src/definitions/elements/step.less +1 -1
  171. package/src/definitions/globals/site.js +10 -9
  172. package/src/definitions/modules/accordion.js +6 -6
  173. package/src/definitions/modules/calendar.js +118 -98
  174. package/src/definitions/modules/calendar.less +2 -2
  175. package/src/definitions/modules/checkbox.js +7 -7
  176. package/src/definitions/modules/dimmer.js +15 -17
  177. package/src/definitions/modules/dimmer.less +10 -10
  178. package/src/definitions/modules/dropdown.js +86 -86
  179. package/src/definitions/modules/embed.js +16 -22
  180. package/src/definitions/modules/flyout.js +31 -29
  181. package/src/definitions/modules/flyout.less +1 -1
  182. package/src/definitions/modules/modal.js +21 -21
  183. package/src/definitions/modules/nag.js +17 -15
  184. package/src/definitions/modules/popup.js +29 -29
  185. package/src/definitions/modules/progress.js +22 -20
  186. package/src/definitions/modules/rating.js +7 -7
  187. package/src/definitions/modules/search.js +40 -45
  188. package/src/definitions/modules/shape.js +8 -8
  189. package/src/definitions/modules/sidebar.js +20 -18
  190. package/src/definitions/modules/slider.js +38 -41
  191. package/src/definitions/modules/sticky.js +6 -6
  192. package/src/definitions/modules/tab.js +35 -37
  193. package/src/definitions/modules/toast.js +19 -16
  194. package/src/definitions/modules/transition.js +26 -20
  195. package/src/themes/amazon/elements/button.overrides +7 -7
  196. package/src/themes/default/collections/form.variables +1 -1
  197. package/src/themes/default/elements/reveal.variables +1 -1
  198. package/src/themes/default/globals/site.variables +1 -1
  199. package/src/themes/default/modules/dimmer.variables +6 -6
  200. package/src/themes/default/modules/modal.variables +1 -1
  201. package/src/themes/default/modules/slider.variables +4 -4
  202. package/src/themes/default/modules/toast.variables +2 -2
  203. package/src/themes/default/modules/transition.overrides +12 -12
  204. package/src/themes/flat/collections/form.overrides +2 -2
  205. package/src/themes/flat/globals/site.variables +1 -1
  206. package/src/themes/github/collections/form.overrides +2 -2
  207. package/src/themes/github/collections/menu.variables +1 -1
  208. package/src/themes/github/collections/message.overrides +3 -3
  209. package/src/themes/github/elements/input.overrides +2 -2
  210. package/src/themes/timeline/views/feed.overrides +3 -3
  211. package/src/themes/twitter/elements/button.overrides +2 -2
  212. package/tasks/.eslintrc.js +9 -0
  213. package/tasks/README.md +1 -3
  214. package/tasks/admin/components/create.js +9 -16
  215. package/tasks/admin/components/init.js +7 -7
  216. package/tasks/admin/components/update.js +7 -7
  217. package/tasks/admin/distributions/create.js +15 -17
  218. package/tasks/admin/distributions/init.js +7 -7
  219. package/tasks/admin/distributions/update.js +7 -7
  220. package/tasks/admin/publish.js +1 -1
  221. package/tasks/admin/register.js +2 -2
  222. package/tasks/admin/release.js +1 -1
  223. package/tasks/build/assets.js +2 -2
  224. package/tasks/build/css.js +8 -3
  225. package/tasks/build/javascript.js +3 -1
  226. package/tasks/build.js +1 -1
  227. package/tasks/check-install.js +1 -1
  228. package/tasks/clean.js +1 -1
  229. package/tasks/collections/README.md +3 -5
  230. package/tasks/collections/admin.js +1 -1
  231. package/tasks/collections/docs.js +1 -1
  232. package/tasks/collections/install.js +1 -1
  233. package/tasks/collections/rtl.js +1 -1
  234. package/tasks/collections/various.js +1 -1
  235. package/tasks/config/admin/github.js +5 -6
  236. package/tasks/config/admin/templates/css-package.js +1 -1
  237. package/tasks/config/admin/templates/less-package.js +1 -1
  238. package/tasks/config/npm/gulpfile.js +7 -7
  239. package/tasks/config/project/config.js +9 -16
  240. package/tasks/config/project/install.js +26 -25
  241. package/tasks/config/project/release.js +12 -14
  242. package/tasks/config/tasks.js +17 -19
  243. package/tasks/config/user.js +1 -1
  244. package/tasks/docs/build.js +5 -3
  245. package/tasks/docs/metadata.js +7 -8
  246. package/tasks/docs/serve.js +5 -3
  247. package/tasks/install.js +38 -38
  248. package/tasks/rtl/build.js +1 -1
  249. package/tasks/rtl/watch.js +1 -1
  250. package/tasks/version.js +1 -1
  251. package/tasks/watch.js +1 -1
  252. package/test/.eslintrc.js +23 -0
  253. package/test/meteor/assets.js +1 -1
  254. package/test/modules/module.spec.js +15 -15
  255. package/test/modules/popup.spec.js +1 -1
  256. package/test/modules/search.spec.js +1 -1
  257. package/test/modules/tab.spec.js +1 -1
  258. package/test/modules/transition.spec.js +1 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * # Fomantic-UI 2.9.1-beta.21+2722e1b - Form Validation
2
+ * # Fomantic-UI 2.9.1-beta.23+27384cb - Form Validation
3
3
  * https://github.com/fomantic/Fomantic-UI/
4
4
  *
5
5
  *
@@ -15,7 +15,7 @@
15
15
  return typeof obj === 'function' && typeof obj.nodeType !== 'number';
16
16
  }
17
17
 
18
- window = (typeof window != 'undefined' && window.Math == Math)
18
+ window = (window !== undefined && window.Math === Math)
19
19
  ? window
20
20
  : globalThis;
21
21
 
@@ -24,12 +24,12 @@
24
24
  $allModules = $(this),
25
25
  moduleSelector = $allModules.selector || '',
26
26
 
27
- time = new Date().getTime(),
27
+ time = Date.now(),
28
28
  performance = [],
29
29
 
30
30
  query = arguments[0],
31
31
  legacyParameters = arguments[1],
32
- methodInvoked = (typeof query == 'string'),
32
+ methodInvoked = (typeof query === 'string'),
33
33
  queryArguments = [].slice.call(arguments, 1),
34
34
  returnedValue
35
35
  ;
@@ -136,7 +136,10 @@
136
136
  },
137
137
 
138
138
  attachEvents: function (selector, action) {
139
- action = action || 'submit';
139
+ if (!action) {
140
+ action = 'submit';
141
+ }
142
+
140
143
  $(selector).on('click' + eventNamespace, function (event) {
141
144
  module[action]();
142
145
  event.preventDefault();
@@ -277,15 +280,13 @@
277
280
  isDirty
278
281
  ;
279
282
 
280
- if (isCheckbox) {
281
- isDirty = module.is.checkboxDirty($el);
282
- } else {
283
- isDirty = module.is.fieldDirty($el);
284
- }
283
+ isDirty = isCheckbox
284
+ ? module.is.checkboxDirty($el)
285
+ : module.is.fieldDirty($el);
285
286
 
286
287
  $el.data(settings.metadata.isDirty, isDirty);
287
288
 
288
- formIsDirty |= isDirty;
289
+ formIsDirty = formIsDirty || isDirty;
289
290
  });
290
291
 
291
292
  if (formIsDirty) {
@@ -302,16 +303,17 @@
302
303
  },
303
304
  // duck type rule test
304
305
  shorthandRules: function (rules) {
305
- return (typeof rules == 'string' || Array.isArray(rules));
306
+ return (typeof rules === 'string' || Array.isArray(rules));
306
307
  },
307
308
  empty: function ($field) {
308
309
  if (!$field || $field.length === 0) {
309
310
  return true;
310
- } else if ($field.is(selector.checkbox)) {
311
+ }
312
+ if ($field.is(selector.checkbox)) {
311
313
  return !$field.is(':checked');
312
- } else {
313
- return module.is.blank($field);
314
314
  }
315
+
316
+ return module.is.blank($field);
315
317
  },
316
318
  blank: function ($field) {
317
319
  return String($field.val()).trim() === '';
@@ -324,16 +326,16 @@
324
326
  module.verbose('Checking if field is valid', field);
325
327
 
326
328
  return module.validate.field(validation[field], field, !!showErrors);
327
- } else {
328
- module.verbose('Checking if form is valid');
329
- $.each(validation, function (fieldName, field) {
330
- if (!module.is.valid(fieldName, showErrors)) {
331
- allValid = false;
332
- }
333
- });
334
-
335
- return allValid;
336
329
  }
330
+
331
+ module.verbose('Checking if form is valid');
332
+ $.each(validation, function (fieldName, field) {
333
+ if (!module.is.valid(fieldName, showErrors)) {
334
+ allValid = false;
335
+ }
336
+ });
337
+
338
+ return allValid;
337
339
  },
338
340
  dirty: function () {
339
341
  return dirty;
@@ -488,9 +490,9 @@
488
490
  changeEvent: function (type, $input) {
489
491
  if (type == 'checkbox' || type == 'radio' || type == 'hidden' || $input.is('select')) {
490
492
  return 'change';
491
- } else {
492
- return module.get.inputEvent();
493
493
  }
494
+
495
+ return module.get.inputEvent();
494
496
  },
495
497
  inputEvent: function () {
496
498
  return (document.createElement('input').oninput !== undefined)
@@ -507,7 +509,7 @@
507
509
  if (!Array.isArray(rules) && typeof rules === 'object') {
508
510
  fullFields[name] = rules;
509
511
  } else {
510
- if (typeof rules == 'string') {
512
+ if (typeof rules === 'string') {
511
513
  rules = [rules];
512
514
  }
513
515
  fullFields[name] = {
@@ -542,28 +544,28 @@
542
544
  if (!rule.prompt) {
543
545
  suffixPrompt = (
544
546
  parts[0] === ''
545
- ? settings.prompt.maxValue.replace(/\{ruleValue\}/g, '{max}')
547
+ ? settings.prompt.maxValue.replace(/{ruleValue}/g, '{max}')
546
548
  : parts[1] === ''
547
- ? settings.prompt.minValue.replace(/\{ruleValue\}/g, '{min}')
549
+ ? settings.prompt.minValue.replace(/{ruleValue}/g, '{min}')
548
550
  : settings.prompt.range
549
551
  );
550
- prompt += suffixPrompt.replace(/\{name\}/g, ' ' + settings.text.and);
552
+ prompt += suffixPrompt.replace(/{name}/g, ' ' + settings.text.and);
551
553
  }
552
- prompt = prompt.replace(/\{min\}/g, parts[0]);
553
- prompt = prompt.replace(/\{max\}/g, parts[1]);
554
+ prompt = prompt.replace(/{min}/g, parts[0]);
555
+ prompt = prompt.replace(/{max}/g, parts[1]);
554
556
  }
555
557
  if (requiresValue) {
556
- prompt = prompt.replace(/\{value\}/g, $field.val());
558
+ prompt = prompt.replace(/{value}/g, $field.val());
557
559
  }
558
560
  if (requiresName) {
559
561
  $label = $field.closest(selector.group).find('label').eq(0);
560
562
  name = ($label.length == 1)
561
563
  ? $label.text()
562
564
  : $field.prop('placeholder') || settings.text.unspecifiedField;
563
- prompt = prompt.replace(/\{name\}/g, name);
565
+ prompt = prompt.replace(/{name}/g, name);
564
566
  }
565
- prompt = prompt.replace(/\{identifier\}/g, field.identifier);
566
- prompt = prompt.replace(/\{ruleValue\}/g, ancillary);
567
+ prompt = prompt.replace(/{identifier}/g, field.identifier);
568
+ prompt = prompt.replace(/{ruleValue}/g, ancillary);
567
569
  if (!rule.prompt) {
568
570
  module.verbose('Using default validation prompt for type', prompt, ruleName);
569
571
  }
@@ -619,16 +621,20 @@
619
621
  module.verbose('Finding field with identifier', identifier);
620
622
  identifier = module.escape.string(identifier);
621
623
  var t;
622
- if ((t = $field.filter('#' + identifier)).length > 0) {
624
+ t = $field.filter('#' + identifier);
625
+ if (t.length > 0) {
623
626
  return t;
624
627
  }
625
- if ((t = $field.filter('[name="' + identifier + '"]')).length > 0) {
628
+ t = $field.filter('[name="' + identifier + '"]');
629
+ if (t.length > 0) {
626
630
  return t;
627
631
  }
628
- if ((t = $field.filter('[name="' + identifier + '[]"]')).length > 0) {
632
+ t = $field.filter('[name="' + identifier + '[]"]');
633
+ if (t.length > 0) {
629
634
  return t;
630
635
  }
631
- if ((t = $field.filter('[data-' + metadata.validate + '="' + identifier + '"]')).length > 0) {
636
+ t = $field.filter('[data-' + metadata.validate + '="' + identifier + '"]');
637
+ if (t.length > 0) {
632
638
  return t;
633
639
  }
634
640
  module.error(error.noField.replace('{identifier}', identifier));
@@ -721,11 +727,7 @@
721
727
  : false;
722
728
  }
723
729
  } else if (isCheckbox) {
724
- if (isChecked) {
725
- values[name] = value || true;
726
- } else {
727
- values[name] = false;
728
- }
730
+ values[name] = isChecked ? value || true : false;
729
731
  } else if (isCalendar) {
730
732
  var date = $calendar.calendar('get date');
731
733
 
@@ -855,7 +857,7 @@
855
857
  $.each(newValidation.rules, function (_index, rule) {
856
858
  if ($.grep(validation[name].rules, function (item) {
857
859
  return item.type == rule.type;
858
- }).length == 0) {
860
+ }).length === 0) {
859
861
  validation[name].rules.push(rule);
860
862
  }
861
863
  });
@@ -871,9 +873,9 @@
871
873
  $field = module.get.field(identifier),
872
874
  $fieldGroup = $field.closest($group),
873
875
  $prompt = $fieldGroup.children(selector.prompt),
874
- promptExists = ($prompt.length !== 0)
876
+ promptExists = ($prompt.length > 0)
875
877
  ;
876
- errors = (typeof errors == 'string')
878
+ errors = (typeof errors === 'string')
877
879
  ? [errors]
878
880
  : errors;
879
881
  module.verbose('Adding field error state', identifier);
@@ -1229,7 +1231,7 @@
1229
1231
  showErrors = (showErrors !== undefined)
1230
1232
  ? showErrors
1231
1233
  : true;
1232
- if (typeof field == 'string') {
1234
+ if (typeof field === 'string') {
1233
1235
  module.verbose('Validating field', field);
1234
1236
  fieldName = field;
1235
1237
  field = validation[field];
@@ -1247,7 +1249,7 @@
1247
1249
  module.debug('Using field name as identifier', identifier);
1248
1250
  field.identifier = identifier;
1249
1251
  }
1250
- var isDisabled = !$field.filter(':not(:disabled)').length;
1252
+ var isDisabled = $field.filter(':not(:disabled)').length === 0;
1251
1253
  if (isDisabled) {
1252
1254
  module.debug('Field is disabled. Skipping', identifier);
1253
1255
  } else if (field.optional && module.is.blank($field)) {
@@ -1326,7 +1328,7 @@
1326
1328
  });
1327
1329
  }
1328
1330
 
1329
- return internal ? invalidFields : !(invalidFields.length > 0);
1331
+ return internal ? invalidFields : invalidFields.length === 0;
1330
1332
  },
1331
1333
  },
1332
1334
 
@@ -1382,7 +1384,7 @@
1382
1384
  previousTime
1383
1385
  ;
1384
1386
  if (settings.performance) {
1385
- currentTime = new Date().getTime();
1387
+ currentTime = Date.now();
1386
1388
  previousTime = time || currentTime;
1387
1389
  executionTime = currentTime - previousTime;
1388
1390
  time = currentTime;
@@ -1411,7 +1413,7 @@
1411
1413
  title += ' \'' + moduleSelector + '\'';
1412
1414
  }
1413
1415
  if ($allModules.length > 1) {
1414
- title += ' ' + '(' + $allModules.length + ')';
1416
+ title += ' (' + $allModules.length + ')';
1415
1417
  }
1416
1418
  if ((console.group !== undefined || console.table !== undefined) && performance.length > 0) {
1417
1419
  console.groupCollapsed(title);
@@ -1436,8 +1438,8 @@
1436
1438
  ;
1437
1439
  passedArguments = passedArguments || queryArguments;
1438
1440
  context = context || element;
1439
- if (typeof query == 'string' && object !== undefined) {
1440
- query = query.split(/[\. ]/);
1441
+ if (typeof query === 'string' && object !== undefined) {
1442
+ query = query.split(/[ .]/);
1441
1443
  maxDepth = query.length - 1;
1442
1444
  $.each(query, function (depth, value) {
1443
1445
  var camelCaseValue = (depth != maxDepth)
@@ -1529,15 +1531,15 @@
1529
1531
  },
1530
1532
 
1531
1533
  regExp: {
1532
- htmlID: /^[a-zA-Z][\w:.-]*$/g,
1533
- bracket: /\[(.*)\]/i,
1534
+ htmlID: /^[A-Za-z][\w.:-]*$/g,
1535
+ bracket: /\[(.*)]/i,
1534
1536
  decimal: /^\d+\.?\d*$/,
1535
- email: /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i,
1536
- escape: /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|:,=@]/g,
1537
+ email: /^[\w!#$%&'*+./=?^`{|}~-]+@[\da-z]([\da-z-]*[\da-z])?(\.[\da-z]([\da-z-]*[\da-z])?)*$/i,
1538
+ escape: /[$()*+,./:=?@[\\\]^{|}-]/g,
1537
1539
  flags: /^\/(.*)\/(.*)?/,
1538
- integer: /^\-?\d+$/,
1539
- number: /^\-?\d*(\.\d+)?$/,
1540
- url: /(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/i,
1540
+ integer: /^-?\d+$/,
1541
+ number: /^-?\d*(\.\d+)?$/,
1542
+ url: /(https?:\/\/(?:www\.|(?!www))[^\s.]+\.\S{2,}|www\.\S+\.\S{2,})/i,
1541
1543
  },
1542
1544
 
1543
1545
  text: {
@@ -1682,7 +1684,7 @@
1682
1684
 
1683
1685
  // is not empty or blank string
1684
1686
  empty: function (value) {
1685
- return !(value === undefined || '' === value || Array.isArray(value) && value.length === 0);
1687
+ return !(value === undefined || value === '' || (Array.isArray(value) && value.length === 0));
1686
1688
  },
1687
1689
 
1688
1690
  // checkbox checked
@@ -1732,7 +1734,7 @@
1732
1734
  return $.fn.form.settings.rules.range(value, range, 'integer');
1733
1735
  },
1734
1736
  range: function (value, range, regExp) {
1735
- if (typeof regExp == 'string') {
1737
+ if (typeof regExp === 'string') {
1736
1738
  regExp = $.fn.form.settings.regExp[regExp];
1737
1739
  }
1738
1740
  if (!(regExp instanceof RegExp)) {
@@ -1744,10 +1746,12 @@
1744
1746
  parts
1745
1747
  ;
1746
1748
  if (!range || ['', '..'].indexOf(range) !== -1) {
1749
+
1747
1750
  // do nothing
1748
1751
  } else if (range.indexOf('..') == -1) {
1749
1752
  if (regExp.test(range)) {
1750
- min = max = range - 0;
1753
+ min = range - 0;
1754
+ max = min;
1751
1755
  }
1752
1756
  } else {
1753
1757
  parts = range.split('..', 2);
@@ -1778,10 +1782,10 @@
1778
1782
 
1779
1783
  // is value (case insensitive)
1780
1784
  is: function (value, text) {
1781
- text = (typeof text == 'string')
1785
+ text = (typeof text === 'string')
1782
1786
  ? text.toLowerCase()
1783
1787
  : text;
1784
- value = (typeof value == 'string')
1788
+ value = (typeof value === 'string')
1785
1789
  ? value.toLowerCase()
1786
1790
  : value;
1787
1791
 
@@ -1795,10 +1799,10 @@
1795
1799
 
1796
1800
  // value is not another value (case insensitive)
1797
1801
  not: function (value, notValue) {
1798
- value = (typeof value == 'string')
1802
+ value = (typeof value === 'string')
1799
1803
  ? value.toLowerCase()
1800
1804
  : value;
1801
- notValue = (typeof notValue == 'string')
1805
+ notValue = (typeof notValue === 'string')
1802
1806
  ? notValue.toLowerCase()
1803
1807
  : notValue;
1804
1808
 
@@ -1869,14 +1873,24 @@
1869
1873
  matchingValue,
1870
1874
  matchingElement
1871
1875
  ;
1872
- if ((matchingElement = $module.find('[data-validate="' + identifier + '"]')).length > 0) {
1873
- matchingValue = matchingElement.val();
1874
- } else if ((matchingElement = $module.find('#' + identifier)).length > 0) {
1876
+ matchingElement = $module.find('[data-validate="' + identifier + '"]');
1877
+ if (matchingElement.length > 0) {
1875
1878
  matchingValue = matchingElement.val();
1876
- } else if ((matchingElement = $module.find('[name="' + identifier + '"]')).length > 0) {
1877
- matchingValue = matchingElement.val();
1878
- } else if ((matchingElement = $module.find('[name="' + identifier + '[]"]')).length > 0) {
1879
- matchingValue = matchingElement;
1879
+ } else {
1880
+ matchingElement = $module.find('#' + identifier);
1881
+ if (matchingElement.length > 0) {
1882
+ matchingValue = matchingElement.val();
1883
+ } else {
1884
+ matchingElement = $module.find('[name="' + identifier + '"]');
1885
+ if (matchingElement.length > 0) {
1886
+ matchingValue = matchingElement.val();
1887
+ } else {
1888
+ matchingElement = $module.find('[name="' + identifier + '[]"]');
1889
+ if (matchingElement.length > 0) {
1890
+ matchingValue = matchingElement;
1891
+ }
1892
+ }
1893
+ }
1880
1894
  }
1881
1895
 
1882
1896
  return (matchingValue !== undefined)
@@ -1891,14 +1905,24 @@
1891
1905
  matchingValue,
1892
1906
  matchingElement
1893
1907
  ;
1894
- if ((matchingElement = $module.find('[data-validate="' + identifier + '"]')).length > 0) {
1895
- matchingValue = matchingElement.val();
1896
- } else if ((matchingElement = $module.find('#' + identifier)).length > 0) {
1908
+ matchingElement = $module.find('[data-validate="' + identifier + '"]');
1909
+ if (matchingElement.length > 0) {
1897
1910
  matchingValue = matchingElement.val();
1898
- } else if ((matchingElement = $module.find('[name="' + identifier + '"]')).length > 0) {
1899
- matchingValue = matchingElement.val();
1900
- } else if ((matchingElement = $module.find('[name="' + identifier + '[]"]')).length > 0) {
1901
- matchingValue = matchingElement;
1911
+ } else {
1912
+ matchingElement = $module.find('#' + identifier);
1913
+ if (matchingElement.length > 0) {
1914
+ matchingValue = matchingElement.val();
1915
+ } else {
1916
+ matchingElement = $module.find('[name="' + identifier + '"]');
1917
+ if (matchingElement.length > 0) {
1918
+ matchingValue = matchingElement.val();
1919
+ } else {
1920
+ matchingElement = $module.find('[name="' + identifier + '[]"]');
1921
+ if (matchingElement.length > 0) {
1922
+ matchingValue = matchingElement;
1923
+ }
1924
+ }
1925
+ }
1902
1926
  }
1903
1927
 
1904
1928
  return (matchingValue !== undefined)
@@ -1922,7 +1946,7 @@
1922
1946
  length: [16],
1923
1947
  },
1924
1948
  discover: {
1925
- pattern: /^(6011|622(12[6-9]|1[3-9][0-9]|[2-8][0-9]{2}|9[0-1][0-9]|92[0-5]|64[4-9])|65)/,
1949
+ pattern: /^(6011|622(12[6-9]|1[3-9]\d|[2-8]\d{2}|9[01]\d|92[0-5]|64[4-9])|65)/,
1926
1950
  length: [16],
1927
1951
  },
1928
1952
  unionPay: {
@@ -1930,7 +1954,7 @@
1930
1954
  length: [16, 17, 18, 19],
1931
1955
  },
1932
1956
  jcb: {
1933
- pattern: /^35(2[89]|[3-8][0-9])/,
1957
+ pattern: /^35(2[89]|[3-8]\d)/,
1934
1958
  length: [16],
1935
1959
  },
1936
1960
  maestro: {
@@ -1952,7 +1976,7 @@
1952
1976
  },
1953
1977
  valid = {},
1954
1978
  validCard = false,
1955
- requiredTypes = (typeof cardTypes == 'string')
1979
+ requiredTypes = (typeof cardTypes === 'string')
1956
1980
  ? cardTypes.split(',')
1957
1981
  : false,
1958
1982
  unionPay,
@@ -1964,7 +1988,7 @@
1964
1988
  }
1965
1989
 
1966
1990
  // allow dashes and spaces in card
1967
- cardNumber = cardNumber.replace(/[\s\-]/g, '');
1991
+ cardNumber = cardNumber.replace(/[\s-]/g, '');
1968
1992
 
1969
1993
  // verify card types
1970
1994
  if (requiredTypes) {
@@ -1976,7 +2000,7 @@
1976
2000
  length: ($.inArray(cardNumber.length, validation.length) !== -1),
1977
2001
  pattern: (cardNumber.search(validation.pattern) !== -1),
1978
2002
  };
1979
- if (valid.length && valid.pattern) {
2003
+ if (valid.length > 0 && valid.pattern) {
1980
2004
  validCard = true;
1981
2005
  }
1982
2006
  }
@@ -2008,7 +2032,7 @@
2008
2032
  ;
2009
2033
  while (length--) {
2010
2034
  sum += producedValue[multiple][parseInt(cardNumber.charAt(length), 10)];
2011
- multiple ^= 1;
2035
+ multiple ^= 1; // eslint-disable-line no-bitwise
2012
2036
  }
2013
2037
 
2014
2038
  return (sum % 10 === 0 && sum > 0);