fomantic-ui 2.10.0-beta.1 → 2.10.0-beta.10

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 (287) hide show
  1. package/.all-contributorsrc +9 -0
  2. package/.eslintrc.js +0 -10
  3. package/CONTRIBUTING.md +4 -1
  4. package/CONTRIBUTORS.md +1 -0
  5. package/FAQ.md +7 -2
  6. package/README.md +5 -9
  7. package/ROADMAP.md +4 -4
  8. package/SECURITY.md +8 -7
  9. package/changelog-setup.js +64 -70
  10. package/dist/components/accordion.css +1 -1
  11. package/dist/components/accordion.js +103 -142
  12. package/dist/components/accordion.min.css +1 -1
  13. package/dist/components/accordion.min.js +2 -2
  14. package/dist/components/ad.css +1 -1
  15. package/dist/components/ad.min.css +1 -1
  16. package/dist/components/api.js +157 -210
  17. package/dist/components/api.min.js +2 -2
  18. package/dist/components/breadcrumb.css +1 -1
  19. package/dist/components/breadcrumb.min.css +1 -1
  20. package/dist/components/button.css +1 -2
  21. package/dist/components/button.min.css +2 -2
  22. package/dist/components/calendar.css +1 -2
  23. package/dist/components/calendar.js +314 -352
  24. package/dist/components/calendar.min.css +2 -2
  25. package/dist/components/calendar.min.js +2 -2
  26. package/dist/components/card.css +1 -1
  27. package/dist/components/card.min.css +1 -1
  28. package/dist/components/checkbox.css +1 -2
  29. package/dist/components/checkbox.js +85 -135
  30. package/dist/components/checkbox.min.css +2 -2
  31. package/dist/components/checkbox.min.js +2 -2
  32. package/dist/components/comment.css +1 -1
  33. package/dist/components/comment.min.css +1 -1
  34. package/dist/components/container.css +2 -4
  35. package/dist/components/container.min.css +2 -2
  36. package/dist/components/dimmer.css +1 -11
  37. package/dist/components/dimmer.js +61 -94
  38. package/dist/components/dimmer.min.css +2 -2
  39. package/dist/components/dimmer.min.js +2 -2
  40. package/dist/components/divider.css +1 -2
  41. package/dist/components/divider.min.css +2 -2
  42. package/dist/components/dropdown.css +30 -51
  43. package/dist/components/dropdown.js +736 -1055
  44. package/dist/components/dropdown.min.css +2 -2
  45. package/dist/components/dropdown.min.js +2 -2
  46. package/dist/components/embed.css +1 -1
  47. package/dist/components/embed.js +85 -114
  48. package/dist/components/embed.min.css +1 -1
  49. package/dist/components/embed.min.js +2 -2
  50. package/dist/components/emoji.css +3809 -7617
  51. package/dist/components/emoji.min.css +2 -2
  52. package/dist/components/feed.css +1 -1
  53. package/dist/components/feed.min.css +1 -1
  54. package/dist/components/flag.css +1 -1
  55. package/dist/components/flag.min.css +1 -1
  56. package/dist/components/flyout.css +2 -3
  57. package/dist/components/flyout.js +226 -355
  58. package/dist/components/flyout.min.css +2 -2
  59. package/dist/components/flyout.min.js +2 -2
  60. package/dist/components/form.css +5 -95
  61. package/dist/components/form.js +335 -444
  62. package/dist/components/form.min.css +2 -2
  63. package/dist/components/form.min.js +2 -2
  64. package/dist/components/grid.css +2 -58
  65. package/dist/components/grid.min.css +2 -2
  66. package/dist/components/header.css +1 -1
  67. package/dist/components/header.min.css +1 -1
  68. package/dist/components/icon.css +4 -4
  69. package/dist/components/icon.min.css +2 -2
  70. package/dist/components/image.css +1 -1
  71. package/dist/components/image.min.css +1 -1
  72. package/dist/components/input.css +1 -536
  73. package/dist/components/input.min.css +2 -2
  74. package/dist/components/item.css +1 -1
  75. package/dist/components/item.min.css +1 -1
  76. package/dist/components/label.css +1 -1
  77. package/dist/components/label.min.css +1 -1
  78. package/dist/components/list.css +1 -3
  79. package/dist/components/list.min.css +2 -2
  80. package/dist/components/loader.css +1 -1
  81. package/dist/components/loader.min.css +1 -1
  82. package/dist/components/menu.css +1 -9
  83. package/dist/components/menu.min.css +2 -2
  84. package/dist/components/message.css +1 -1
  85. package/dist/components/message.min.css +1 -1
  86. package/dist/components/modal.css +5 -9
  87. package/dist/components/modal.js +261 -384
  88. package/dist/components/modal.min.css +2 -2
  89. package/dist/components/modal.min.js +2 -2
  90. package/dist/components/nag.css +1 -1
  91. package/dist/components/nag.js +68 -98
  92. package/dist/components/nag.min.css +1 -1
  93. package/dist/components/nag.min.js +2 -2
  94. package/dist/components/placeholder.css +1 -1
  95. package/dist/components/placeholder.min.css +1 -1
  96. package/dist/components/popup.css +1 -2
  97. package/dist/components/popup.js +198 -271
  98. package/dist/components/popup.min.css +2 -2
  99. package/dist/components/popup.min.js +2 -2
  100. package/dist/components/progress.css +1 -1
  101. package/dist/components/progress.js +109 -144
  102. package/dist/components/progress.min.css +1 -1
  103. package/dist/components/progress.min.js +2 -2
  104. package/dist/components/rail.css +1 -1
  105. package/dist/components/rail.min.css +1 -1
  106. package/dist/components/rating.css +1 -1
  107. package/dist/components/rating.js +91 -123
  108. package/dist/components/rating.min.css +1 -1
  109. package/dist/components/rating.min.js +2 -2
  110. package/dist/components/reset.css +1 -1
  111. package/dist/components/reset.min.css +1 -1
  112. package/dist/components/reveal.css +1 -1
  113. package/dist/components/reveal.min.css +1 -1
  114. package/dist/components/search.css +2 -9
  115. package/dist/components/search.js +277 -379
  116. package/dist/components/search.min.css +2 -2
  117. package/dist/components/search.min.js +2 -2
  118. package/dist/components/segment.css +2 -7
  119. package/dist/components/segment.min.css +2 -2
  120. package/dist/components/shape.css +1 -2
  121. package/dist/components/shape.js +158 -224
  122. package/dist/components/shape.min.css +2 -2
  123. package/dist/components/shape.min.js +2 -2
  124. package/dist/components/sidebar.css +2 -3
  125. package/dist/components/sidebar.js +124 -206
  126. package/dist/components/sidebar.min.css +2 -2
  127. package/dist/components/sidebar.min.js +2 -2
  128. package/dist/components/site.css +9 -25
  129. package/dist/components/site.js +38 -57
  130. package/dist/components/site.min.css +2 -2
  131. package/dist/components/site.min.js +2 -2
  132. package/dist/components/slider.css +1 -1
  133. package/dist/components/slider.js +246 -329
  134. package/dist/components/slider.min.css +1 -1
  135. package/dist/components/slider.min.js +2 -2
  136. package/dist/components/state.js +70 -100
  137. package/dist/components/state.min.js +2 -2
  138. package/dist/components/statistic.css +1 -1
  139. package/dist/components/statistic.min.css +1 -1
  140. package/dist/components/step.css +1 -1
  141. package/dist/components/step.min.css +1 -1
  142. package/dist/components/sticky.css +1 -1
  143. package/dist/components/sticky.js +135 -180
  144. package/dist/components/sticky.min.css +1 -1
  145. package/dist/components/sticky.min.js +2 -2
  146. package/dist/components/tab.css +1 -1
  147. package/dist/components/tab.js +176 -244
  148. package/dist/components/tab.min.css +1 -1
  149. package/dist/components/tab.min.js +2 -2
  150. package/dist/components/table.css +3 -37
  151. package/dist/components/table.min.css +2 -2
  152. package/dist/components/text.css +1 -1
  153. package/dist/components/text.min.css +1 -1
  154. package/dist/components/toast.css +1 -3
  155. package/dist/components/toast.js +109 -147
  156. package/dist/components/toast.min.css +1 -1
  157. package/dist/components/toast.min.js +2 -2
  158. package/dist/components/transition.css +1 -1
  159. package/dist/components/transition.js +91 -146
  160. package/dist/components/transition.min.css +1 -1
  161. package/dist/components/transition.min.js +2 -2
  162. package/dist/components/visibility.js +146 -224
  163. package/dist/components/visibility.min.js +2 -2
  164. package/dist/semantic.css +3906 -8720
  165. package/dist/semantic.js +4397 -6155
  166. package/dist/semantic.min.css +2 -2
  167. package/dist/semantic.min.js +2 -2
  168. package/examples/assets/show-examples.js +2 -4
  169. package/gulpfile.js +5 -7
  170. package/package.json +3 -5
  171. package/scripts/nightly-version.js +7 -10
  172. package/src/README.md +3 -3
  173. package/src/definitions/behaviors/api.js +156 -209
  174. package/src/definitions/behaviors/form.js +334 -443
  175. package/src/definitions/behaviors/state.js +69 -99
  176. package/src/definitions/behaviors/visibility.js +145 -223
  177. package/src/definitions/collections/form.less +1 -13
  178. package/src/definitions/collections/grid.less +1 -61
  179. package/src/definitions/collections/menu.less +0 -11
  180. package/src/definitions/collections/table.less +1 -35
  181. package/src/definitions/elements/input.less +1 -61
  182. package/src/definitions/elements/segment.less +0 -6
  183. package/src/definitions/globals/site.js +37 -56
  184. package/src/definitions/globals/site.less +2 -18
  185. package/src/definitions/modules/accordion.js +102 -141
  186. package/src/definitions/modules/calendar.js +313 -351
  187. package/src/definitions/modules/checkbox.js +84 -134
  188. package/src/definitions/modules/dimmer.js +60 -93
  189. package/src/definitions/modules/dimmer.less +0 -9
  190. package/src/definitions/modules/dropdown.js +735 -1054
  191. package/src/definitions/modules/dropdown.less +31 -47
  192. package/src/definitions/modules/embed.js +84 -113
  193. package/src/definitions/modules/flyout.js +225 -354
  194. package/src/definitions/modules/modal.js +260 -383
  195. package/src/definitions/modules/modal.less +1 -1
  196. package/src/definitions/modules/nag.js +67 -97
  197. package/src/definitions/modules/popup.js +197 -270
  198. package/src/definitions/modules/progress.js +108 -143
  199. package/src/definitions/modules/rating.js +90 -122
  200. package/src/definitions/modules/search.js +276 -378
  201. package/src/definitions/modules/search.less +0 -3
  202. package/src/definitions/modules/shape.js +157 -223
  203. package/src/definitions/modules/sidebar.js +123 -205
  204. package/src/definitions/modules/slider.js +245 -328
  205. package/src/definitions/modules/slider.less +1 -1
  206. package/src/definitions/modules/sticky.js +134 -179
  207. package/src/definitions/modules/tab.js +175 -243
  208. package/src/definitions/modules/toast.js +108 -146
  209. package/src/definitions/modules/toast.less +1 -1
  210. package/src/definitions/modules/transition.js +90 -145
  211. package/src/theme.less +0 -13
  212. package/src/themes/basic/elements/icon.variables +1 -1
  213. package/src/themes/default/collections/grid.variables +0 -30
  214. package/src/themes/default/collections/table.variables +1 -5
  215. package/src/themes/default/elements/icon.variables +3 -3
  216. package/src/themes/default/globals/site.variables +8 -15
  217. package/src/themes/default/globals/variation.variables +1 -2
  218. package/src/themes/default/modules/dropdown.variables +1 -0
  219. package/src/themes/default/modules/slider.variables +1 -1
  220. package/src/themes/github/elements/icon.variables +1 -1
  221. package/src/themes/material/elements/icon.variables +1 -1
  222. package/tasks/README.md +1 -1
  223. package/tasks/admin/components/create.js +89 -122
  224. package/tasks/admin/components/init.js +34 -65
  225. package/tasks/admin/components/update.js +50 -61
  226. package/tasks/admin/distributions/create.js +71 -111
  227. package/tasks/admin/distributions/init.js +32 -63
  228. package/tasks/admin/distributions/update.js +49 -57
  229. package/tasks/admin/publish.js +1 -1
  230. package/tasks/admin/register.js +14 -19
  231. package/tasks/admin/release.js +2 -2
  232. package/tasks/build/assets.js +14 -18
  233. package/tasks/build/css.js +59 -68
  234. package/tasks/build/javascript.js +48 -56
  235. package/tasks/build.js +4 -6
  236. package/tasks/check-install.js +5 -8
  237. package/tasks/clean.js +5 -7
  238. package/tasks/collections/admin.js +14 -16
  239. package/tasks/collections/build.js +6 -8
  240. package/tasks/collections/docs.js +4 -6
  241. package/tasks/collections/install.js +2 -4
  242. package/tasks/collections/rtl.js +2 -4
  243. package/tasks/collections/various.js +2 -4
  244. package/tasks/config/admin/github.js +9 -19
  245. package/tasks/config/admin/templates/README.md +2 -2
  246. package/tasks/config/admin/templates/bower.json +2 -4
  247. package/tasks/config/admin/templates/composer.json +1 -1
  248. package/tasks/config/admin/templates/css-package.js +1 -4
  249. package/tasks/config/admin/templates/less-package.js +1 -3
  250. package/tasks/config/defaults.js +0 -1
  251. package/tasks/config/npm/gulpfile.js +4 -6
  252. package/tasks/config/project/config.js +27 -35
  253. package/tasks/config/project/install.js +64 -82
  254. package/tasks/config/project/release.js +7 -9
  255. package/tasks/config/tasks.js +10 -21
  256. package/tasks/config/user.js +14 -20
  257. package/tasks/docs/build.js +26 -31
  258. package/tasks/docs/metadata.js +30 -39
  259. package/tasks/docs/serve.js +23 -27
  260. package/tasks/install.js +94 -128
  261. package/tasks/rtl/build.js +2 -4
  262. package/tasks/rtl/watch.js +3 -5
  263. package/tasks/watch.js +13 -13
  264. package/test/meteor/fonts.js +1 -2
  265. package/test/modules/module.spec.js +16 -18
  266. package/types/fomantic-ui-calendar.d.ts +1 -1
  267. package/types/fomantic-ui-dropdown.d.ts +45 -1
  268. package/types/fomantic-ui-embed.d.ts +1 -1
  269. package/types/fomantic-ui-flyout.d.ts +1 -1
  270. package/types/fomantic-ui-form.d.ts +0 -7
  271. package/types/fomantic-ui-modal.d.ts +1 -1
  272. package/types/fomantic-ui-search.d.ts +12 -6
  273. package/types/fomantic-ui-toast.d.ts +1 -1
  274. package/src/themes/basic/assets/fonts/icons.woff +0 -0
  275. package/src/themes/default/assets/fonts/Lato-Bold.woff +0 -0
  276. package/src/themes/default/assets/fonts/Lato-BoldItalic.woff +0 -0
  277. package/src/themes/default/assets/fonts/Lato-Italic.woff +0 -0
  278. package/src/themes/default/assets/fonts/Lato-Regular.woff +0 -0
  279. package/src/themes/default/assets/fonts/LatoLatin-Bold.woff +0 -0
  280. package/src/themes/default/assets/fonts/LatoLatin-BoldItalic.woff +0 -0
  281. package/src/themes/default/assets/fonts/LatoLatin-Italic.woff +0 -0
  282. package/src/themes/default/assets/fonts/LatoLatin-Regular.woff +0 -0
  283. package/src/themes/default/assets/fonts/brand-icons.woff +0 -0
  284. package/src/themes/default/assets/fonts/icons.woff +0 -0
  285. package/src/themes/default/assets/fonts/outline-icons.woff +0 -0
  286. package/src/themes/github/assets/fonts/octicons.woff +0 -0
  287. package/src/themes/material/assets/fonts/icons.woff +0 -0
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * # Fomantic-UI 2.10.0-beta.1+bee406e - Modal
2
+ * # Fomantic-UI 2.10.0-beta.10+3ca268e - Modal
3
3
  * https://github.com/fomantic/Fomantic-UI/
4
4
  *
5
5
  *
@@ -20,82 +20,78 @@
20
20
  : globalThis;
21
21
 
22
22
  $.fn.modal = function (parameters) {
23
- var
24
- $allModules = $(this),
25
- $window = $(window),
26
- $document = $(document),
27
- $body = $('body'),
28
-
29
- time = Date.now(),
30
- performance = [],
31
-
32
- query = arguments[0],
33
- methodInvoked = typeof query === 'string',
34
- queryArguments = [].slice.call(arguments, 1),
35
- contextCheck = function (context, win) {
36
- var $context;
37
- if ([window, document].indexOf(context) >= 0) {
38
- $context = $body;
39
- } else {
40
- $context = $(win.document).find(context);
41
- if ($context.length === 0) {
42
- $context = win.frameElement ? contextCheck(context, win.parent) : $body;
43
- }
23
+ let $allModules = $(this);
24
+ let $window = $(window);
25
+ let $document = $(document);
26
+ let $body = $('body');
27
+
28
+ let time = Date.now();
29
+ let performance = [];
30
+
31
+ let query = arguments[0];
32
+ let methodInvoked = typeof query === 'string';
33
+ let queryArguments = [].slice.call(arguments, 1);
34
+ let contextCheck = function (context, win) {
35
+ let $context;
36
+ if ([window, document].indexOf(context) >= 0) {
37
+ $context = $body;
38
+ } else {
39
+ $context = $(win.document).find(context);
40
+ if ($context.length === 0) {
41
+ $context = win.frameElement ? contextCheck(context, win.parent) : $body;
44
42
  }
43
+ }
45
44
 
46
- return $context;
47
- },
48
- returnedValue
49
- ;
45
+ return $context;
46
+ };
47
+ let returnedValue;
50
48
 
51
49
  $allModules.each(function () {
52
- var
53
- settings = $.isPlainObject(parameters)
54
- ? $.extend(true, {}, $.fn.modal.settings, parameters)
55
- : $.extend({}, $.fn.modal.settings),
56
-
57
- selector = settings.selector,
58
- className = settings.className,
59
- namespace = settings.namespace,
60
- fields = settings.fields,
61
- error = settings.error,
62
-
63
- eventNamespace = '.' + namespace,
64
- moduleNamespace = 'module-' + namespace,
65
-
66
- $module = $(this),
67
- $context = contextCheck(settings.context, window),
68
- isBody = $context[0] === $body[0],
69
- $closeIcon = $module.find(selector.closeIcon),
70
- $inputs,
71
-
72
- $allModals,
73
- $otherModals,
74
- $focusedElement,
75
- $dimmable,
76
- $dimmer,
77
-
78
- isModalComponent = $module.hasClass('modal'),
79
-
80
- element = this,
81
- instance = isModalComponent ? $module.data(moduleNamespace) : undefined,
82
-
83
- ignoreRepeatedEvents = false,
84
-
85
- initialMouseDownInModal,
86
- initialMouseDownInScrollbar,
87
- initialBodyMargin = '',
88
- tempBodyMargin = '',
89
- keepScrollingClass = false,
90
- hadScrollbar = false,
91
- windowRefocused = false,
92
-
93
- elementEventNamespace,
94
- id,
95
- observer,
96
- observeAttributes = false,
97
- module
98
- ;
50
+ let settings = $.isPlainObject(parameters)
51
+ ? $.extend(true, {}, $.fn.modal.settings, parameters)
52
+ : $.extend({}, $.fn.modal.settings);
53
+
54
+ let selector = settings.selector;
55
+ let className = settings.className;
56
+ let namespace = settings.namespace;
57
+ let fields = settings.fields;
58
+ let error = settings.error;
59
+
60
+ let eventNamespace = '.' + namespace;
61
+ let moduleNamespace = 'module-' + namespace;
62
+
63
+ let $module = $(this);
64
+ let $context = contextCheck(settings.context, window);
65
+ let isBody = $context[0] === $body[0];
66
+ let $closeIcon = $module.find(selector.closeIcon);
67
+ let $inputs;
68
+
69
+ let $allModals;
70
+ let $otherModals;
71
+ let $focusedElement;
72
+ let $dimmable;
73
+ let $dimmer;
74
+
75
+ let isModalComponent = $module.hasClass('modal');
76
+
77
+ let element = this;
78
+ let instance = isModalComponent ? $module.data(moduleNamespace) : undefined;
79
+
80
+ let ignoreRepeatedEvents = false;
81
+
82
+ let initialMouseDownInModal;
83
+ let initialMouseDownInScrollbar;
84
+ let initialBodyMargin = '';
85
+ let tempBodyMargin = '';
86
+ let keepScrollingClass = false;
87
+ let hadScrollbar = false;
88
+ let windowRefocused = false;
89
+
90
+ let elementEventNamespace;
91
+ let id;
92
+ let observer;
93
+ let observeAttributes = false;
94
+ let module;
99
95
  module = {
100
96
 
101
97
  initialize: function () {
@@ -111,36 +107,34 @@
111
107
  }
112
108
  $module.addClass(settings.class);
113
109
  if (settings.title !== '') {
114
- $module.find(selector.title).html(module.helpers.escape(settings.title, settings.preserveHTML)).addClass(settings.classTitle);
110
+ $module.find(selector.title).html(module.helpers.escape(settings.title, settings)).addClass(settings.classTitle);
115
111
  }
116
112
  if (settings.content !== '') {
117
- $module.find(selector.content).html(module.helpers.escape(settings.content, settings.preserveHTML)).addClass(settings.classContent);
113
+ $module.find(selector.content).html(module.helpers.escape(settings.content, settings)).addClass(settings.classContent);
118
114
  }
119
115
  if (module.has.configActions()) {
120
- var $actions = $module.find(selector.actions).addClass(settings.classActions);
116
+ let $actions = $module.find(selector.actions).addClass(settings.classActions);
121
117
  if ($actions.length === 0) {
122
118
  $actions = $('<div/>', { class: className.actions + ' ' + (settings.classActions || '') }).appendTo($module);
123
119
  } else {
124
120
  $actions.empty();
125
121
  }
126
122
  settings.actions.forEach(function (el) {
127
- var
128
- icon = el[fields.icon]
129
- ? '<i ' + (el[fields.text] ? 'aria-hidden="true"' : '') + ' class="' + module.helpers.deQuote(el[fields.icon]) + ' icon"></i>'
130
- : '',
131
- text = module.helpers.escape(el[fields.text] || '', settings.preserveHTML),
132
- cls = module.helpers.deQuote(el[fields.class] || ''),
133
- click = el[fields.click] && isFunction(el[fields.click])
134
- ? el[fields.click]
135
- : function () {}
136
- ;
123
+ let icon = el[fields.icon]
124
+ ? '<i ' + (el[fields.text] ? 'aria-hidden="true"' : '') + ' class="' + module.helpers.escape(el[fields.icon]) + ' icon"></i>'
125
+ : '';
126
+ let text = module.helpers.escape(el[fields.text] || '', settings);
127
+ let cls = module.helpers.escape(el[fields.class] || '');
128
+ let click = el[fields.click] && isFunction(el[fields.click])
129
+ ? el[fields.click]
130
+ : function () {};
137
131
  $actions.append($('<button/>', {
138
132
  html: icon + text,
139
133
  'aria-label': (el[fields.text] || el[fields.icon] || '').replace(/<[^>]+(>|$)/g, ''),
140
134
  class: className.button + ' ' + cls,
141
135
  on: {
142
136
  click: function () {
143
- var button = $(this);
137
+ let button = $(this);
144
138
  if (button.is(selector.approve) || button.is(selector.deny) || click.call(element, $module) === false) {
145
139
  return;
146
140
  }
@@ -174,8 +168,7 @@
174
168
  module.verbose('Storing instance of modal');
175
169
  instance = module;
176
170
  $module
177
- .data(moduleNamespace, instance)
178
- ;
171
+ .data(moduleNamespace, instance);
179
172
  },
180
173
 
181
174
  create: {
@@ -191,12 +184,12 @@
191
184
  $module.append($closeIcon);
192
185
  }
193
186
  if (settings.title !== '') {
194
- var titleId = '_' + module.get.id() + 'title';
187
+ let titleId = '_' + module.get.id() + 'title';
195
188
  $module.attr('aria-labelledby', titleId);
196
189
  $('<div/>', { class: className.title, id: titleId }).appendTo($module);
197
190
  }
198
191
  if (settings.content !== '') {
199
- var descId = '_' + module.get.id() + 'desc';
192
+ let descId = '_' + module.get.id() + 'desc';
200
193
  $module.attr('aria-describedby', descId);
201
194
  $('<div/>', { class: className.content, id: descId }).appendTo($module);
202
195
  }
@@ -207,13 +200,11 @@
207
200
  element = $module[0];
208
201
  },
209
202
  dimmer: function () {
210
- var
211
- defaultSettings = {
212
- debug: settings.debug,
213
- dimmerName: 'modals',
214
- },
215
- dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings)
216
- ;
203
+ let defaultSettings = {
204
+ debug: settings.debug,
205
+ dimmerName: 'modals',
206
+ };
207
+ let dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings);
217
208
  if ($.fn.dimmer === undefined) {
218
209
  module.error(error.dimmer);
219
210
 
@@ -249,8 +240,7 @@
249
240
  module.verbose('Destroying previous modal');
250
241
  $module
251
242
  .removeData(moduleNamespace)
252
- .off(eventNamespace)
253
- ;
243
+ .off(eventNamespace);
254
244
  $window.off(elementEventNamespace);
255
245
  $context.off(elementEventNamespace);
256
246
  $dimmer.off(elementEventNamespace);
@@ -262,59 +252,56 @@
262
252
  },
263
253
 
264
254
  observeChanges: function () {
265
- if ('MutationObserver' in window) {
266
- observer = new MutationObserver(function (mutations) {
267
- var collectNodes = function (parent) {
268
- var nodes = [];
269
- for (var c = 0, cl = parent.length; c < cl; c++) {
270
- Array.prototype.push.apply(nodes, collectNodes(parent[c].childNodes));
271
- nodes.push(parent[c]);
272
- }
255
+ observer = new MutationObserver(function (mutations) {
256
+ let collectNodes = function (parent) {
257
+ let nodes = [];
258
+ for (let c = 0, cl = parent.length; c < cl; c++) {
259
+ Array.prototype.push.apply(nodes, collectNodes(parent[c].childNodes));
260
+ nodes.push(parent[c]);
261
+ }
273
262
 
274
- return nodes;
275
- },
276
- shouldRefresh = false,
277
- shouldRefreshInputs = false,
278
- ignoreAutofocus = true
279
- ;
280
- mutations.every(function (mutation) {
281
- if (mutation.type === 'attributes') {
282
- if (observeAttributes && (mutation.attributeName === 'disabled' || $(mutation.target).find(':input').addBack(':input').filter(':visible').length > 0)) {
283
- shouldRefreshInputs = true;
284
- }
285
- } else {
286
- shouldRefresh = true;
287
- // mutationobserver only provides the parent nodes
288
- // so let's collect all childs as well to find nested inputs
289
- var $addedInputs = $(collectNodes(mutation.addedNodes)).filter('a[href], [tabindex], :input:enabled').filter(':visible'),
290
- $removedInputs = $(collectNodes(mutation.removedNodes)).filter('a[href], [tabindex], :input');
291
- if ($addedInputs.length > 0 || $removedInputs.length > 0) {
292
- shouldRefreshInputs = true;
293
- if ($addedInputs.filter(':input').length > 0 || $removedInputs.filter(':input').length > 0) {
294
- ignoreAutofocus = false;
295
- }
263
+ return nodes;
264
+ };
265
+ let shouldRefresh = false;
266
+ let shouldRefreshInputs = false;
267
+ let ignoreAutofocus = true;
268
+ mutations.every(function (mutation) {
269
+ if (mutation.type === 'attributes') {
270
+ if (observeAttributes && (mutation.attributeName === 'disabled' || $(mutation.target).find(':input').addBack(':input').filter(':visible').length > 0)) {
271
+ shouldRefreshInputs = true;
272
+ }
273
+ } else {
274
+ shouldRefresh = true;
275
+ // mutationobserver only provides the parent nodes,
276
+ // so let's collect all childs as well to find nested inputs
277
+ let $addedInputs = $(collectNodes(mutation.addedNodes)).filter('a[href], [tabindex], :input:enabled').filter(':visible');
278
+ let $removedInputs = $(collectNodes(mutation.removedNodes)).filter('a[href], [tabindex], :input');
279
+ if ($addedInputs.length > 0 || $removedInputs.length > 0) {
280
+ shouldRefreshInputs = true;
281
+ if ($addedInputs.filter(':input').length > 0 || $removedInputs.filter(':input').length > 0) {
282
+ ignoreAutofocus = false;
296
283
  }
297
284
  }
298
-
299
- return !shouldRefreshInputs;
300
- });
301
-
302
- if (shouldRefresh && settings.observeChanges) {
303
- module.debug('DOM tree modified, refreshing');
304
- module.refresh();
305
- }
306
- if (shouldRefreshInputs) {
307
- module.refreshInputs(ignoreAutofocus);
308
285
  }
286
+
287
+ return !shouldRefreshInputs;
309
288
  });
310
- observer.observe(element, {
311
- attributeFilter: ['class', 'disabled'],
312
- attributes: true,
313
- childList: true,
314
- subtree: true,
315
- });
316
- module.debug('Setting up mutation observer', observer);
317
- }
289
+
290
+ if (shouldRefresh && settings.observeChanges) {
291
+ module.debug('DOM tree modified, refreshing');
292
+ module.refresh();
293
+ }
294
+ if (shouldRefreshInputs) {
295
+ module.refreshInputs(ignoreAutofocus);
296
+ }
297
+ });
298
+ observer.observe(element, {
299
+ attributeFilter: ['class', 'disabled'],
300
+ attributes: true,
301
+ childList: true,
302
+ subtree: true,
303
+ });
304
+ module.debug('Setting up mutation observer', observer);
318
305
  },
319
306
 
320
307
  refresh: function () {
@@ -335,8 +322,7 @@
335
322
  refreshInputs: function (ignoreAutofocus) {
336
323
  if ($inputs) {
337
324
  $inputs
338
- .off('keydown' + elementEventNamespace)
339
- ;
325
+ .off('keydown' + elementEventNamespace);
340
326
  }
341
327
  $inputs = $module.find('a[href], [tabindex], :input:enabled').filter(':visible').filter(function () {
342
328
  return $(this).closest('.disabled').length === 0;
@@ -348,20 +334,16 @@
348
334
  $module.removeAttr('tabindex');
349
335
  }
350
336
  $inputs.first()
351
- .on('keydown' + elementEventNamespace, module.event.inputKeyDown.first)
352
- ;
337
+ .on('keydown' + elementEventNamespace, module.event.inputKeyDown.first);
353
338
  $inputs.last()
354
- .on('keydown' + elementEventNamespace, module.event.inputKeyDown.last)
355
- ;
339
+ .on('keydown' + elementEventNamespace, module.event.inputKeyDown.last);
356
340
  if (!ignoreAutofocus && settings.autofocus && $inputs.filter(':focus').length === 0) {
357
341
  module.set.autofocus();
358
342
  }
359
343
  },
360
344
 
361
345
  attachEvents: function (selector, event) {
362
- var
363
- $toggle = $(selector)
364
- ;
346
+ let $toggle = $(selector);
365
347
  event = isFunction(module[event])
366
348
  ? module[event]
367
349
  : module.toggle;
@@ -369,8 +351,7 @@
369
351
  module.debug('Attaching modal events to element', selector, event);
370
352
  $toggle
371
353
  .off(eventNamespace)
372
- .on('click' + eventNamespace, event)
373
- ;
354
+ .on('click' + eventNamespace, event);
374
355
  } else {
375
356
  module.error(error.notFound, selector);
376
357
  }
@@ -382,18 +363,14 @@
382
363
  $module
383
364
  .on('click' + eventNamespace, selector.close, module.event.close)
384
365
  .on('click' + eventNamespace, selector.approve, module.event.approve)
385
- .on('click' + eventNamespace, selector.deny, module.event.deny)
386
- ;
366
+ .on('click' + eventNamespace, selector.deny, module.event.deny);
387
367
  $closeIcon
388
- .on('keyup' + elementEventNamespace, module.event.closeKeyUp)
389
- ;
368
+ .on('keyup' + elementEventNamespace, module.event.closeKeyUp);
390
369
  $window
391
370
  .on('resize' + elementEventNamespace, module.event.resize)
392
- .on('focus' + elementEventNamespace, module.event.focus)
393
- ;
371
+ .on('focus' + elementEventNamespace, module.event.focus);
394
372
  $context
395
- .on('click' + elementEventNamespace, module.event.click)
396
- ;
373
+ .on('click' + elementEventNamespace, module.event.click);
397
374
  },
398
375
  scrollLock: function () {
399
376
  // touch events default to passive, due to changes in chrome to optimize mobile perf
@@ -451,27 +428,21 @@
451
428
  module.hide();
452
429
  },
453
430
  closeKeyUp: function (event) {
454
- var
455
- keyCode = event.which
456
- ;
431
+ let keyCode = event.which;
457
432
  if ((keyCode === settings.keys.enter || keyCode === settings.keys.space) && $module.hasClass(className.front)) {
458
433
  module.hide();
459
434
  }
460
435
  },
461
436
  inputKeyDown: {
462
437
  first: function (event) {
463
- var
464
- keyCode = event.which
465
- ;
438
+ let keyCode = event.which;
466
439
  if (keyCode === settings.keys.tab && event.shiftKey) {
467
440
  $inputs.last().trigger('focus');
468
441
  event.preventDefault();
469
442
  }
470
443
  },
471
444
  last: function (event) {
472
- var
473
- keyCode = event.which
474
- ;
445
+ let keyCode = event.which;
475
446
  if (keyCode === settings.keys.tab && !event.shiftKey) {
476
447
  $inputs.first().trigger('focus');
477
448
  event.preventDefault();
@@ -479,10 +450,8 @@
479
450
  },
480
451
  },
481
452
  mousedown: function (event) {
482
- var
483
- $target = $(event.target),
484
- isRtl = module.is.rtl()
485
- ;
453
+ let $target = $(event.target);
454
+ let isRtl = module.is.rtl();
486
455
  initialMouseDownInModal = $target.closest(selector.modal).length > 0;
487
456
  if (initialMouseDownInModal) {
488
457
  module.verbose('Mouse down event registered inside the modal');
@@ -508,11 +477,9 @@
508
477
 
509
478
  return;
510
479
  }
511
- var
512
- $target = $(event.target),
513
- isInModal = $target.closest(selector.modal).length > 0,
514
- isInDOM = $.contains(document.documentElement, event.target)
515
- ;
480
+ let $target = $(event.target);
481
+ let isInModal = $target.closest(selector.modal).length > 0;
482
+ let isInDOM = $.contains(document.documentElement, event.target);
516
483
  if (!isInModal && isInDOM && module.is.active() && $module.hasClass(className.front)) {
517
484
  module.debug('Dimmer clicked, hiding all modals');
518
485
  if (settings.allowMultiple) {
@@ -532,9 +499,7 @@
532
499
  }, delay);
533
500
  },
534
501
  keyboard: function (event) {
535
- var
536
- keyCode = event.which
537
- ;
502
+ let keyCode = event.which;
538
503
  if (keyCode === settings.keys.escape) {
539
504
  if (settings.closable) {
540
505
  module.debug('Escape key pressed hiding modal');
@@ -654,8 +619,7 @@
654
619
  requestAnimationFrame(module.set.observeAttributes);
655
620
  callback();
656
621
  },
657
- })
658
- ;
622
+ });
659
623
  } else {
660
624
  module.error(error.noTransition);
661
625
  }
@@ -666,9 +630,7 @@
666
630
  },
667
631
 
668
632
  hideModal: function (callback, keepDimmed, hideOthersToo) {
669
- var
670
- $previousModal = $otherModals.filter('.' + className.active).last()
671
- ;
633
+ let $previousModal = $otherModals.filter('.' + className.active).last();
672
634
  callback = isFunction(callback)
673
635
  ? callback
674
636
  : function () {};
@@ -719,8 +681,7 @@
719
681
  module.restore.focus();
720
682
  callback();
721
683
  },
722
- })
723
- ;
684
+ });
724
685
  } else {
725
686
  module.error(error.noTransition);
726
687
  }
@@ -758,15 +719,13 @@
758
719
  },
759
720
 
760
721
  hideAll: function (callback) {
761
- var
762
- $visibleModals = $allModals.filter('.' + className.active + ', .' + className.animating)
763
- ;
722
+ let $visibleModals = $allModals.filter('.' + className.active + ', .' + className.animating);
764
723
  callback = isFunction(callback)
765
724
  ? callback
766
725
  : function () {};
767
726
  if ($visibleModals.length > 0) {
768
727
  module.debug('Hiding all visible modals');
769
- var hideOk = true;
728
+ let hideOk = true;
770
729
  // check in reverse order trying to hide most top displayed modal first
771
730
  $($visibleModals.get().reverse()).each(function (index, element) {
772
731
  if (hideOk) {
@@ -782,17 +741,14 @@
782
741
  },
783
742
 
784
743
  hideOthers: function (callback) {
785
- var
786
- $visibleModals = $otherModals.filter('.' + className.active + ', .' + className.animating)
787
- ;
744
+ let $visibleModals = $otherModals.filter('.' + className.active + ', .' + className.animating);
788
745
  callback = isFunction(callback)
789
746
  ? callback
790
747
  : function () {};
791
748
  if ($visibleModals.length > 0) {
792
749
  module.debug('Hiding other modals', $otherModals);
793
750
  $visibleModals
794
- .modal('hide modal', callback, true)
795
- ;
751
+ .modal('hide modal', callback, true);
796
752
  }
797
753
  },
798
754
 
@@ -809,27 +765,22 @@
809
765
  keyboardShortcuts: function () {
810
766
  module.verbose('Adding keyboard shortcuts');
811
767
  $document
812
- .on('keydown' + eventNamespace, module.event.keyboard)
813
- ;
768
+ .on('keydown' + eventNamespace, module.event.keyboard);
814
769
  },
815
770
  },
816
771
 
817
772
  save: {
818
773
  focus: function () {
819
- var
820
- $activeElement = $(document.activeElement),
821
- inCurrentModal = $activeElement.closest($module).length > 0
822
- ;
774
+ let $activeElement = $(document.activeElement);
775
+ let inCurrentModal = $activeElement.closest($module).length > 0;
823
776
  if (!inCurrentModal) {
824
777
  $focusedElement = $(document.activeElement).trigger('blur');
825
778
  }
826
779
  },
827
780
  bodyMargin: function () {
828
781
  initialBodyMargin = $context.css((isBody ? 'margin-' : 'padding-') + (module.can.leftBodyScrollbar() ? 'left' : 'right'));
829
- var
830
- bodyMarginRightPixel = parseInt(initialBodyMargin.replace(/[^\d.]/g, ''), 10),
831
- bodyScrollbarWidth = isBody ? window.innerWidth - document.documentElement.clientWidth : $context[0].offsetWidth - $context[0].clientWidth
832
- ;
782
+ let bodyMarginRightPixel = parseInt(initialBodyMargin.replace(/[^\d.]/g, ''), 10);
783
+ let bodyScrollbarWidth = isBody ? window.innerWidth - document.documentElement.clientWidth : $context[0].offsetWidth - $context[0].clientWidth;
833
784
  tempBodyMargin = bodyMarginRightPixel + bodyScrollbarWidth;
834
785
  },
835
786
  },
@@ -841,13 +792,11 @@
841
792
  }
842
793
  },
843
794
  bodyMargin: function () {
844
- var position = module.can.leftBodyScrollbar() ? 'left' : 'right';
795
+ let position = module.can.leftBodyScrollbar() ? 'left' : 'right';
845
796
  $context.css((isBody ? 'margin-' : 'padding-') + position, initialBodyMargin);
846
797
  $context.find(selector.bodyFixed.replace('right', position)).each(function () {
847
- var
848
- el = $(this),
849
- attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
850
- ;
798
+ let el = $(this);
799
+ let attribute = el.css('position') === 'fixed' ? 'padding-' + position : position;
851
800
  el.css(attribute, '');
852
801
  });
853
802
  },
@@ -863,15 +812,12 @@
863
812
  clickaway: function () {
864
813
  if (!settings.detachable) {
865
814
  $module
866
- .off('mousedown' + elementEventNamespace)
867
- ;
815
+ .off('mousedown' + elementEventNamespace);
868
816
  }
869
817
  $dimmer
870
- .off('mousedown' + elementEventNamespace)
871
- ;
818
+ .off('mousedown' + elementEventNamespace);
872
819
  $dimmer
873
- .off('mouseup' + elementEventNamespace)
874
- ;
820
+ .off('mouseup' + elementEventNamespace);
875
821
  },
876
822
  dimmerStyles: function () {
877
823
  $dimmer.removeClass(className.inverted);
@@ -886,15 +832,13 @@
886
832
  screenHeight: function () {
887
833
  module.debug('Removing page height');
888
834
  $context
889
- .css('height', '')
890
- ;
835
+ .css('height', '');
891
836
  module.remove.bodyStyle();
892
837
  },
893
838
  keyboardShortcuts: function () {
894
839
  module.verbose('Removing keyboard shortcuts');
895
840
  $document
896
- .off('keydown' + eventNamespace)
897
- ;
841
+ .off('keydown' + eventNamespace);
898
842
  },
899
843
  scrolling: function () {
900
844
  if (!keepScrollingClass) {
@@ -906,11 +850,9 @@
906
850
 
907
851
  cacheSizes: function () {
908
852
  $module.addClass(className.loading);
909
- var
910
- scrollHeight = $module.prop('scrollHeight'),
911
- modalWidth = $module.outerWidth(),
912
- modalHeight = $module.outerHeight()
913
- ;
853
+ let scrollHeight = $module.prop('scrollHeight');
854
+ let modalWidth = $module.outerWidth();
855
+ let modalHeight = $module.outerHeight();
914
856
  if (module.cache.pageHeight === undefined || modalHeight !== 0) {
915
857
  $.extend(module.cache, {
916
858
  pageHeight: $document.outerHeight(),
@@ -927,66 +869,49 @@
927
869
  module.debug('Caching modal and container sizes', module.cache);
928
870
  },
929
871
  helpers: {
930
- deQuote: function (string) {
931
- return String(string).replace(/"/g, '');
932
- },
933
- escape: function (string, preserveHTML) {
934
- if (preserveHTML) {
872
+ escape: function (string, settings) {
873
+ if (settings !== undefined && settings.preserveHTML) {
935
874
  return string;
936
875
  }
937
- var
938
- badChars = /["'<>`]/g,
939
- shouldEscape = /["&'<>`]/,
940
- escape = {
941
- '<': '&lt;',
942
- '>': '&gt;',
943
- '"': '&quot;',
944
- "'": '&#x27;',
945
- '`': '&#x60;',
946
- },
947
- escapedChar = function (chr) {
948
- return escape[chr];
949
- }
950
- ;
951
- if (shouldEscape.test(string)) {
952
- string = string.replace(/&(?![\d#a-z]{1,12};)/gi, '&amp;');
953
876
 
954
- return string.replace(badChars, escapedChar);
955
- }
877
+ const badChars = /["'<>]|&(?![\d#A-Za-z]{1,12};)/g;
878
+ const escape = {
879
+ '"': '&quot;',
880
+ '&': '&amp;',
881
+ "'": '&apos;',
882
+ '<': '&lt;',
883
+ '>': '&gt;',
884
+ };
956
885
 
957
- return string;
886
+ return String(string).replace(badChars, (chr) => escape[chr]);
958
887
  },
959
888
  },
960
889
  can: {
961
890
  leftBodyScrollbar: function () {
962
891
  if (module.cache.leftBodyScrollbar === undefined) {
963
- module.cache.leftBodyScrollbar = module.is.rtl() && ((module.is.iframe && !module.is.firefox()) || module.is.safari() || module.is.edge() || module.is.ie());
892
+ module.cache.leftBodyScrollbar = module.is.rtl() && ((module.is.iframe && !module.is.firefox()) || module.is.safari());
964
893
  }
965
894
 
966
895
  return module.cache.leftBodyScrollbar;
967
896
  },
968
897
  useFlex: function () {
969
898
  if (settings.useFlex === 'auto') {
970
- return settings.detachable && !module.is.ie();
899
+ return settings.detachable;
971
900
  }
972
- if (settings.useFlex && module.is.ie()) {
973
- module.debug('useFlex true is not supported in IE');
974
- } else if (settings.useFlex && !settings.detachable) {
901
+ if (settings.useFlex && !settings.detachable) {
975
902
  module.debug('useFlex true in combination with detachable false is not supported');
976
903
  }
977
904
 
978
905
  return settings.useFlex;
979
906
  },
980
907
  fit: function () {
981
- var
982
- contextHeight = module.cache.contextHeight,
983
- verticalCenter = module.cache.contextHeight / 2,
984
- topOffset = module.cache.topOffset,
985
- scrollHeight = module.cache.scrollHeight,
986
- height = module.cache.height,
987
- paddingHeight = settings.padding,
988
- startPosition = verticalCenter + topOffset
989
- ;
908
+ let contextHeight = module.cache.contextHeight;
909
+ let verticalCenter = module.cache.contextHeight / 2;
910
+ let topOffset = module.cache.topOffset;
911
+ let scrollHeight = module.cache.scrollHeight;
912
+ let height = module.cache.height;
913
+ let paddingHeight = settings.padding;
914
+ let startPosition = verticalCenter + topOffset;
990
915
 
991
916
  return scrollHeight > height
992
917
  ? startPosition + scrollHeight + paddingHeight < contextHeight
@@ -1005,27 +930,12 @@
1005
930
  active: function () {
1006
931
  return $module.hasClass(className.active);
1007
932
  },
1008
- ie: function () {
1009
- if (module.cache.isIE === undefined) {
1010
- var
1011
- isIE11 = !window.ActiveXObject && 'ActiveXObject' in window,
1012
- isIE = 'ActiveXObject' in window
1013
- ;
1014
- module.cache.isIE = isIE11 || isIE;
1015
- }
1016
-
1017
- return module.cache.isIE;
1018
- },
1019
933
  animating: function () {
1020
934
  return $module.transition('is animating');
1021
935
  },
1022
936
  scrolling: function () {
1023
937
  return $dimmable.hasClass(className.scrolling);
1024
938
  },
1025
- modernBrowser: function () {
1026
- // appName for IE11 reports 'Netscape' can no longer use
1027
- return !(window.ActiveXObject || 'ActiveXObject' in window);
1028
- },
1029
939
  rtl: function () {
1030
940
  if (module.cache.isRTL === undefined) {
1031
941
  module.cache.isRTL = $module.attr('dir') === 'rtl' || $module.css('direction') === 'rtl' || $body.attr('dir') === 'rtl' || $body.css('direction') === 'rtl' || $context.attr('dir') === 'rtl' || $context.css('direction') === 'rtl';
@@ -1040,13 +950,6 @@
1040
950
 
1041
951
  return module.cache.isSafari;
1042
952
  },
1043
- edge: function () {
1044
- if (module.cache.isEdge === undefined) {
1045
- module.cache.isEdge = !!window.setImmediate && !module.is.ie();
1046
- }
1047
-
1048
- return module.cache.isEdge;
1049
- },
1050
953
  firefox: function () {
1051
954
  if (module.cache.isFirefox === undefined) {
1052
955
  module.cache.isFirefox = !!window.InstallTrigger;
@@ -1064,43 +967,36 @@
1064
967
  observeAttributes = state !== false;
1065
968
  },
1066
969
  autofocus: function () {
1067
- var
1068
- $autofocus = $inputs.filter('[autofocus]'),
1069
- $rawInputs = $inputs.filter(':input'),
1070
- $input = ($autofocus.length > 0
1071
- ? $autofocus
1072
- : ($rawInputs.length > 0
1073
- ? $rawInputs
1074
- : $module)
1075
- ).first()
1076
- ;
970
+ let $autofocus = $inputs.filter('[autofocus]');
971
+ let $rawInputs = $inputs.filter(':input');
972
+ let $input = ($autofocus.length > 0
973
+ ? $autofocus
974
+ : ($rawInputs.length > 0
975
+ ? $rawInputs
976
+ : $module)
977
+ ).first();
1077
978
  $input.trigger('focus');
1078
979
  },
1079
980
  bodyMargin: function () {
1080
- var position = module.can.leftBodyScrollbar() ? 'left' : 'right';
981
+ let position = module.can.leftBodyScrollbar() ? 'left' : 'right';
1081
982
  if (settings.detachable || module.can.fit()) {
1082
983
  $context.css((isBody ? 'margin-' : 'padding-') + position, tempBodyMargin + 'px');
1083
984
  }
1084
985
  $context.find(selector.bodyFixed.replace('right', position)).each(function () {
1085
- var
1086
- el = $(this),
1087
- attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
1088
- ;
986
+ let el = $(this);
987
+ let attribute = el.css('position') === 'fixed' ? 'padding-' + position : position;
1089
988
  el.css(attribute, 'calc(' + el.css(attribute) + ' + ' + tempBodyMargin + 'px)');
1090
989
  });
1091
990
  },
1092
991
  clickaway: function () {
1093
992
  if (!settings.detachable) {
1094
993
  $module
1095
- .on('mousedown' + elementEventNamespace, module.event.mousedown)
1096
- ;
994
+ .on('mousedown' + elementEventNamespace, module.event.mousedown);
1097
995
  }
1098
996
  $dimmer
1099
- .on('mousedown' + elementEventNamespace, module.event.mousedown)
1100
- ;
997
+ .on('mousedown' + elementEventNamespace, module.event.mousedown);
1101
998
  $dimmer
1102
- .on('mouseup' + elementEventNamespace, module.event.mouseup)
1103
- ;
999
+ .on('mouseup' + elementEventNamespace, module.event.mouseup);
1104
1000
  },
1105
1001
  dimmerSettings: function () {
1106
1002
  if ($.fn.dimmer === undefined) {
@@ -1108,19 +1004,17 @@
1108
1004
 
1109
1005
  return;
1110
1006
  }
1111
- var
1112
- defaultSettings = {
1113
- debug: settings.debug,
1114
- dimmerName: 'modals',
1115
- closable: 'auto',
1116
- useFlex: module.can.useFlex(),
1117
- duration: {
1118
- show: settings.transition.showDuration || settings.duration,
1119
- hide: settings.transition.hideDuration || settings.duration,
1120
- },
1007
+ let defaultSettings = {
1008
+ debug: settings.debug,
1009
+ dimmerName: 'modals',
1010
+ closable: 'auto',
1011
+ useFlex: module.can.useFlex(),
1012
+ duration: {
1013
+ show: settings.transition.showDuration || settings.duration,
1014
+ hide: settings.transition.hideDuration || settings.duration,
1121
1015
  },
1122
- dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings)
1123
- ;
1016
+ };
1017
+ let dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings);
1124
1018
  if (settings.inverted) {
1125
1019
  dimmerSettings.variation = dimmerSettings.variation !== undefined
1126
1020
  ? dimmerSettings.variation + ' inverted'
@@ -1142,7 +1036,7 @@
1142
1036
  },
1143
1037
  modalOffset: function () {
1144
1038
  if (!settings.detachable) {
1145
- var canFit = module.can.fit();
1039
+ let canFit = module.can.fit();
1146
1040
  $module
1147
1041
  .css({
1148
1042
  top: !$module.hasClass('aligned') && canFit
@@ -1151,8 +1045,7 @@
1151
1045
  ? $document.scrollTop() + settings.padding
1152
1046
  : $document.scrollTop() + (module.cache.contextHeight - module.cache.height - settings.padding)),
1153
1047
  marginLeft: -(module.cache.width / 2),
1154
- })
1155
- ;
1048
+ });
1156
1049
  } else {
1157
1050
  $module
1158
1051
  .css({
@@ -1160,8 +1053,7 @@
1160
1053
  ? -(module.cache.height / 2)
1161
1054
  : settings.padding / 2,
1162
1055
  marginLeft: -(module.cache.width / 2),
1163
- })
1164
- ;
1056
+ });
1165
1057
  }
1166
1058
  module.verbose('Setting modal offset for legacy mode');
1167
1059
  },
@@ -1171,8 +1063,7 @@
1171
1063
  } else if (!$module.hasClass('bottom')) {
1172
1064
  module.debug('Modal is taller than page content, resizing page height');
1173
1065
  $context
1174
- .css('height', module.cache.height + (settings.padding * 2) + 'px')
1175
- ;
1066
+ .css('height', module.cache.height + (settings.padding * 2) + 'px');
1176
1067
  }
1177
1068
  },
1178
1069
  active: function () {
@@ -1257,11 +1148,9 @@
1257
1148
  },
1258
1149
  performance: {
1259
1150
  log: function (message) {
1260
- var
1261
- currentTime,
1262
- executionTime,
1263
- previousTime
1264
- ;
1151
+ let currentTime;
1152
+ let executionTime;
1153
+ let previousTime;
1265
1154
  if (settings.performance) {
1266
1155
  currentTime = Date.now();
1267
1156
  previousTime = time || currentTime;
@@ -1280,10 +1169,8 @@
1280
1169
  }, 500);
1281
1170
  },
1282
1171
  display: function () {
1283
- var
1284
- title = settings.name + ':',
1285
- totalTime = 0
1286
- ;
1172
+ let title = settings.name + ':';
1173
+ let totalTime = 0;
1287
1174
  time = false;
1288
1175
  clearTimeout(module.performance.timer);
1289
1176
  $.each(performance, function (index, data) {
@@ -1305,19 +1192,17 @@
1305
1192
  },
1306
1193
  },
1307
1194
  invoke: function (query, passedArguments, context) {
1308
- var
1309
- object = instance,
1310
- maxDepth,
1311
- found,
1312
- response
1313
- ;
1195
+ let object = instance;
1196
+ let maxDepth;
1197
+ let found;
1198
+ let response;
1314
1199
  passedArguments = passedArguments || queryArguments;
1315
1200
  context = context || element;
1316
1201
  if (typeof query === 'string' && object !== undefined) {
1317
1202
  query = query.split(/[ .]/);
1318
1203
  maxDepth = query.length - 1;
1319
1204
  $.each(query, function (depth, value) {
1320
- var camelCaseValue = depth !== maxDepth
1205
+ let camelCaseValue = depth !== maxDepth
1321
1206
  ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
1322
1207
  : query;
1323
1208
  if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
@@ -1443,7 +1328,7 @@
1443
1328
  classActions: '',
1444
1329
  closeIcon: false,
1445
1330
  actions: false,
1446
- preserveHTML: true,
1331
+ preserveHTML: false,
1447
1332
 
1448
1333
  fields: {
1449
1334
  class: 'class',
@@ -1532,7 +1417,7 @@
1532
1417
 
1533
1418
  $.fn.modal.settings.templates = {
1534
1419
  getArguments: function (args) {
1535
- var queryArguments = [].slice.call(args);
1420
+ let queryArguments = [].slice.call(args);
1536
1421
  if ($.isPlainObject(queryArguments[0])) {
1537
1422
  return $.extend({
1538
1423
  handler: function () {},
@@ -1551,11 +1436,9 @@
1551
1436
  };
1552
1437
  },
1553
1438
  alert: function () {
1554
- var
1555
- settings = this.get.settings(),
1556
- args = settings.templates.getArguments(arguments),
1557
- approveFn = args.handler
1558
- ;
1439
+ let settings = this.get.settings();
1440
+ let args = settings.templates.getArguments(arguments);
1441
+ let approveFn = args.handler;
1559
1442
 
1560
1443
  return {
1561
1444
  title: args.title,
@@ -1569,16 +1452,14 @@
1569
1452
  };
1570
1453
  },
1571
1454
  confirm: function () {
1572
- var
1573
- settings = this.get.settings(),
1574
- args = settings.templates.getArguments(arguments),
1575
- approveFn = function () {
1576
- args.handler(true);
1577
- },
1578
- denyFn = function () {
1579
- args.handler(false);
1580
- }
1581
- ;
1455
+ let settings = this.get.settings();
1456
+ let args = settings.templates.getArguments(arguments);
1457
+ let approveFn = function () {
1458
+ args.handler(true);
1459
+ };
1460
+ let denyFn = function () {
1461
+ args.handler(false);
1462
+ };
1582
1463
 
1583
1464
  return {
1584
1465
  title: args.title,
@@ -1597,24 +1478,20 @@
1597
1478
  };
1598
1479
  },
1599
1480
  prompt: function () {
1600
- var
1601
- $this = this,
1602
- settings = this.get.settings(),
1603
- args = settings.templates.getArguments(arguments),
1604
- input = $($.parseHTML(args.content)).filter('.ui.input'),
1605
- approveFn = function () {
1606
- var
1607
- settings = $this.get.settings(),
1608
- inputField = $this.get.element().find(settings.selector.prompt)[0]
1609
- ;
1610
- args.handler($(inputField).val());
1611
- },
1612
- denyFn = function () {
1613
- args.handler(null);
1614
- }
1615
- ;
1481
+ let $this = this;
1482
+ let settings = this.get.settings();
1483
+ let args = settings.templates.getArguments(arguments);
1484
+ let input = $($.parseHTML(args.content)).filter('.ui.input');
1485
+ let approveFn = function () {
1486
+ let settings = $this.get.settings();
1487
+ let inputField = $this.get.element().find(settings.selector.prompt)[0];
1488
+ args.handler($(inputField).val());
1489
+ };
1490
+ let denyFn = function () {
1491
+ args.handler(null);
1492
+ };
1616
1493
  if (input.length === 0) {
1617
- args.content += '<p><div class="' + this.helpers.deQuote(settings.className.prompt) + '"><input placeholder="' + this.helpers.deQuote(args.placeholder || '') + '" type="text" value="' + this.helpers.deQuote(args.defaultValue || '') + '"></div></p>';
1494
+ args.content += '<p><div class="' + this.helpers.escape(settings.className.prompt) + '"><input placeholder="' + this.helpers.escape(args.placeholder || '') + '" type="text" value="' + this.helpers.escape(args.defaultValue || '') + '"></div></p>';
1618
1495
  }
1619
1496
 
1620
1497
  return {