fomantic-ui-sass 2.9.1 → 2.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/app/assets/fonts/semantic-ui/Lato-Bold.woff +0 -0
  4. data/app/assets/fonts/semantic-ui/Lato-Bold.woff2 +0 -0
  5. data/app/assets/fonts/semantic-ui/Lato-BoldItalic.woff +0 -0
  6. data/app/assets/fonts/semantic-ui/Lato-BoldItalic.woff2 +0 -0
  7. data/app/assets/fonts/semantic-ui/Lato-Italic.woff +0 -0
  8. data/app/assets/fonts/semantic-ui/Lato-Italic.woff2 +0 -0
  9. data/app/assets/fonts/semantic-ui/Lato-Regular.woff +0 -0
  10. data/app/assets/fonts/semantic-ui/Lato-Regular.woff2 +0 -0
  11. data/app/assets/fonts/semantic-ui/LatoLatin-Bold.woff +0 -0
  12. data/app/assets/fonts/semantic-ui/LatoLatin-Bold.woff2 +0 -0
  13. data/app/assets/fonts/semantic-ui/LatoLatin-BoldItalic.woff +0 -0
  14. data/app/assets/fonts/semantic-ui/LatoLatin-BoldItalic.woff2 +0 -0
  15. data/app/assets/fonts/semantic-ui/LatoLatin-Italic.woff +0 -0
  16. data/app/assets/fonts/semantic-ui/LatoLatin-Italic.woff2 +0 -0
  17. data/app/assets/fonts/semantic-ui/LatoLatin-Regular.woff +0 -0
  18. data/app/assets/fonts/semantic-ui/LatoLatin-Regular.woff2 +0 -0
  19. data/app/assets/javascripts/semantic-ui/accordion.js +3 -3
  20. data/app/assets/javascripts/semantic-ui/dimmer.js +2 -2
  21. data/app/assets/javascripts/semantic-ui/dropdown.js +2 -2
  22. data/app/assets/javascripts/semantic-ui/embed.js +1 -1
  23. data/app/assets/javascripts/semantic-ui/flyout.js +17 -29
  24. data/app/assets/javascripts/semantic-ui/form.js +116 -106
  25. data/app/assets/javascripts/semantic-ui/modal.js +14 -7
  26. data/app/assets/javascripts/semantic-ui/popup.js +19 -7
  27. data/app/assets/javascripts/semantic-ui/progress.js +2 -28
  28. data/app/assets/javascripts/semantic-ui/search.js +1 -1
  29. data/app/assets/javascripts/semantic-ui/shape.js +14 -36
  30. data/app/assets/javascripts/semantic-ui/sidebar.js +6 -26
  31. data/app/assets/javascripts/semantic-ui/toast.js +2 -2
  32. data/app/assets/javascripts/semantic-ui/transition.js +9 -60
  33. data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +1 -1
  34. data/app/assets/stylesheets/semantic-ui/collections/_form.scss +66 -37
  35. data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +7 -1
  36. data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +31 -7
  37. data/app/assets/stylesheets/semantic-ui/collections/_message.scss +1 -1
  38. data/app/assets/stylesheets/semantic-ui/collections/_table.scss +2 -2
  39. data/app/assets/stylesheets/semantic-ui/elements/_button.scss +1 -1
  40. data/app/assets/stylesheets/semantic-ui/elements/_container.scss +1 -1
  41. data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +1 -1
  42. data/app/assets/stylesheets/semantic-ui/elements/_emoji.scss +2 -2
  43. data/app/assets/stylesheets/semantic-ui/elements/_flag.scss +1 -1
  44. data/app/assets/stylesheets/semantic-ui/elements/_header.scss +1 -1
  45. data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +1 -1
  46. data/app/assets/stylesheets/semantic-ui/elements/_image.scss +1 -1
  47. data/app/assets/stylesheets/semantic-ui/elements/_input.scss +59 -25
  48. data/app/assets/stylesheets/semantic-ui/elements/_label.scss +1 -1
  49. data/app/assets/stylesheets/semantic-ui/elements/_list.scss +1 -1
  50. data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +1 -1
  51. data/app/assets/stylesheets/semantic-ui/elements/_placeholder.scss +1 -1
  52. data/app/assets/stylesheets/semantic-ui/elements/_rail.scss +1 -1
  53. data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +1 -1
  54. data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +26 -4
  55. data/app/assets/stylesheets/semantic-ui/elements/_step.scss +4 -4
  56. data/app/assets/stylesheets/semantic-ui/elements/_text.scss +2 -2
  57. data/app/assets/stylesheets/semantic-ui/globals/_reset.scss +1 -1
  58. data/app/assets/stylesheets/semantic-ui/globals/_site.scss +1 -10
  59. data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +1 -1
  60. data/app/assets/stylesheets/semantic-ui/modules/_calendar.scss +1 -1
  61. data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +40 -40
  62. data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +1 -1
  63. data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +8 -6
  64. data/app/assets/stylesheets/semantic-ui/modules/_embed.scss +2 -2
  65. data/app/assets/stylesheets/semantic-ui/modules/_flyout.scss +1 -1
  66. data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +1 -1
  67. data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +1 -1
  68. data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +148 -3
  69. data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +1 -1
  70. data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +1 -1
  71. data/app/assets/stylesheets/semantic-ui/modules/_search.scss +1 -1
  72. data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +1 -1
  73. data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +1 -1
  74. data/app/assets/stylesheets/semantic-ui/modules/_slider.scss +9 -6
  75. data/app/assets/stylesheets/semantic-ui/modules/_sticky.scss +1 -1
  76. data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +1 -1
  77. data/app/assets/stylesheets/semantic-ui/modules/_toast.scss +1 -1
  78. data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +1 -1
  79. data/app/assets/stylesheets/semantic-ui/views/_ad.scss +1 -1
  80. data/app/assets/stylesheets/semantic-ui/views/_card.scss +1 -1
  81. data/app/assets/stylesheets/semantic-ui/views/_comment.scss +1 -1
  82. data/app/assets/stylesheets/semantic-ui/views/_feed.scss +1 -1
  83. data/app/assets/stylesheets/semantic-ui/views/_item.scss +2 -2
  84. data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +1 -1
  85. data/lib/fomantic/ui/sass/version.rb +2 -2
  86. metadata +1 -1
@@ -193,7 +193,7 @@
193
193
  $prompt = $fieldGroup.find(selector.prompt),
194
194
  $calendar = $field.closest(selector.uiCalendar),
195
195
  defaultValue = $field.data(metadata.defaultValue) || '',
196
- isCheckbox = $element.is(selector.uiCheckbox),
196
+ isCheckbox = $field.is(selector.checkbox),
197
197
  isDropdown = $element.is(selector.uiDropdown) && module.can.useElement('dropdown'),
198
198
  isCalendar = $calendar.length > 0 && module.can.useElement('calendar'),
199
199
  isErrored = $fieldGroup.hasClass(className.error)
@@ -227,7 +227,7 @@
227
227
  $calendar = $field.closest(selector.uiCalendar),
228
228
  $prompt = $fieldGroup.find(selector.prompt),
229
229
  defaultValue = $field.data(metadata.defaultValue),
230
- isCheckbox = $element.is(selector.uiCheckbox),
230
+ isCheckbox = $field.is(selector.checkbox),
231
231
  isDropdown = $element.is(selector.uiDropdown) && module.can.useElement('dropdown'),
232
232
  isCalendar = $calendar.length > 0 && module.can.useElement('calendar'),
233
233
  isErrored = $fieldGroup.hasClass(className.error)
@@ -244,7 +244,7 @@
244
244
  module.verbose('Resetting dropdown value', $element, defaultValue);
245
245
  $element.dropdown('restore defaults', true);
246
246
  } else if (isCheckbox) {
247
- module.verbose('Resetting checkbox value', $element, defaultValue);
247
+ module.verbose('Resetting checkbox value', $field, defaultValue);
248
248
  $field.prop('checked', defaultValue);
249
249
  } else if (isCalendar) {
250
250
  $calendar.calendar('set date', defaultValue);
@@ -533,14 +533,12 @@
533
533
  : rule.prompt || settings.prompt[ruleName] || settings.text.unspecifiedRule,
534
534
  requiresValue = prompt.search('{value}') !== -1,
535
535
  requiresName = prompt.search('{name}') !== -1,
536
- $label,
537
- name,
538
536
  parts,
539
537
  suffixPrompt
540
538
  ;
541
- if (ancillary && ['integer', 'decimal', 'number'].indexOf(ruleName) >= 0 && ancillary.indexOf('..') >= 0) {
539
+ if (ancillary && ['integer', 'decimal', 'number', 'size'].indexOf(ruleName) >= 0 && ancillary.indexOf('..') >= 0) {
542
540
  parts = ancillary.split('..', 2);
543
- if (!rule.prompt) {
541
+ if (!rule.prompt && ruleName !== 'size') {
544
542
  suffixPrompt = parts[0] === ''
545
543
  ? settings.prompt.maxValue.replace(/{ruleValue}/g, '{max}')
546
544
  : (parts[1] === ''
@@ -551,15 +549,14 @@
551
549
  prompt = prompt.replace(/{min}/g, parts[0]);
552
550
  prompt = prompt.replace(/{max}/g, parts[1]);
553
551
  }
552
+ if (ancillary && ['match', 'different'].indexOf(ruleName) >= 0) {
553
+ prompt = prompt.replace(/{ruleValue}/g, module.get.fieldLabel(ancillary, true));
554
+ }
554
555
  if (requiresValue) {
555
556
  prompt = prompt.replace(/{value}/g, $field.val());
556
557
  }
557
558
  if (requiresName) {
558
- $label = $field.closest(selector.group).find('label').eq(0);
559
- name = $label.length === 1
560
- ? $label.text()
561
- : $field.prop('placeholder') || settings.text.unspecifiedField;
562
- prompt = prompt.replace(/{name}/g, name);
559
+ prompt = prompt.replace(/{name}/g, module.get.fieldLabel($field));
563
560
  }
564
561
  prompt = prompt.replace(/{identifier}/g, field.identifier);
565
562
  prompt = prompt.replace(/{ruleValue}/g, ancillary);
@@ -599,7 +596,7 @@
599
596
  // refresh selector cache
600
597
  (instance || module).refresh();
601
598
  },
602
- field: function (identifier) {
599
+ field: function (identifier, strict) {
603
600
  module.verbose('Finding field with identifier', identifier);
604
601
  identifier = module.escape.string(identifier);
605
602
  var t;
@@ -621,18 +618,29 @@
621
618
  }
622
619
  module.error(error.noField.replace('{identifier}', identifier));
623
620
 
624
- return $('<input/>');
621
+ return strict ? $() : $('<input/>');
625
622
  },
626
- fields: function (fields) {
623
+ fields: function (fields, strict) {
627
624
  var
628
625
  $fields = $()
629
626
  ;
630
627
  $.each(fields, function (index, name) {
631
- $fields = $fields.add(module.get.field(name));
628
+ $fields = $fields.add(module.get.field(name, strict));
632
629
  });
633
630
 
634
631
  return $fields;
635
632
  },
633
+ fieldLabel: function (identifier, useIdAsFallback) {
634
+ var $field = typeof identifier === 'string'
635
+ ? module.get.field(identifier)
636
+ : identifier,
637
+ $label = $field.closest(selector.group).find('label').eq(0)
638
+ ;
639
+
640
+ return $label.length === 1
641
+ ? $label.text()
642
+ : $field.prop('placeholder') || (useIdAsFallback ? identifier : settings.text.unspecifiedField);
643
+ },
636
644
  validation: function ($field) {
637
645
  var
638
646
  fieldValidation,
@@ -655,20 +663,22 @@
655
663
 
656
664
  return fieldValidation || false;
657
665
  },
658
- value: function (field) {
666
+ value: function (field, strict) {
659
667
  var
660
668
  fields = [],
661
- results
669
+ results,
670
+ resultKeys
662
671
  ;
663
672
  fields.push(field);
664
- results = module.get.values.call(element, fields);
673
+ results = module.get.values.call(element, fields, strict);
674
+ resultKeys = Object.keys(results);
665
675
 
666
- return results[field];
676
+ return resultKeys.length > 0 ? results[resultKeys[0]] : undefined;
667
677
  },
668
- values: function (fields) {
678
+ values: function (fields, strict) {
669
679
  var
670
- $fields = Array.isArray(fields)
671
- ? module.get.fields(fields)
680
+ $fields = Array.isArray(fields) && fields.length > 0
681
+ ? module.get.fields(fields, strict)
672
682
  : $field,
673
683
  values = {}
674
684
  ;
@@ -786,16 +796,8 @@
786
796
 
787
797
  field: function (identifier) {
788
798
  module.verbose('Checking for existence of a field with identifier', identifier);
789
- identifier = module.escape.string(identifier);
790
- if (typeof identifier !== 'string') {
791
- module.error(error.identifier, identifier);
792
- }
793
799
 
794
- return (
795
- $field.filter('#' + identifier).length > 0
796
- || $field.filter('[name="' + identifier + '"]').length > 0
797
- || $field.filter('[data-' + metadata.validate + '="' + identifier + '"]').length > 0
798
- );
800
+ return module.get.field(identifier, true).length > 0;
799
801
  },
800
802
 
801
803
  },
@@ -819,6 +821,22 @@
819
821
  },
820
822
  },
821
823
 
824
+ checkErrors: function (errors, internal) {
825
+ if (!errors || errors.length === 0) {
826
+ if (!internal) {
827
+ module.error(settings.error.noErrorMessage);
828
+ }
829
+
830
+ return false;
831
+ }
832
+ if (!internal) {
833
+ errors = typeof errors === 'string'
834
+ ? [errors]
835
+ : errors;
836
+ }
837
+
838
+ return errors;
839
+ },
822
840
  add: {
823
841
  // alias
824
842
  rule: function (name, rules) {
@@ -862,15 +880,16 @@
862
880
  module.refreshEvents();
863
881
  },
864
882
  prompt: function (identifier, errors, internal) {
883
+ errors = module.checkErrors(errors);
884
+ if (errors === false) {
885
+ return;
886
+ }
865
887
  var
866
888
  $field = module.get.field(identifier),
867
889
  $fieldGroup = $field.closest($group),
868
890
  $prompt = $fieldGroup.children(selector.prompt),
869
891
  promptExists = $prompt.length > 0
870
892
  ;
871
- errors = typeof errors === 'string'
872
- ? [errors]
873
- : errors;
874
893
  module.verbose('Adding field error state', identifier);
875
894
  if (!internal) {
876
895
  $fieldGroup
@@ -888,7 +907,7 @@
888
907
  .html(settings.templates.prompt(errors))
889
908
  ;
890
909
  if (!promptExists) {
891
- if (settings.transition && module.can.useElement('transition') && $module.transition('is supported')) {
910
+ if (settings.transition && module.can.useElement('transition')) {
892
911
  module.verbose('Displaying error with css transition', settings.transition);
893
912
  $prompt.transition(settings.transition + ' in', settings.duration);
894
913
  } else {
@@ -903,11 +922,40 @@
903
922
  }
904
923
  },
905
924
  errors: function (errors) {
925
+ errors = module.checkErrors(errors);
926
+ if (errors === false) {
927
+ return;
928
+ }
906
929
  module.debug('Adding form error messages', errors);
907
930
  module.set.error();
908
- $message
909
- .html(settings.templates.error(errors))
931
+ var customErrors = [],
932
+ tempErrors
910
933
  ;
934
+ if ($.isPlainObject(errors)) {
935
+ $.each(Object.keys(errors), function (i, id) {
936
+ if (module.checkErrors(errors[id], true) !== false) {
937
+ if (settings.inline) {
938
+ module.add.prompt(id, errors[id]);
939
+ } else {
940
+ tempErrors = module.checkErrors(errors[id]);
941
+ if (tempErrors !== false) {
942
+ $.each(tempErrors, function (index, tempError) {
943
+ customErrors.push(settings.prompt.addErrors
944
+ .replace(/{name}/g, module.get.fieldLabel(id))
945
+ .replace(/{error}/g, tempError));
946
+ });
947
+ }
948
+ }
949
+ }
950
+ });
951
+ } else {
952
+ customErrors = errors;
953
+ }
954
+ if (customErrors.length > 0) {
955
+ $message
956
+ .html(settings.templates.error(customErrors))
957
+ ;
958
+ }
911
959
  },
912
960
  },
913
961
 
@@ -984,7 +1032,7 @@
984
1032
  ;
985
1033
  if (settings.inline && $prompt.is(':visible')) {
986
1034
  module.verbose('Removing prompt for field', identifier);
987
- if (settings.transition && module.can.useElement('transition') && $module.transition('is supported')) {
1035
+ if (settings.transition && module.can.useElement('transition')) {
988
1036
  $prompt.transition(settings.transition + ' out', settings.duration, function () {
989
1037
  $prompt.remove();
990
1038
  });
@@ -1012,15 +1060,19 @@
1012
1060
  $el = $(el),
1013
1061
  $parent = $el.parent(),
1014
1062
  isCheckbox = $el.filter(selector.checkbox).length > 0,
1015
- isDropdown = $parent.is(selector.uiDropdown) && module.can.useElement('dropdown'),
1016
- $calendar = $el.closest(selector.uiCalendar),
1017
- isCalendar = $calendar.length > 0 && module.can.useElement('calendar'),
1063
+ isDropdown = ($parent.is(selector.uiDropdown) || $el.is(selector.uiDropdown)) && module.can.useElement('dropdown'),
1064
+ $calendar = $el.closest(selector.uiCalendar),
1065
+ isCalendar = $calendar.length > 0 && module.can.useElement('calendar'),
1018
1066
  value = isCheckbox
1019
1067
  ? $el.is(':checked')
1020
1068
  : $el.val()
1021
1069
  ;
1022
1070
  if (isDropdown) {
1023
- $parent.dropdown('save defaults');
1071
+ if ($parent.is(selector.uiDropdown)) {
1072
+ $parent.dropdown('save defaults');
1073
+ } else {
1074
+ $el.dropdown('save defaults');
1075
+ }
1024
1076
  } else if (isCalendar) {
1025
1077
  $calendar.calendar('refresh');
1026
1078
  }
@@ -1320,7 +1372,7 @@
1320
1372
  ? String(value + '').trim()
1321
1373
  : String(value + ''));
1322
1374
 
1323
- return ruleFunction.call(field, value, ancillary, $module);
1375
+ return ruleFunction.call(field, value, ancillary, module);
1324
1376
  }
1325
1377
  ;
1326
1378
  if (!isFunction(ruleFunction)) {
@@ -1581,17 +1633,19 @@
1581
1633
  notExactly: '{name} cannot be set to exactly "{ruleValue}"',
1582
1634
  contain: '{name} must contain "{ruleValue}"',
1583
1635
  containExactly: '{name} must contain exactly "{ruleValue}"',
1584
- doesntContain: '{name} cannot contain "{ruleValue}"',
1636
+ doesntContain: '{name} cannot contain "{ruleValue}"',
1585
1637
  doesntContainExactly: '{name} cannot contain exactly "{ruleValue}"',
1586
1638
  minLength: '{name} must be at least {ruleValue} characters',
1587
1639
  exactLength: '{name} must be exactly {ruleValue} characters',
1588
1640
  maxLength: '{name} cannot be longer than {ruleValue} characters',
1641
+ size: '{name} must have a length between {min} and {max} characters',
1589
1642
  match: '{name} must match {ruleValue} field',
1590
1643
  different: '{name} must have a different value than {ruleValue} field',
1591
1644
  creditCard: '{name} must be a valid credit card number',
1592
1645
  minCount: '{name} must have at least {ruleValue} choices',
1593
1646
  exactCount: '{name} must have exactly {ruleValue} choices',
1594
1647
  maxCount: '{name} must have {ruleValue} or less choices',
1648
+ addErrors: '{name}: {error}',
1595
1649
  },
1596
1650
 
1597
1651
  selector: {
@@ -1620,11 +1674,11 @@
1620
1674
  },
1621
1675
 
1622
1676
  error: {
1623
- identifier: 'You must specify a string identifier for each field',
1624
1677
  method: 'The method you called is not defined.',
1625
1678
  noRule: 'There is no rule matching the one you specified',
1626
1679
  noField: 'Field identifier {identifier} not found',
1627
1680
  noElement: 'This module requires ui {element}',
1681
+ noErrorMessage: 'No error message provided',
1628
1682
  },
1629
1683
 
1630
1684
  templates: {
@@ -1746,7 +1800,7 @@
1746
1800
  integer: function (value, range) {
1747
1801
  return $.fn.form.settings.rules.range(value, range, 'integer');
1748
1802
  },
1749
- range: function (value, range, regExp) {
1803
+ range: function (value, range, regExp, testLength) {
1750
1804
  if (typeof regExp === 'string') {
1751
1805
  regExp = $.fn.form.settings.regExp[regExp];
1752
1806
  }
@@ -1775,6 +1829,9 @@
1775
1829
  max = parts[1] - 0;
1776
1830
  }
1777
1831
  }
1832
+ if (testLength) {
1833
+ value = value.length;
1834
+ }
1778
1835
 
1779
1836
  return (
1780
1837
  regExp.test(value)
@@ -1860,51 +1917,27 @@
1860
1917
  },
1861
1918
 
1862
1919
  // is at least string length
1863
- minLength: function (value, requiredLength) {
1864
- return value !== undefined
1865
- ? value.length >= requiredLength
1866
- : false;
1920
+ minLength: function (value, minLength) {
1921
+ return $.fn.form.settings.rules.range(value, minLength + '..', 'integer', true);
1867
1922
  },
1868
1923
 
1869
1924
  // is exactly length
1870
1925
  exactLength: function (value, requiredLength) {
1871
- return value !== undefined
1872
- ? value.length === Number(requiredLength)
1873
- : false;
1926
+ return $.fn.form.settings.rules.range(value, requiredLength + '..' + requiredLength, 'integer', true);
1874
1927
  },
1875
1928
 
1876
1929
  // is less than length
1877
1930
  maxLength: function (value, maxLength) {
1878
- return value !== undefined
1879
- ? value.length <= maxLength
1880
- : false;
1931
+ return $.fn.form.settings.rules.range(value, '..' + maxLength, 'integer', true);
1932
+ },
1933
+
1934
+ size: function (value, range) {
1935
+ return $.fn.form.settings.rules.range(value, range, 'integer', true);
1881
1936
  },
1882
1937
 
1883
1938
  // matches another field
1884
- match: function (value, identifier, $module) {
1885
- var
1886
- matchingValue,
1887
- matchingElement
1888
- ;
1889
- matchingElement = $module.find('[data-validate="' + identifier + '"]');
1890
- if (matchingElement.length > 0) {
1891
- matchingValue = matchingElement.val();
1892
- } else {
1893
- matchingElement = $module.find('#' + identifier);
1894
- if (matchingElement.length > 0) {
1895
- matchingValue = matchingElement.val();
1896
- } else {
1897
- matchingElement = $module.find('[name="' + identifier + '"]');
1898
- if (matchingElement.length > 0) {
1899
- matchingValue = matchingElement.val();
1900
- } else {
1901
- matchingElement = $module.find('[name="' + identifier + '[]"]');
1902
- if (matchingElement.length > 0) {
1903
- matchingValue = matchingElement;
1904
- }
1905
- }
1906
- }
1907
- }
1939
+ match: function (value, identifier, module) {
1940
+ var matchingValue = module.get.value(identifier, true);
1908
1941
 
1909
1942
  return matchingValue !== undefined
1910
1943
  ? value.toString() === matchingValue.toString()
@@ -1912,31 +1945,8 @@
1912
1945
  },
1913
1946
 
1914
1947
  // different than another field
1915
- different: function (value, identifier, $module) {
1916
- // use either id or name of field
1917
- var
1918
- matchingValue,
1919
- matchingElement
1920
- ;
1921
- matchingElement = $module.find('[data-validate="' + identifier + '"]');
1922
- if (matchingElement.length > 0) {
1923
- matchingValue = matchingElement.val();
1924
- } else {
1925
- matchingElement = $module.find('#' + identifier);
1926
- if (matchingElement.length > 0) {
1927
- matchingValue = matchingElement.val();
1928
- } else {
1929
- matchingElement = $module.find('[name="' + identifier + '"]');
1930
- if (matchingElement.length > 0) {
1931
- matchingValue = matchingElement.val();
1932
- } else {
1933
- matchingElement = $module.find('[name="' + identifier + '[]"]');
1934
- if (matchingElement.length > 0) {
1935
- matchingValue = matchingElement;
1936
- }
1937
- }
1938
- }
1939
- }
1948
+ different: function (value, identifier, module) {
1949
+ var matchingValue = module.get.value(identifier, true);
1940
1950
 
1941
1951
  return matchingValue !== undefined
1942
1952
  ? value.toString() !== matchingValue.toString()
@@ -82,6 +82,7 @@
82
82
  elementEventNamespace,
83
83
  id,
84
84
  observer,
85
+ observeAttributes = false,
85
86
  module
86
87
  ;
87
88
  module = {
@@ -265,7 +266,7 @@
265
266
  ;
266
267
  mutations.every(function (mutation) {
267
268
  if (mutation.type === 'attributes') {
268
- if (mutation.attributeName === 'disabled' || $(mutation.target).find(':input').addBack(':input')) {
269
+ if (observeAttributes && (mutation.attributeName === 'disabled' || $(mutation.target).find(':input').addBack(':input').length > 0)) {
269
270
  shouldRefreshInputs = true;
270
271
  }
271
272
  } else {
@@ -324,10 +325,11 @@
324
325
  $inputs = $module.find('a[href], [tabindex], :input:enabled').filter(':visible').filter(function () {
325
326
  return $(this).closest('.disabled').length === 0;
326
327
  });
327
- $module.removeAttr('tabindex');
328
328
  if ($inputs.length === 0) {
329
329
  $inputs = $module;
330
330
  $module.attr('tabindex', -1);
331
+ } else {
332
+ $module.removeAttr('tabindex');
331
333
  }
332
334
  $inputs.first()
333
335
  .on('keydown' + elementEventNamespace, module.event.inputKeyDown.first)
@@ -604,8 +606,9 @@
604
606
  $module.detach().appendTo($dimmer);
605
607
  }
606
608
  }
607
- if (settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
609
+ if (settings.transition && $.fn.transition !== undefined) {
608
610
  module.debug('Showing modal with css animations');
611
+ module.set.observeAttributes(false);
609
612
  $module
610
613
  .transition({
611
614
  debug: settings.debug,
@@ -623,6 +626,7 @@
623
626
  module.save.focus();
624
627
  module.set.active();
625
628
  module.refreshInputs();
629
+ requestAnimationFrame(module.set.observeAttributes);
626
630
  callback();
627
631
  },
628
632
  })
@@ -652,8 +656,9 @@
652
656
 
653
657
  if (module.is.animating() || module.is.active()) {
654
658
  module.debug('Hiding modal');
655
- if (settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
659
+ if (settings.transition && $.fn.transition !== undefined) {
656
660
  module.remove.active();
661
+ module.set.observeAttributes(false);
657
662
  $module
658
663
  .transition({
659
664
  debug: settings.debug,
@@ -673,6 +678,7 @@
673
678
  },
674
679
  onComplete: function () {
675
680
  module.unbind.scrollLock();
681
+ module.remove.active();
676
682
  if (settings.allowMultiple) {
677
683
  $previousModal.addClass(className.front);
678
684
  $module.removeClass(className.front);
@@ -988,9 +994,7 @@
988
994
  return module.cache.isIE;
989
995
  },
990
996
  animating: function () {
991
- return $module.transition('is supported')
992
- ? $module.transition('is animating')
993
- : $module.is(':visible');
997
+ return $module.transition('is animating');
994
998
  },
995
999
  scrolling: function () {
996
1000
  return $dimmable.hasClass(className.scrolling);
@@ -1033,6 +1037,9 @@
1033
1037
  },
1034
1038
 
1035
1039
  set: {
1040
+ observeAttributes: function (state) {
1041
+ observeAttributes = state !== false;
1042
+ },
1036
1043
  autofocus: function () {
1037
1044
  var
1038
1045
  $autofocus = $inputs.filter('[autofocus]'),
@@ -125,9 +125,9 @@
125
125
  }
126
126
  }
127
127
  if (settings.popup) {
128
- $popup.addClass(className.loading);
128
+ module.set.invisible();
129
129
  $offsetParent = module.get.offsetParent();
130
- $popup.removeClass(className.loading);
130
+ module.remove.invisible();
131
131
  if (settings.movePopup && module.has.popup() && module.get.offsetParent($popup)[0] !== $offsetParent[0]) {
132
132
  module.debug('Moving popup to the same offset parent as target');
133
133
  $popup
@@ -414,7 +414,7 @@
414
414
  animate: {
415
415
  show: function (callback) {
416
416
  callback = isFunction(callback) ? callback : function () {};
417
- if (settings.transition && module.can.useElement('transition') && $module.transition('is supported')) {
417
+ if (settings.transition && module.can.useElement('transition')) {
418
418
  module.set.visible();
419
419
  $popup
420
420
  .transition({
@@ -436,7 +436,7 @@
436
436
  hide: function (callback) {
437
437
  callback = isFunction(callback) ? callback : function () {};
438
438
  module.debug('Hiding pop-up');
439
- if (settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
439
+ if (settings.transition && $.fn.transition !== undefined) {
440
440
  $popup
441
441
  .transition({
442
442
  animation: (settings.transition.hideMethod || settings.transition) + ' out',
@@ -901,8 +901,8 @@
901
901
  .css(positioning)
902
902
  .removeClass(className.position)
903
903
  .addClass(position)
904
- .addClass(className.loading)
905
904
  ;
905
+ module.set.invisible();
906
906
 
907
907
  popupOffset = module.get.popupOffset();
908
908
 
@@ -926,7 +926,7 @@
926
926
  module.debug('Popup could not find a position to display', $popup);
927
927
  module.error(error.cannotPlace, element);
928
928
  module.remove.attempts();
929
- module.remove.loading();
929
+ module.remove.invisible();
930
930
  module.reset();
931
931
  settings.onUnplaceable.call($popup, element);
932
932
 
@@ -935,7 +935,7 @@
935
935
  }
936
936
  module.debug('Position is on stage', position);
937
937
  module.remove.attempts();
938
- module.remove.loading();
938
+ module.remove.invisible();
939
939
  if (settings.setFluidWidth && module.is.fluid()) {
940
940
  module.set.fluidWidth(calculations);
941
941
  }
@@ -949,6 +949,14 @@
949
949
  $popup.css('width', calculations.container.width);
950
950
  },
951
951
 
952
+ loading: function () {
953
+ $popup.addClass(className.loading);
954
+ },
955
+
956
+ invisible: function () {
957
+ $popup.addClass(className.invisible);
958
+ },
959
+
952
960
  variation: function (variation) {
953
961
  variation = variation || module.get.variation();
954
962
  if (variation && module.has.popup()) {
@@ -966,6 +974,9 @@
966
974
  loading: function () {
967
975
  $popup.removeClass(className.loading);
968
976
  },
977
+ invisible: function () {
978
+ $popup.removeClass(className.invisible);
979
+ },
969
980
  variation: function (variation) {
970
981
  variation = variation || module.get.variation();
971
982
  if (variation) {
@@ -1475,6 +1486,7 @@
1475
1486
  basic: 'basic',
1476
1487
  animating: 'animating',
1477
1488
  dropdown: 'dropdown',
1489
+ invisible: 'invisible',
1478
1490
  fluid: 'fluid',
1479
1491
  loading: 'loading',
1480
1492
  popup: 'ui popup',