fomantic-ui 2.9.1-beta.22 → 2.9.1-beta.24

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 (256) hide show
  1. package/.eslint/index.js +23 -0
  2. package/.eslint/no-extra-parens-rule.js +17 -0
  3. package/.eslint/package.json +11 -0
  4. package/.eslintrc.js +13 -70
  5. package/.stylelintrc.js +5 -7
  6. package/dist/components/accordion.css +1 -1
  7. package/dist/components/accordion.js +26 -26
  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 +95 -94
  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 +181 -151
  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 +14 -14
  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 +23 -25
  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 +252 -254
  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 +27 -33
  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 +50 -44
  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 +187 -163
  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 +49 -45
  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 +22 -20
  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 +71 -71
  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 +46 -46
  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 +15 -15
  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 +69 -74
  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 +39 -39
  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 +39 -37
  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 +22 -21
  122. package/dist/components/site.min.css +1 -1
  123. package/dist/components/site.min.js +2 -2
  124. package/dist/components/slider.js +69 -64
  125. package/dist/components/slider.min.js +2 -2
  126. package/dist/components/state.js +15 -15
  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 +25 -25
  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 +55 -57
  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 +57 -30
  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 +45 -39
  150. package/dist/components/transition.min.css +1 -1
  151. package/dist/components/transition.min.js +2 -2
  152. package/dist/components/visibility.js +25 -25
  153. package/dist/components/visibility.min.js +2 -2
  154. package/dist/semantic.css +60 -60
  155. package/dist/semantic.js +1518 -1427
  156. package/dist/semantic.min.css +2 -2
  157. package/dist/semantic.min.js +2 -2
  158. package/examples/responsive.html +1 -1
  159. package/gulpfile.js +1 -1
  160. package/package.json +2 -1
  161. package/scripts/nightly-version.js +6 -4
  162. package/src/definitions/behaviors/api.js +94 -93
  163. package/src/definitions/behaviors/form.js +186 -162
  164. package/src/definitions/behaviors/state.js +14 -14
  165. package/src/definitions/behaviors/visibility.js +24 -24
  166. package/src/definitions/collections/menu.less +2 -2
  167. package/src/definitions/elements/button.less +2 -2
  168. package/src/definitions/elements/loader.less +4 -4
  169. package/src/definitions/elements/step.less +1 -1
  170. package/src/definitions/globals/site.js +21 -20
  171. package/src/definitions/modules/accordion.js +25 -25
  172. package/src/definitions/modules/calendar.js +180 -150
  173. package/src/definitions/modules/calendar.less +2 -2
  174. package/src/definitions/modules/checkbox.js +13 -13
  175. package/src/definitions/modules/dimmer.js +22 -24
  176. package/src/definitions/modules/dimmer.less +10 -10
  177. package/src/definitions/modules/dropdown.js +251 -253
  178. package/src/definitions/modules/embed.js +26 -32
  179. package/src/definitions/modules/flyout.js +49 -43
  180. package/src/definitions/modules/flyout.less +1 -1
  181. package/src/definitions/modules/modal.js +48 -44
  182. package/src/definitions/modules/nag.js +21 -19
  183. package/src/definitions/modules/popup.js +70 -70
  184. package/src/definitions/modules/progress.js +45 -45
  185. package/src/definitions/modules/rating.js +14 -14
  186. package/src/definitions/modules/search.js +68 -73
  187. package/src/definitions/modules/shape.js +38 -38
  188. package/src/definitions/modules/sidebar.js +38 -36
  189. package/src/definitions/modules/slider.js +68 -63
  190. package/src/definitions/modules/sticky.js +24 -24
  191. package/src/definitions/modules/tab.js +54 -56
  192. package/src/definitions/modules/toast.js +56 -29
  193. package/src/definitions/modules/transition.js +44 -38
  194. package/src/themes/amazon/elements/button.overrides +7 -7
  195. package/src/themes/default/collections/form.variables +1 -1
  196. package/src/themes/default/elements/reveal.variables +1 -1
  197. package/src/themes/default/globals/site.variables +1 -1
  198. package/src/themes/default/modules/dimmer.variables +6 -6
  199. package/src/themes/default/modules/modal.variables +1 -1
  200. package/src/themes/default/modules/slider.variables +4 -4
  201. package/src/themes/default/modules/toast.variables +2 -2
  202. package/src/themes/default/modules/transition.overrides +12 -12
  203. package/src/themes/flat/collections/form.overrides +2 -2
  204. package/src/themes/flat/globals/site.variables +1 -1
  205. package/src/themes/github/collections/form.overrides +2 -2
  206. package/src/themes/github/collections/menu.variables +1 -1
  207. package/src/themes/github/collections/message.overrides +3 -3
  208. package/src/themes/github/elements/input.overrides +2 -2
  209. package/src/themes/timeline/views/feed.overrides +3 -3
  210. package/src/themes/twitter/elements/button.overrides +2 -2
  211. package/tasks/README.md +1 -3
  212. package/tasks/admin/components/create.js +9 -16
  213. package/tasks/admin/components/init.js +7 -7
  214. package/tasks/admin/components/update.js +10 -10
  215. package/tasks/admin/distributions/create.js +16 -18
  216. package/tasks/admin/distributions/init.js +7 -7
  217. package/tasks/admin/distributions/update.js +10 -10
  218. package/tasks/admin/publish.js +1 -3
  219. package/tasks/admin/register.js +6 -6
  220. package/tasks/admin/release.js +1 -3
  221. package/tasks/build/assets.js +2 -2
  222. package/tasks/build/css.js +8 -3
  223. package/tasks/build/javascript.js +3 -1
  224. package/tasks/build.js +1 -1
  225. package/tasks/check-install.js +1 -1
  226. package/tasks/clean.js +1 -1
  227. package/tasks/collections/README.md +3 -5
  228. package/tasks/collections/admin.js +1 -1
  229. package/tasks/collections/docs.js +1 -1
  230. package/tasks/collections/install.js +1 -1
  231. package/tasks/collections/rtl.js +1 -1
  232. package/tasks/collections/various.js +1 -1
  233. package/tasks/config/admin/github.js +6 -8
  234. package/tasks/config/admin/templates/css-package.js +1 -1
  235. package/tasks/config/admin/templates/less-package.js +1 -1
  236. package/tasks/config/npm/gulpfile.js +7 -7
  237. package/tasks/config/project/config.js +14 -19
  238. package/tasks/config/project/install.js +35 -34
  239. package/tasks/config/project/release.js +15 -16
  240. package/tasks/config/tasks.js +18 -20
  241. package/tasks/config/user.js +5 -3
  242. package/tasks/docs/build.js +5 -3
  243. package/tasks/docs/metadata.js +7 -8
  244. package/tasks/docs/serve.js +6 -3
  245. package/tasks/install.js +39 -39
  246. package/tasks/rtl/build.js +1 -3
  247. package/tasks/rtl/watch.js +1 -3
  248. package/tasks/version.js +1 -3
  249. package/tasks/watch.js +1 -1
  250. package/test/.eslintrc.js +0 -4
  251. package/test/meteor/assets.js +1 -1
  252. package/test/modules/module.spec.js +15 -15
  253. package/test/modules/popup.spec.js +1 -1
  254. package/test/modules/search.spec.js +1 -1
  255. package/test/modules/tab.spec.js +1 -1
  256. package/test/modules/transition.spec.js +1 -1
@@ -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,17 +24,17 @@
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
- methodInvoked = (typeof query == 'string'),
31
+ methodInvoked = typeof query === 'string',
32
32
  queryArguments = [].slice.call(arguments, 1),
33
33
  returnedValue
34
34
  ;
35
35
  $allModules.each(function () {
36
36
  var
37
- settings = ($.isPlainObject(parameters))
37
+ settings = $.isPlainObject(parameters)
38
38
  ? $.extend(true, {}, $.fn.nag.settings, parameters)
39
39
  : $.extend({}, $.fn.nag.settings),
40
40
 
@@ -47,7 +47,7 @@
47
47
 
48
48
  $module = $(this),
49
49
 
50
- $context = (settings.context)
50
+ $context = settings.context
51
51
  ? ([window, document].indexOf(settings.context) < 0 ? $(document).find(settings.context) : $(settings.context))
52
52
  : $('body'),
53
53
 
@@ -162,20 +162,22 @@
162
162
  }
163
163
  if (expires instanceof Date && expires.getTime()) {
164
164
  return expires.toUTCString();
165
- } else {
166
- module.error(error.expiresFormat);
167
165
  }
166
+
167
+ module.error(error.expiresFormat);
168
168
  },
169
169
  storage: function () {
170
170
  if (settings.storageMethod === 'localstorage' && window.localStorage !== undefined) {
171
171
  module.debug('Using local storage');
172
172
 
173
173
  return window.localStorage;
174
- } else if (settings.storageMethod === 'sessionstorage' && window.sessionStorage !== undefined) {
174
+ }
175
+ if (settings.storageMethod === 'sessionstorage' && window.sessionStorage !== undefined) {
175
176
  module.debug('Using session storage');
176
177
 
177
178
  return window.sessionStorage;
178
- } else if ('cookie' in document) {
179
+ }
180
+ if ('cookie' in document) {
179
181
  module.debug('Using cookie');
180
182
 
181
183
  return {
@@ -186,12 +188,12 @@
186
188
  .replace(/[()]/g, escape)
187
189
  ;
188
190
  value = encodeURIComponent(value)
189
- .replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent)
191
+ .replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[B-D])/g, decodeURIComponent)
190
192
  ;
191
193
 
192
194
  var cookieOptions = '';
193
195
  for (var option in options) {
194
- if (options.hasOwnProperty(option)) {
196
+ if (Object.prototype.hasOwnProperty.call(options, option)) {
195
197
  cookieOptions += '; ' + option;
196
198
  if (typeof options[option] === 'string') {
197
199
  cookieOptions += '=' + options[option].split(';')[0];
@@ -205,7 +207,7 @@
205
207
  for (var i = 0, il = cookies.length; i < il; i++) {
206
208
  var
207
209
  parts = cookies[i].split('='),
208
- foundKey = parts[0].replace(/(%[\dA-F]{2})+/gi, decodeURIComponent)
210
+ foundKey = parts[0].replace(/(%[\da-f]{2})+/gi, decodeURIComponent)
209
211
  ;
210
212
  if (key === foundKey) {
211
213
  return parts[1] || '';
@@ -216,9 +218,9 @@
216
218
  storage.setItem(key, '', options);
217
219
  },
218
220
  };
219
- } else {
220
- module.error(error.noStorage);
221
221
  }
222
+
223
+ module.error(error.noStorage);
222
224
  },
223
225
  storageOptions: function () {
224
226
  var
@@ -352,7 +354,7 @@
352
354
  previousTime
353
355
  ;
354
356
  if (settings.performance) {
355
- currentTime = new Date().getTime();
357
+ currentTime = Date.now();
356
358
  previousTime = time || currentTime;
357
359
  executionTime = currentTime - previousTime;
358
360
  time = currentTime;
@@ -403,11 +405,11 @@
403
405
  ;
404
406
  passedArguments = passedArguments || queryArguments;
405
407
  context = context || element;
406
- if (typeof query == 'string' && object !== undefined) {
407
- query = query.split(/[\. ]/);
408
+ if (typeof query === 'string' && object !== undefined) {
409
+ query = query.split(/[ .]/);
408
410
  maxDepth = query.length - 1;
409
411
  $.each(query, function (depth, value) {
410
- var camelCaseValue = (depth != maxDepth)
412
+ var camelCaseValue = depth != maxDepth
411
413
  ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
412
414
  : query
413
415
  ;
@@ -460,7 +462,7 @@
460
462
  }
461
463
  });
462
464
 
463
- return (returnedValue !== undefined)
465
+ return returnedValue !== undefined
464
466
  ? returnedValue
465
467
  : this;
466
468
  };
@@ -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
 
@@ -28,22 +28,22 @@
28
28
 
29
29
  moduleSelector = $allModules.selector || '',
30
30
 
31
- clickEvent = ('ontouchstart' in document.documentElement)
31
+ clickEvent = 'ontouchstart' in document.documentElement
32
32
  ? 'touchstart'
33
33
  : 'click',
34
34
 
35
- time = new Date().getTime(),
35
+ time = Date.now(),
36
36
  performance = [],
37
37
 
38
38
  query = arguments[0],
39
- methodInvoked = (typeof query == 'string'),
39
+ methodInvoked = typeof query === 'string',
40
40
  queryArguments = [].slice.call(arguments, 1),
41
41
 
42
42
  returnedValue
43
43
  ;
44
44
  $allModules.each(function () {
45
45
  var
46
- settings = ($.isPlainObject(parameters))
46
+ settings = $.isPlainObject(parameters)
47
47
  ? $.extend(true, {}, $.fn.popup.settings, parameters)
48
48
  : $.extend({}, $.fn.popup.settings),
49
49
 
@@ -60,7 +60,7 @@
60
60
  $context = [window, document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $(settings.context),
61
61
  $scrollContext = [window, document].indexOf(settings.scrollContext) < 0 ? $document.find(settings.scrollContext) : $(settings.scrollContext),
62
62
  $boundary = [window, document].indexOf(settings.boundary) < 0 ? $document.find(settings.boundary) : $(settings.boundary),
63
- $target = (settings.target)
63
+ $target = settings.target
64
64
  ? ([window, document].indexOf(settings.target) < 0 ? $document.find(settings.target) : $(settings.target))
65
65
  : $module,
66
66
 
@@ -136,11 +136,11 @@
136
136
  ;
137
137
  }
138
138
  } else {
139
- $offsetParent = (settings.inline)
139
+ $offsetParent = settings.inline
140
140
  ? module.get.offsetParent($target)
141
- : module.has.popup()
141
+ : (module.has.popup()
142
142
  ? module.get.offsetParent($popup)
143
- : $body;
143
+ : $body);
144
144
  }
145
145
  if ($offsetParent.is('html') && $offsetParent[0] !== $body[0]) {
146
146
  module.debug('Setting page as offset parent');
@@ -179,7 +179,7 @@
179
179
  event: {
180
180
  start: function (event) {
181
181
  var
182
- delay = ($.isPlainObject(settings.delay))
182
+ delay = $.isPlainObject(settings.delay)
183
183
  ? settings.delay.show
184
184
  : settings.delay
185
185
  ;
@@ -190,7 +190,7 @@
190
190
  },
191
191
  end: function () {
192
192
  var
193
- delay = ($.isPlainObject(settings.delay))
193
+ delay = $.isPlainObject(settings.delay)
194
194
  ? settings.delay.hide
195
195
  : settings.delay
196
196
  ;
@@ -224,7 +224,7 @@
224
224
  var
225
225
  $target = $(event.target),
226
226
  isInDOM = $.contains(document.documentElement, event.target),
227
- inPopup = ($target.closest(selector.popup).length > 0)
227
+ inPopup = $target.closest(selector.popup).length > 0
228
228
  ;
229
229
  // don't close on clicks inside popup
230
230
  if (event && !inPopup && isInDOM) {
@@ -282,7 +282,7 @@
282
282
  if (settings.hoverable) {
283
283
  module.bind.popup();
284
284
  }
285
- } else if ($target.next(selector.popup).length !== 0) {
285
+ } else if ($target.next(selector.popup).length > 0) {
286
286
  module.verbose('Pre-existing popup found');
287
287
  settings.inline = true;
288
288
  settings.popup = $target.next(selector.popup).data(metadata.activator, $module);
@@ -325,7 +325,8 @@
325
325
  module.debug('onShow callback returned false, cancelling popup animation');
326
326
 
327
327
  return;
328
- } else if (!settings.preserve && !settings.popup) {
328
+ }
329
+ if (!settings.preserve && !settings.popup) {
329
330
  module.refresh();
330
331
  }
331
332
  if ($popup && module.set.position()) {
@@ -369,12 +370,10 @@
369
370
  return false;
370
371
  }
371
372
  if (settings.inline || settings.popup) {
372
- return (module.has.popup());
373
- } else {
374
- return ($popup.closest($context).length >= 1)
375
- ? true
376
- : false;
373
+ return module.has.popup();
377
374
  }
375
+
376
+ return $popup.closest($context).length > 0;
378
377
  },
379
378
 
380
379
  removePopup: function () {
@@ -409,7 +408,7 @@
409
408
  },
410
409
  supports: {
411
410
  svg: function () {
412
- return (typeof SVGGraphicsElement !== 'undefined');
411
+ return typeof SVGGraphicsElement !== 'undefined';
413
412
  },
414
413
  },
415
414
  animate: {
@@ -498,16 +497,16 @@
498
497
  var
499
498
  $popupOffsetParent = module.get.offsetParent($popup),
500
499
  targetElement = $target[0],
501
- isWindowEl = ($boundary[0] == window),
500
+ isWindowEl = $boundary[0] == window,
502
501
  targetOffset = $target.offset(),
503
502
  parentOffset = settings.inline || (settings.popup && settings.movePopup)
504
503
  ? $target.offsetParent().offset()
505
504
  : { top: 0, left: 0 },
506
- screenPosition = (isWindowEl)
505
+ screenPosition = isWindowEl
507
506
  ? { top: 0, left: 0 }
508
507
  : $boundary.offset(),
509
508
  calculations = {},
510
- scroll = (isWindowEl)
509
+ scroll = isWindowEl
511
510
  ? { top: $window.scrollTop(), left: $window.scrollLeft() }
512
511
  : { top: 0, left: 0 },
513
512
  screen
@@ -565,13 +564,13 @@
565
564
  }
566
565
 
567
566
  // add in margins if inline
568
- calculations.target.margin.top = (settings.inline)
567
+ calculations.target.margin.top = settings.inline
569
568
  ? parseInt(window.getComputedStyle(targetElement).getPropertyValue('margin-top'), 10)
570
569
  : 0;
571
- calculations.target.margin.left = (settings.inline)
572
- ? module.is.rtl()
570
+ calculations.target.margin.left = settings.inline
571
+ ? (module.is.rtl()
573
572
  ? parseInt(window.getComputedStyle(targetElement).getPropertyValue('margin-right'), 10)
574
- : parseInt(window.getComputedStyle(targetElement).getPropertyValue('margin-left'), 10)
573
+ : parseInt(window.getComputedStyle(targetElement).getPropertyValue('margin-left'), 10))
575
574
  : 0;
576
575
  // calculate screen boundaries
577
576
  screen = calculations.screen;
@@ -590,7 +589,8 @@
590
589
  startEvent: function () {
591
590
  if (settings.on == 'hover') {
592
591
  return 'mouseenter';
593
- } else if (settings.on == 'focus') {
592
+ }
593
+ if (settings.on == 'focus') {
594
594
  return 'focus';
595
595
  }
596
596
 
@@ -602,7 +602,8 @@
602
602
  endEvent: function () {
603
603
  if (settings.on == 'hover') {
604
604
  return 'mouseleave';
605
- } else if (settings.on == 'focus') {
605
+ }
606
+ if (settings.on == 'focus') {
606
607
  return 'blur';
607
608
  }
608
609
 
@@ -622,10 +623,10 @@
622
623
 
623
624
  if (offset) {
624
625
  distanceFromBoundary = {
625
- top: (offset.top - boundary.top),
626
- left: (offset.left - boundary.left),
627
- right: (boundary.right - (offset.left + popup.width)),
628
- bottom: (boundary.bottom - (offset.top + popup.height)),
626
+ top: offset.top - boundary.top,
627
+ left: offset.left - boundary.left,
628
+ right: boundary.right - (offset.left + popup.width),
629
+ bottom: boundary.bottom - (offset.top + popup.height),
629
630
  };
630
631
  module.verbose('Distance from boundaries determined', offset, distanceFromBoundary);
631
632
  }
@@ -634,7 +635,7 @@
634
635
  },
635
636
  offsetParent: function ($element) {
636
637
  var
637
- element = ($element !== undefined)
638
+ element = $element !== undefined
638
639
  ? $element[0]
639
640
  : $target[0],
640
641
  parentNode = element.parentNode,
@@ -642,20 +643,20 @@
642
643
  ;
643
644
  if (parentNode) {
644
645
  var
645
- is2D = ($node.css('transform') === 'none'),
646
- isStatic = ($node.css('position') === 'static'),
646
+ is2D = $node.css('transform') === 'none',
647
+ isStatic = $node.css('position') === 'static',
647
648
  isBody = $node.is('body')
648
649
  ;
649
650
  while (parentNode && !isBody && isStatic && is2D) {
650
651
  parentNode = parentNode.parentNode;
651
652
  $node = $(parentNode);
652
- is2D = ($node.css('transform') === 'none');
653
- isStatic = ($node.css('position') === 'static');
653
+ is2D = $node.css('transform') === 'none';
654
+ isStatic = $node.css('position') === 'static';
654
655
  isBody = $node.is('body');
655
656
  }
656
657
  }
657
658
 
658
- return ($node && $node.length > 0)
659
+ return $node && $node.length > 0
659
660
  ? $node
660
661
  : $();
661
662
  },
@@ -697,7 +698,7 @@
697
698
  'bottom left': 'left center',
698
699
  'left center': 'top left',
699
700
  },
700
- adjacentsAvailable = (verticalPosition == 'top' || verticalPosition == 'bottom'),
701
+ adjacentsAvailable = verticalPosition == 'top' || verticalPosition == 'bottom',
701
702
  oppositeTried = false,
702
703
  adjacentTried = false,
703
704
  nextPosition = false
@@ -713,13 +714,13 @@
713
714
  if (settings.prefer === 'opposite') {
714
715
  nextPosition = [opposite[verticalPosition], horizontalPosition];
715
716
  nextPosition = nextPosition.join(' ');
716
- oppositeTried = (triedPositions[nextPosition] === true);
717
+ oppositeTried = triedPositions[nextPosition] === true;
717
718
  module.debug('Trying opposite strategy', nextPosition);
718
719
  }
719
720
  if ((settings.prefer === 'adjacent') && adjacentsAvailable) {
720
721
  nextPosition = [verticalPosition, adjacent[horizontalPosition]];
721
722
  nextPosition = nextPosition.join(' ');
722
- adjacentTried = (triedPositions[nextPosition] === true);
723
+ adjacentTried = triedPositions[nextPosition] === true;
723
724
  module.debug('Trying adjacent strategy', nextPosition);
724
725
  }
725
726
  if (adjacentTried || oppositeTried) {
@@ -764,11 +765,11 @@
764
765
  if (module.should.centerArrow(calculations)) {
765
766
  module.verbose('Adjusting offset to center arrow on small target element');
766
767
  if (position == 'top left' || position == 'bottom left') {
767
- offset += (target.width / 2);
768
+ offset += target.width / 2;
768
769
  offset -= settings.arrowPixelsFromEdge;
769
770
  }
770
771
  if (position == 'top right' || position == 'bottom right') {
771
- offset -= (target.width / 2);
772
+ offset -= target.width / 2;
772
773
  offset += settings.arrowPixelsFromEdge;
773
774
  }
774
775
  }
@@ -797,7 +798,7 @@
797
798
 
798
799
  if (module.is.rtl()) {
799
800
  position = position.replace(/left|right/g, function (match) {
800
- return (match == 'left')
801
+ return match == 'left'
801
802
  ? 'right'
802
803
  : 'left';
803
804
  });
@@ -909,22 +910,21 @@
909
910
  position = module.get.nextPosition(position);
910
911
  module.debug('Trying new position', position);
911
912
 
912
- return ($popup)
913
+ return $popup
913
914
  ? module.set.position(position, calculations)
914
915
  : false;
916
+ }
917
+ if (settings.lastResort) {
918
+ module.debug('No position found, showing with last position');
915
919
  } else {
916
- if (settings.lastResort) {
917
- module.debug('No position found, showing with last position');
918
- } else {
919
- module.debug('Popup could not find a position to display', $popup);
920
- module.error(error.cannotPlace, element);
921
- module.remove.attempts();
922
- module.remove.loading();
923
- module.reset();
924
- settings.onUnplaceable.call($popup, element);
925
-
926
- return false;
927
- }
920
+ module.debug('Popup could not find a position to display', $popup);
921
+ module.error(error.cannotPlace, element);
922
+ module.remove.attempts();
923
+ module.remove.loading();
924
+ module.reset();
925
+ settings.onUnplaceable.call($popup, element);
926
+
927
+ return false;
928
928
  }
929
929
  }
930
930
  module.debug('Position is on stage', position);
@@ -1067,7 +1067,7 @@
1067
1067
 
1068
1068
  has: {
1069
1069
  popup: function () {
1070
- return ($popup && $popup.length > 0);
1070
+ return $popup && $popup.length > 0;
1071
1071
  },
1072
1072
  },
1073
1073
 
@@ -1109,13 +1109,13 @@
1109
1109
  return $module.hasClass(className.active);
1110
1110
  },
1111
1111
  animating: function () {
1112
- return ($popup !== undefined && $popup.hasClass(className.animating));
1112
+ return $popup !== undefined && $popup.hasClass(className.animating);
1113
1113
  },
1114
1114
  fluid: function () {
1115
- return ($popup !== undefined && $popup.hasClass(className.fluid));
1115
+ return $popup !== undefined && $popup.hasClass(className.fluid);
1116
1116
  },
1117
1117
  visible: function () {
1118
- return ($popup !== undefined && $popup.hasClass(className.popupVisible));
1118
+ return $popup !== undefined && $popup.hasClass(className.popupVisible);
1119
1119
  },
1120
1120
  dropdown: function () {
1121
1121
  return $module.hasClass(className.dropdown);
@@ -1193,7 +1193,7 @@
1193
1193
  previousTime
1194
1194
  ;
1195
1195
  if (settings.performance) {
1196
- currentTime = new Date().getTime();
1196
+ currentTime = Date.now();
1197
1197
  previousTime = time || currentTime;
1198
1198
  executionTime = currentTime - previousTime;
1199
1199
  time = currentTime;
@@ -1244,11 +1244,11 @@
1244
1244
  ;
1245
1245
  passedArguments = passedArguments || queryArguments;
1246
1246
  context = context || element;
1247
- if (typeof query == 'string' && object !== undefined) {
1248
- query = query.split(/[\. ]/);
1247
+ if (typeof query === 'string' && object !== undefined) {
1248
+ query = query.split(/[ .]/);
1249
1249
  maxDepth = query.length - 1;
1250
1250
  $.each(query, function (depth, value) {
1251
- var camelCaseValue = (depth != maxDepth)
1251
+ var camelCaseValue = depth != maxDepth
1252
1252
  ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
1253
1253
  : query
1254
1254
  ;
@@ -1299,7 +1299,7 @@
1299
1299
  }
1300
1300
  });
1301
1301
 
1302
- return (returnedValue !== undefined)
1302
+ return returnedValue !== undefined
1303
1303
  ? returnedValue
1304
1304
  : this;
1305
1305
  };
@@ -1471,8 +1471,8 @@
1471
1471
  templates: {
1472
1472
  escape: function (string) {
1473
1473
  var
1474
- badChars = /[<>"'`]/g,
1475
- shouldEscape = /[&<>"'`]/,
1474
+ badChars = /["'<>`]/g,
1475
+ shouldEscape = /["&'<>`]/,
1476
1476
  escape = {
1477
1477
  '<': '&lt;',
1478
1478
  '>': '&gt;',
@@ -1485,7 +1485,7 @@
1485
1485
  }
1486
1486
  ;
1487
1487
  if (shouldEscape.test(string)) {
1488
- string = string.replace(/&(?![a-z0-9#]{1,12};)/gi, '&amp;');
1488
+ string = string.replace(/&(?![\d#a-z]{1,12};)/gi, '&amp;');
1489
1489
 
1490
1490
  return string.replace(badChars, escapedChar);
1491
1491
  }