fomantic-ui 2.9.3-beta.1 → 2.9.3-beta.3

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 (187) hide show
  1. package/.all-contributorsrc +9 -0
  2. package/CONTRIBUTORS.md +102 -99
  3. package/dist/components/accordion.css +1 -1
  4. package/dist/components/accordion.js +1 -5
  5. package/dist/components/accordion.min.css +1 -1
  6. package/dist/components/accordion.min.js +2 -2
  7. package/dist/components/ad.css +1 -1
  8. package/dist/components/ad.min.css +1 -1
  9. package/dist/components/api.js +14 -8
  10. package/dist/components/api.min.js +2 -2
  11. package/dist/components/breadcrumb.css +1 -1
  12. package/dist/components/breadcrumb.min.css +1 -1
  13. package/dist/components/button.css +1 -1
  14. package/dist/components/button.min.css +1 -1
  15. package/dist/components/calendar.css +6 -6
  16. package/dist/components/calendar.js +1 -6
  17. package/dist/components/calendar.min.css +2 -2
  18. package/dist/components/calendar.min.js +2 -2
  19. package/dist/components/card.css +1 -1
  20. package/dist/components/card.min.css +1 -1
  21. package/dist/components/checkbox.css +1 -1
  22. package/dist/components/checkbox.js +1 -5
  23. package/dist/components/checkbox.min.css +1 -1
  24. package/dist/components/checkbox.min.js +2 -2
  25. package/dist/components/comment.css +1 -1
  26. package/dist/components/comment.min.css +1 -1
  27. package/dist/components/container.css +1 -1
  28. package/dist/components/container.min.css +1 -1
  29. package/dist/components/dimmer.css +1 -1
  30. package/dist/components/dimmer.js +1 -5
  31. package/dist/components/dimmer.min.css +1 -1
  32. package/dist/components/dimmer.min.js +2 -2
  33. package/dist/components/divider.css +1 -1
  34. package/dist/components/divider.min.css +1 -1
  35. package/dist/components/dropdown.css +1 -1
  36. package/dist/components/dropdown.js +29 -14
  37. package/dist/components/dropdown.min.css +1 -1
  38. package/dist/components/dropdown.min.js +2 -2
  39. package/dist/components/embed.css +1 -1
  40. package/dist/components/embed.js +1 -6
  41. package/dist/components/embed.min.css +1 -1
  42. package/dist/components/embed.min.js +2 -2
  43. package/dist/components/emoji.css +1 -1
  44. package/dist/components/emoji.min.css +1 -1
  45. package/dist/components/feed.css +1 -1
  46. package/dist/components/feed.min.css +1 -1
  47. package/dist/components/flag.css +1 -1
  48. package/dist/components/flag.min.css +1 -1
  49. package/dist/components/flyout.css +1 -1
  50. package/dist/components/flyout.js +38 -27
  51. package/dist/components/flyout.min.css +1 -1
  52. package/dist/components/flyout.min.js +2 -2
  53. package/dist/components/form.css +1 -1
  54. package/dist/components/form.js +31 -23
  55. package/dist/components/form.min.css +1 -1
  56. package/dist/components/form.min.js +2 -2
  57. package/dist/components/grid.css +1 -1
  58. package/dist/components/grid.min.css +1 -1
  59. package/dist/components/header.css +1 -1
  60. package/dist/components/header.min.css +1 -1
  61. package/dist/components/icon.css +1 -1
  62. package/dist/components/icon.min.css +1 -1
  63. package/dist/components/image.css +1 -1
  64. package/dist/components/image.min.css +1 -1
  65. package/dist/components/input.css +1 -1
  66. package/dist/components/input.min.css +1 -1
  67. package/dist/components/item.css +1 -1
  68. package/dist/components/item.min.css +1 -1
  69. package/dist/components/label.css +1 -1
  70. package/dist/components/label.min.css +1 -1
  71. package/dist/components/list.css +1 -1
  72. package/dist/components/list.min.css +1 -1
  73. package/dist/components/loader.css +1 -1
  74. package/dist/components/loader.min.css +1 -1
  75. package/dist/components/menu.css +1 -1
  76. package/dist/components/menu.min.css +1 -1
  77. package/dist/components/message.css +1 -1
  78. package/dist/components/message.min.css +1 -1
  79. package/dist/components/modal.css +1 -1
  80. package/dist/components/modal.js +38 -26
  81. package/dist/components/modal.min.css +1 -1
  82. package/dist/components/modal.min.js +2 -2
  83. package/dist/components/nag.css +1 -1
  84. package/dist/components/nag.js +16 -8
  85. package/dist/components/nag.min.css +1 -1
  86. package/dist/components/nag.min.js +2 -2
  87. package/dist/components/placeholder.css +1 -1
  88. package/dist/components/placeholder.min.css +1 -1
  89. package/dist/components/popup.css +1 -1
  90. package/dist/components/popup.js +18 -12
  91. package/dist/components/popup.min.css +1 -1
  92. package/dist/components/popup.min.js +2 -2
  93. package/dist/components/progress.css +1 -1
  94. package/dist/components/progress.js +1 -6
  95. package/dist/components/progress.min.css +1 -1
  96. package/dist/components/progress.min.js +2 -2
  97. package/dist/components/rail.css +1 -1
  98. package/dist/components/rail.min.css +1 -1
  99. package/dist/components/rating.css +1 -1
  100. package/dist/components/rating.js +1 -5
  101. package/dist/components/rating.min.css +1 -1
  102. package/dist/components/rating.min.js +2 -2
  103. package/dist/components/reset.css +1 -1
  104. package/dist/components/reset.min.css +1 -1
  105. package/dist/components/reveal.css +1 -1
  106. package/dist/components/reveal.min.css +1 -1
  107. package/dist/components/search.css +1 -1
  108. package/dist/components/search.js +1 -5
  109. package/dist/components/search.min.css +1 -1
  110. package/dist/components/search.min.js +2 -2
  111. package/dist/components/segment.css +3 -2
  112. package/dist/components/segment.min.css +2 -2
  113. package/dist/components/shape.css +1 -1
  114. package/dist/components/shape.js +1 -5
  115. package/dist/components/shape.min.css +1 -1
  116. package/dist/components/shape.min.js +2 -2
  117. package/dist/components/sidebar.css +1 -1
  118. package/dist/components/sidebar.js +15 -8
  119. package/dist/components/sidebar.min.css +1 -1
  120. package/dist/components/sidebar.min.js +2 -2
  121. package/dist/components/site.css +1 -1
  122. package/dist/components/site.js +1 -1
  123. package/dist/components/site.min.css +1 -1
  124. package/dist/components/site.min.js +1 -1
  125. package/dist/components/slider.css +1 -1
  126. package/dist/components/slider.js +1 -6
  127. package/dist/components/slider.min.css +1 -1
  128. package/dist/components/slider.min.js +2 -2
  129. package/dist/components/state.js +23 -20
  130. package/dist/components/state.min.js +2 -2
  131. package/dist/components/statistic.css +1 -1
  132. package/dist/components/statistic.min.css +1 -1
  133. package/dist/components/step.css +1 -1
  134. package/dist/components/step.min.css +1 -1
  135. package/dist/components/sticky.css +1 -1
  136. package/dist/components/sticky.js +17 -16
  137. package/dist/components/sticky.min.css +1 -1
  138. package/dist/components/sticky.min.js +2 -2
  139. package/dist/components/tab.css +1 -1
  140. package/dist/components/tab.js +14 -6
  141. package/dist/components/tab.min.css +1 -1
  142. package/dist/components/tab.min.js +2 -2
  143. package/dist/components/table.css +1 -1
  144. package/dist/components/table.min.css +1 -1
  145. package/dist/components/text.css +1 -1
  146. package/dist/components/text.min.css +1 -1
  147. package/dist/components/toast.css +1 -1
  148. package/dist/components/toast.js +17 -9
  149. package/dist/components/toast.min.css +1 -1
  150. package/dist/components/toast.min.js +2 -2
  151. package/dist/components/transition.css +1 -1
  152. package/dist/components/transition.js +1 -5
  153. package/dist/components/transition.min.css +1 -1
  154. package/dist/components/transition.min.js +2 -2
  155. package/dist/components/visibility.js +15 -6
  156. package/dist/components/visibility.min.js +2 -2
  157. package/dist/semantic.css +60 -59
  158. package/dist/semantic.js +298 -244
  159. package/dist/semantic.min.css +2 -2
  160. package/dist/semantic.min.js +2 -2
  161. package/package.json +1 -1
  162. package/src/definitions/behaviors/api.js +13 -7
  163. package/src/definitions/behaviors/form.js +30 -22
  164. package/src/definitions/behaviors/state.js +22 -19
  165. package/src/definitions/behaviors/visibility.js +14 -5
  166. package/src/definitions/elements/segment.less +2 -1
  167. package/src/definitions/modules/accordion.js +0 -4
  168. package/src/definitions/modules/calendar.js +0 -5
  169. package/src/definitions/modules/calendar.less +1 -1
  170. package/src/definitions/modules/checkbox.js +0 -4
  171. package/src/definitions/modules/dimmer.js +0 -4
  172. package/src/definitions/modules/dropdown.js +28 -13
  173. package/src/definitions/modules/embed.js +0 -5
  174. package/src/definitions/modules/flyout.js +37 -26
  175. package/src/definitions/modules/modal.js +37 -25
  176. package/src/definitions/modules/nag.js +15 -7
  177. package/src/definitions/modules/popup.js +17 -11
  178. package/src/definitions/modules/progress.js +0 -5
  179. package/src/definitions/modules/rating.js +0 -4
  180. package/src/definitions/modules/search.js +0 -4
  181. package/src/definitions/modules/shape.js +0 -4
  182. package/src/definitions/modules/sidebar.js +14 -7
  183. package/src/definitions/modules/slider.js +0 -5
  184. package/src/definitions/modules/sticky.js +16 -15
  185. package/src/definitions/modules/tab.js +13 -5
  186. package/src/definitions/modules/toast.js +16 -8
  187. package/src/definitions/modules/transition.js +0 -4
@@ -28,15 +28,25 @@
28
28
  $head = $('head'),
29
29
  $body = $('body'),
30
30
 
31
- moduleSelector = $allModules.selector || '',
32
-
33
31
  time = Date.now(),
34
32
  performance = [],
35
33
 
36
34
  query = arguments[0],
37
35
  methodInvoked = typeof query === 'string',
38
36
  queryArguments = [].slice.call(arguments, 1),
37
+ contextCheck = function (context, win) {
38
+ var $context;
39
+ if ([window, document].indexOf(context) >= 0) {
40
+ $context = $body;
41
+ } else {
42
+ $context = $(win.document).find(context);
43
+ if ($context.length === 0) {
44
+ $context = win.frameElement ? contextCheck(context, win.parent) : $body;
45
+ }
46
+ }
39
47
 
48
+ return $context;
49
+ },
40
50
  returnedValue
41
51
  ;
42
52
 
@@ -57,7 +67,7 @@
57
67
  moduleNamespace = 'module-' + namespace,
58
68
 
59
69
  $module = $(this),
60
- $context = [window, document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $body,
70
+ $context = contextCheck(settings.context, window),
61
71
  $closeIcon = $module.find(selector.close),
62
72
  $inputs,
63
73
  $focusedElement,
@@ -76,6 +86,7 @@
76
86
  initialBodyMargin = '',
77
87
  tempBodyMargin = '',
78
88
  hadScrollbar = false,
89
+ windowRefocused = false,
79
90
 
80
91
  elementNamespace,
81
92
  id,
@@ -254,9 +265,13 @@
254
265
  module.setup.heights();
255
266
  },
256
267
  focus: function () {
257
- if (module.is.visible() && settings.autofocus && settings.dimPage) {
268
+ windowRefocused = true;
269
+ },
270
+ click: function (event) {
271
+ if (windowRefocused && document.activeElement !== event.target && module.is.visible() && settings.autofocus && settings.dimPage && $(document.activeElement).closest(selector.flyout).length === 0) {
258
272
  requestAnimationFrame(module.set.autofocus);
259
273
  }
274
+ windowRefocused = false;
260
275
  },
261
276
  clickaway: function (event) {
262
277
  if (settings.closable) {
@@ -363,6 +378,9 @@
363
378
  $window
364
379
  .on('focus' + elementNamespace, module.event.focus)
365
380
  ;
381
+ $context
382
+ .on('click' + elementNamespace, module.event.click)
383
+ ;
366
384
  },
367
385
  clickaway: function () {
368
386
  module.verbose('Adding clickaway events to context', $context);
@@ -492,11 +510,12 @@
492
510
 
493
511
  return nodes;
494
512
  },
495
- shouldRefreshInputs = false
513
+ shouldRefreshInputs = false,
514
+ ignoreAutofocus = true
496
515
  ;
497
516
  mutations.every(function (mutation) {
498
517
  if (mutation.type === 'attributes') {
499
- if (observeAttributes && (mutation.attributeName === 'disabled' || $(mutation.target).find(':input').addBack(':input').length > 0)) {
518
+ if (observeAttributes && (mutation.attributeName === 'disabled' || $(mutation.target).find(':input').addBack(':input').filter(':visible').length > 0)) {
500
519
  shouldRefreshInputs = true;
501
520
  }
502
521
  } else {
@@ -506,6 +525,7 @@
506
525
  $removedInputs = $(collectNodes(mutation.removedNodes)).filter('a[href], [tabindex], :input');
507
526
  if ($addedInputs.length > 0 || $removedInputs.length > 0) {
508
527
  shouldRefreshInputs = true;
528
+ ignoreAutofocus = false;
509
529
  }
510
530
  }
511
531
 
@@ -513,7 +533,7 @@
513
533
  });
514
534
 
515
535
  if (shouldRefreshInputs) {
516
- module.refreshInputs();
536
+ module.refreshInputs(ignoreAutofocus);
517
537
  }
518
538
  });
519
539
  observer.observe(element, {
@@ -527,7 +547,7 @@
527
547
  },
528
548
  refresh: function () {
529
549
  module.verbose('Refreshing selector cache');
530
- $context = [window, document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $body;
550
+ $context = contextCheck(settings.context, window);
531
551
  module.refreshFlyouts();
532
552
  $pusher = $context.children(selector.pusher);
533
553
  module.clear.cache();
@@ -538,7 +558,7 @@
538
558
  $flyouts = $context.children(selector.flyout);
539
559
  },
540
560
 
541
- refreshInputs: function () {
561
+ refreshInputs: function (ignoreAutofocus) {
542
562
  if ($inputs) {
543
563
  $inputs
544
564
  .off('keydown' + elementNamespace)
@@ -550,8 +570,8 @@
550
570
  $inputs = $module.find('a[href], [tabindex], :input:enabled').filter(':visible').filter(function () {
551
571
  return $(this).closest('.disabled').length === 0;
552
572
  });
553
- if ($inputs.length === 0) {
554
- $inputs = $module;
573
+ if ($inputs.filter(':input').length === 0) {
574
+ $inputs = $module.add($inputs);
555
575
  $module.attr('tabindex', -1);
556
576
  } else {
557
577
  $module.removeAttr('tabindex');
@@ -562,7 +582,7 @@
562
582
  $inputs.last()
563
583
  .on('keydown' + elementNamespace, module.event.inputKeyDown.last)
564
584
  ;
565
- if (settings.autofocus && $inputs.filter(':focus').length === 0) {
585
+ if (!ignoreAutofocus && settings.autofocus && $inputs.filter(':focus').length === 0) {
566
586
  module.set.autofocus();
567
587
  }
568
588
  },
@@ -840,20 +860,14 @@
840
860
  var
841
861
  $autofocus = $inputs.filter('[autofocus]'),
842
862
  $rawInputs = $inputs.filter(':input'),
843
- $input = $autofocus.length > 0
844
- ? $autofocus.first()
863
+ $input = ($autofocus.length > 0
864
+ ? $autofocus
845
865
  : ($rawInputs.length > 0
846
866
  ? $rawInputs
847
- : $inputs.filter(':not(i.close)')
848
- ).first()
867
+ : $module)
868
+ ).first()
849
869
  ;
850
- // check if only the close icon is remaining
851
- if ($input.length === 0 && $inputs.length > 0) {
852
- $input = $inputs.first();
853
- }
854
- if ($input.length > 0) {
855
- $input.trigger('focus');
856
- }
870
+ $input.trigger('focus');
857
871
  },
858
872
  dimmerStyles: function () {
859
873
  if (settings.blurring) {
@@ -1244,9 +1258,6 @@
1244
1258
  totalTime += data['Execution Time'];
1245
1259
  });
1246
1260
  title += ' ' + totalTime + 'ms';
1247
- if (moduleSelector) {
1248
- title += ' \'' + moduleSelector + '\'';
1249
- }
1250
1261
  if (performance.length > 0) {
1251
1262
  console.groupCollapsed(title);
1252
1263
  if (console.table) {
@@ -26,15 +26,25 @@
26
26
  $document = $(document),
27
27
  $body = $('body'),
28
28
 
29
- moduleSelector = $allModules.selector || '',
30
-
31
29
  time = Date.now(),
32
30
  performance = [],
33
31
 
34
32
  query = arguments[0],
35
33
  methodInvoked = typeof query === 'string',
36
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
+ }
44
+ }
37
45
 
46
+ return $context;
47
+ },
38
48
  returnedValue
39
49
  ;
40
50
 
@@ -54,7 +64,7 @@
54
64
  moduleNamespace = 'module-' + namespace,
55
65
 
56
66
  $module = $(this),
57
- $context = [window, document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $body,
67
+ $context = contextCheck(settings.context, window),
58
68
  isBody = $context[0] === $body[0],
59
69
  $closeIcon = $module.find(selector.closeIcon),
60
70
  $inputs,
@@ -78,6 +88,7 @@
78
88
  tempBodyMargin = '',
79
89
  keepScrollingClass = false,
80
90
  hadScrollbar = false,
91
+ windowRefocused = false,
81
92
 
82
93
  elementEventNamespace,
83
94
  id,
@@ -241,6 +252,7 @@
241
252
  .off(eventNamespace)
242
253
  ;
243
254
  $window.off(elementEventNamespace);
255
+ $context.off(elementEventNamespace);
244
256
  $dimmer.off(elementEventNamespace);
245
257
  $closeIcon.off(elementEventNamespace);
246
258
  if ($inputs) {
@@ -262,11 +274,12 @@
262
274
  return nodes;
263
275
  },
264
276
  shouldRefresh = false,
265
- shouldRefreshInputs = false
277
+ shouldRefreshInputs = false,
278
+ ignoreAutofocus = true
266
279
  ;
267
280
  mutations.every(function (mutation) {
268
281
  if (mutation.type === 'attributes') {
269
- if (observeAttributes && (mutation.attributeName === 'disabled' || $(mutation.target).find(':input').addBack(':input').length > 0)) {
282
+ if (observeAttributes && (mutation.attributeName === 'disabled' || $(mutation.target).find(':input').addBack(':input').filter(':visible').length > 0)) {
270
283
  shouldRefreshInputs = true;
271
284
  }
272
285
  } else {
@@ -277,6 +290,7 @@
277
290
  $removedInputs = $(collectNodes(mutation.removedNodes)).filter('a[href], [tabindex], :input');
278
291
  if ($addedInputs.length > 0 || $removedInputs.length > 0) {
279
292
  shouldRefreshInputs = true;
293
+ ignoreAutofocus = false;
280
294
  }
281
295
  }
282
296
 
@@ -288,7 +302,7 @@
288
302
  module.refresh();
289
303
  }
290
304
  if (shouldRefreshInputs) {
291
- module.refreshInputs();
305
+ module.refreshInputs(ignoreAutofocus);
292
306
  }
293
307
  });
294
308
  observer.observe(element, {
@@ -316,7 +330,7 @@
316
330
  $allModals = $otherModals.add($module);
317
331
  },
318
332
 
319
- refreshInputs: function () {
333
+ refreshInputs: function (ignoreAutofocus) {
320
334
  if ($inputs) {
321
335
  $inputs
322
336
  .off('keydown' + elementEventNamespace)
@@ -325,8 +339,8 @@
325
339
  $inputs = $module.find('a[href], [tabindex], :input:enabled').filter(':visible').filter(function () {
326
340
  return $(this).closest('.disabled').length === 0;
327
341
  });
328
- if ($inputs.length === 0) {
329
- $inputs = $module;
342
+ if ($inputs.filter(':input').length === 0) {
343
+ $inputs = $module.add($inputs);
330
344
  $module.attr('tabindex', -1);
331
345
  } else {
332
346
  $module.removeAttr('tabindex');
@@ -337,7 +351,7 @@
337
351
  $inputs.last()
338
352
  .on('keydown' + elementEventNamespace, module.event.inputKeyDown.last)
339
353
  ;
340
- if (settings.autofocus && $inputs.filter(':focus').length === 0) {
354
+ if (!ignoreAutofocus && settings.autofocus && $inputs.filter(':focus').length === 0) {
341
355
  module.set.autofocus();
342
356
  }
343
357
  },
@@ -375,6 +389,9 @@
375
389
  .on('resize' + elementEventNamespace, module.event.resize)
376
390
  .on('focus' + elementEventNamespace, module.event.focus)
377
391
  ;
392
+ $context
393
+ .on('click' + elementEventNamespace, module.event.click)
394
+ ;
378
395
  },
379
396
  scrollLock: function () {
380
397
  // touch events default to passive, due to changes in chrome to optimize mobile perf
@@ -532,9 +549,13 @@
532
549
  }
533
550
  },
534
551
  focus: function () {
535
- if ($dimmable.dimmer('is active') && module.is.active() && settings.autofocus) {
552
+ windowRefocused = true;
553
+ },
554
+ click: function (event) {
555
+ if (windowRefocused && document.activeElement !== event.target && $dimmable.dimmer('is active') && module.is.active() && settings.autofocus && $(document.activeElement).closest(selector.modal).length === 0) {
536
556
  requestAnimationFrame(module.set.autofocus);
537
557
  }
558
+ windowRefocused = false;
538
559
  },
539
560
  },
540
561
 
@@ -1044,20 +1065,14 @@
1044
1065
  var
1045
1066
  $autofocus = $inputs.filter('[autofocus]'),
1046
1067
  $rawInputs = $inputs.filter(':input'),
1047
- $input = $autofocus.length > 0
1048
- ? $autofocus.first()
1068
+ $input = ($autofocus.length > 0
1069
+ ? $autofocus
1049
1070
  : ($rawInputs.length > 0
1050
1071
  ? $rawInputs
1051
- : $inputs.filter(':not(i.close)')
1052
- ).first()
1072
+ : $module)
1073
+ ).first()
1053
1074
  ;
1054
- // check if only the close icon is remaining
1055
- if ($input.length === 0 && $inputs.length > 0) {
1056
- $input = $inputs.first();
1057
- }
1058
- if ($input.length > 0) {
1059
- $input.trigger('focus');
1060
- }
1075
+ $input.trigger('focus');
1061
1076
  },
1062
1077
  bodyMargin: function () {
1063
1078
  var position = module.can.leftBodyScrollbar() ? 'left' : 'right';
@@ -1271,9 +1286,6 @@
1271
1286
  totalTime += data['Execution Time'];
1272
1287
  });
1273
1288
  title += ' ' + totalTime + 'ms';
1274
- if (moduleSelector) {
1275
- title += ' \'' + moduleSelector + '\'';
1276
- }
1277
1289
  if (performance.length > 0) {
1278
1290
  console.groupCollapsed(title);
1279
1291
  if (console.table) {
@@ -22,7 +22,7 @@
22
22
  $.fn.nag = function (parameters) {
23
23
  var
24
24
  $allModules = $(this),
25
- moduleSelector = $allModules.selector || '',
25
+ $body = $('body'),
26
26
 
27
27
  time = Date.now(),
28
28
  performance = [],
@@ -30,6 +30,19 @@
30
30
  query = arguments[0],
31
31
  methodInvoked = typeof query === 'string',
32
32
  queryArguments = [].slice.call(arguments, 1),
33
+ contextCheck = function (context, win) {
34
+ var $context;
35
+ if ([window, document].indexOf(context) >= 0) {
36
+ $context = $(context);
37
+ } else {
38
+ $context = $(win.document).find(context);
39
+ if ($context.length === 0) {
40
+ $context = win.frameElement ? contextCheck(context, win.parent) : $body;
41
+ }
42
+ }
43
+
44
+ return $context;
45
+ },
33
46
  returnedValue
34
47
  ;
35
48
  $allModules.each(function () {
@@ -47,9 +60,7 @@
47
60
 
48
61
  $module = $(this),
49
62
 
50
- $context = settings.context
51
- ? ([window, document].indexOf(settings.context) < 0 ? $(document).find(settings.context) : $(settings.context))
52
- : $('body'),
63
+ $context = settings.context ? contextCheck(settings.context, window) : $body,
53
64
 
54
65
  element = this,
55
66
  instance = $module.data(moduleNamespace),
@@ -379,9 +390,6 @@
379
390
  totalTime += data['Execution Time'];
380
391
  });
381
392
  title += ' ' + totalTime + 'ms';
382
- if (moduleSelector) {
383
- title += ' \'' + moduleSelector + '\'';
384
- }
385
393
  if (performance.length > 0) {
386
394
  console.groupCollapsed(title);
387
395
  if (console.table) {
@@ -26,8 +26,6 @@
26
26
  $window = $(window),
27
27
  $body = $('body'),
28
28
 
29
- moduleSelector = $allModules.selector || '',
30
-
31
29
  clickEvent = 'ontouchstart' in document.documentElement
32
30
  ? 'touchstart'
33
31
  : 'click',
@@ -38,6 +36,19 @@
38
36
  query = arguments[0],
39
37
  methodInvoked = typeof query === 'string',
40
38
  queryArguments = [].slice.call(arguments, 1),
39
+ contextCheck = function (context, win) {
40
+ var $context;
41
+ if ([window, document].indexOf(context) >= 0) {
42
+ $context = $(context);
43
+ } else {
44
+ $context = $(win.document).find(context);
45
+ if ($context.length === 0) {
46
+ $context = win.frameElement ? contextCheck(context, win.parent) : $body;
47
+ }
48
+ }
49
+
50
+ return $context;
51
+ },
41
52
 
42
53
  returnedValue
43
54
  ;
@@ -57,12 +68,10 @@
57
68
  moduleNamespace = 'module-' + namespace,
58
69
 
59
70
  $module = $(this),
60
- $context = [window, document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $(settings.context),
61
- $scrollContext = [window, document].indexOf(settings.scrollContext) < 0 ? $document.find(settings.scrollContext) : $(settings.scrollContext),
62
- $boundary = [window, document].indexOf(settings.boundary) < 0 ? $document.find(settings.boundary) : $(settings.boundary),
63
- $target = settings.target
64
- ? ([window, document].indexOf(settings.target) < 0 ? $document.find(settings.target) : $(settings.target))
65
- : $module,
71
+ $context = contextCheck(settings.context, window),
72
+ $scrollContext = contextCheck(settings.scrollContext, window),
73
+ $boundary = contextCheck(settings.boundary, window),
74
+ $target = settings.target ? contextCheck(settings.target, window) : $module,
66
75
 
67
76
  $popup,
68
77
  $offsetParent,
@@ -1246,9 +1255,6 @@
1246
1255
  totalTime += data['Execution Time'];
1247
1256
  });
1248
1257
  title += ' ' + totalTime + 'ms';
1249
- if (moduleSelector) {
1250
- title += ' \'' + moduleSelector + '\'';
1251
- }
1252
1258
  if (performance.length > 0) {
1253
1259
  console.groupCollapsed(title);
1254
1260
  if (console.table) {
@@ -23,8 +23,6 @@
23
23
  var
24
24
  $allModules = $(this),
25
25
 
26
- moduleSelector = $allModules.selector || '',
27
-
28
26
  time = Date.now(),
29
27
  performance = [],
30
28
 
@@ -806,9 +804,6 @@
806
804
  totalTime += data['Execution Time'];
807
805
  });
808
806
  title += ' ' + totalTime + 'ms';
809
- if (moduleSelector) {
810
- title += ' \'' + moduleSelector + '\'';
811
- }
812
807
  if (performance.length > 0) {
813
808
  console.groupCollapsed(title);
814
809
  if (console.table) {
@@ -22,7 +22,6 @@
22
22
  $.fn.rating = function (parameters) {
23
23
  var
24
24
  $allModules = $(this),
25
- moduleSelector = $allModules.selector || '',
26
25
 
27
26
  time = Date.now(),
28
27
  performance = [],
@@ -382,9 +381,6 @@
382
381
  totalTime += data['Execution Time'];
383
382
  });
384
383
  title += ' ' + totalTime + 'ms';
385
- if (moduleSelector) {
386
- title += ' \'' + moduleSelector + '\'';
387
- }
388
384
  if ($allModules.length > 1) {
389
385
  title += ' (' + $allModules.length + ')';
390
386
  }
@@ -22,7 +22,6 @@
22
22
  $.fn.search = function (parameters) {
23
23
  var
24
24
  $allModules = $(this),
25
- moduleSelector = $allModules.selector || '',
26
25
 
27
26
  time = Date.now(),
28
27
  performance = [],
@@ -1184,9 +1183,6 @@
1184
1183
  totalTime += data['Execution Time'];
1185
1184
  });
1186
1185
  title += ' ' + totalTime + 'ms';
1187
- if (moduleSelector) {
1188
- title += ' \'' + moduleSelector + '\'';
1189
- }
1190
1186
  if ($allModules.length > 1) {
1191
1187
  title += ' (' + $allModules.length + ')';
1192
1188
  }
@@ -35,7 +35,6 @@
35
35
 
36
36
  $allModules.each(function () {
37
37
  var
38
- moduleSelector = $allModules.selector || '',
39
38
  settings = $.isPlainObject(parameters)
40
39
  ? $.extend(true, {}, $.fn.shape.settings, parameters)
41
40
  : $.extend({}, $.fn.shape.settings),
@@ -637,9 +636,6 @@
637
636
  totalTime += data['Execution Time'];
638
637
  });
639
638
  title += ' ' + totalTime + 'ms';
640
- if (moduleSelector) {
641
- title += ' \'' + moduleSelector + '\'';
642
- }
643
639
  if ($allModules.length > 1) {
644
640
  title += ' (' + $allModules.length + ')';
645
641
  }
@@ -28,15 +28,25 @@
28
28
  $html = $('html'),
29
29
  $head = $('head'),
30
30
 
31
- moduleSelector = $allModules.selector || '',
32
-
33
31
  time = Date.now(),
34
32
  performance = [],
35
33
 
36
34
  query = arguments[0],
37
35
  methodInvoked = typeof query === 'string',
38
36
  queryArguments = [].slice.call(arguments, 1),
37
+ contextCheck = function (context, win) {
38
+ var $context;
39
+ if ([window, document].indexOf(context) >= 0) {
40
+ $context = $body;
41
+ } else {
42
+ $context = $(win.document).find(context);
43
+ if ($context.length === 0) {
44
+ $context = win.frameElement ? contextCheck(context, win.parent) : $body;
45
+ }
46
+ }
39
47
 
48
+ return $context;
49
+ },
40
50
  returnedValue;
41
51
 
42
52
  $allModules.each(function () {
@@ -55,7 +65,7 @@
55
65
  moduleNamespace = 'module-' + namespace,
56
66
 
57
67
  $module = $(this),
58
- $context = [window, document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $body,
68
+ $context = contextCheck(settings.context, window),
59
69
  isBody = $context[0] === $body[0],
60
70
 
61
71
  $sidebars = $module.children(selector.sidebar),
@@ -277,7 +287,7 @@
277
287
 
278
288
  refresh: function () {
279
289
  module.verbose('Refreshing selector cache');
280
- $context = [window, document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $body;
290
+ $context = contextCheck(settings.context, window);
281
291
  module.refreshSidebars();
282
292
  $pusher = $context.children(selector.pusher);
283
293
  $fixed = $context.children(selector.fixed);
@@ -901,9 +911,6 @@
901
911
  totalTime += data['Execution Time'];
902
912
  });
903
913
  title += ' ' + totalTime + 'ms';
904
- if (moduleSelector) {
905
- title += ' \'' + moduleSelector + '\'';
906
- }
907
914
  if (performance.length > 0) {
908
915
  console.groupCollapsed(title);
909
916
  if (console.table) {
@@ -25,8 +25,6 @@
25
25
  $document = $(document),
26
26
  $window = $(window),
27
27
 
28
- moduleSelector = $allModules.selector || '',
29
-
30
28
  time = Date.now(),
31
29
  performance = [],
32
30
 
@@ -1191,9 +1189,6 @@
1191
1189
  totalTime += data['Execution Time'];
1192
1190
  });
1193
1191
  title += ' ' + totalTime + 'ms';
1194
- if (moduleSelector) {
1195
- title += ' \'' + moduleSelector + '\'';
1196
- }
1197
1192
  if (performance.length > 0) {
1198
1193
  console.groupCollapsed(title);
1199
1194
  if (console.table) {
@@ -23,7 +23,6 @@
23
23
  var
24
24
  $allModules = $(this),
25
25
  $document = $(document),
26
- moduleSelector = $allModules.selector || '',
27
26
 
28
27
  time = Date.now(),
29
28
  performance = [],
@@ -31,6 +30,19 @@
31
30
  query = arguments[0],
32
31
  methodInvoked = typeof query === 'string',
33
32
  queryArguments = [].slice.call(arguments, 1),
33
+ contextCheck = function (context, win) {
34
+ var $context;
35
+ if ([window, document].indexOf(context) >= 0) {
36
+ $context = $(context);
37
+ } else {
38
+ $context = $(win.document).find(context);
39
+ if ($context.length === 0) {
40
+ $context = win.frameElement ? contextCheck(context, win.parent) : window;
41
+ }
42
+ }
43
+
44
+ return $context;
45
+ },
34
46
  returnedValue
35
47
  ;
36
48
 
@@ -49,7 +61,7 @@
49
61
 
50
62
  $module = $(this),
51
63
  $window = $(window),
52
- $scroll = [window, document].indexOf(settings.scrollContext) < 0 ? $document.find(settings.scrollContext) : $(settings.scrollContext),
64
+ $scroll = contextCheck(settings.scrollContext, window),
53
65
  $container,
54
66
  $context,
55
67
 
@@ -127,19 +139,11 @@
127
139
  },
128
140
 
129
141
  determineContainer: function () {
130
- if (settings.container) {
131
- $container = [window, document].indexOf(settings.container) < 0 ? $document.find(settings.container) : $(settings.container);
132
- } else {
133
- $container = $module.offsetParent();
134
- }
142
+ $container = settings.container ? contextCheck(settings.container, window) : $module.offsetParent();
135
143
  },
136
144
 
137
145
  determineContext: function () {
138
- if (settings.context) {
139
- $context = [window, document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $(settings.context);
140
- } else {
141
- $context = $container;
142
- }
146
+ $context = settings.context ? contextCheck(settings.context, window) : $container;
143
147
  if ($context.length === 0) {
144
148
  module.error(error.invalidContext, settings.context, $module);
145
149
  }
@@ -755,9 +759,6 @@
755
759
  totalTime += data['Execution Time'];
756
760
  });
757
761
  title += ' ' + totalTime + 'ms';
758
- if (moduleSelector) {
759
- title += ' \'' + moduleSelector + '\'';
760
- }
761
762
  if (performance.length > 0) {
762
763
  console.groupCollapsed(title);
763
764
  if (console.table) {