fomantic-ui-sass 2.9.1 → 2.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/app/assets/fonts/semantic-ui/Lato-Bold.woff +0 -0
  4. data/app/assets/fonts/semantic-ui/Lato-Bold.woff2 +0 -0
  5. data/app/assets/fonts/semantic-ui/Lato-BoldItalic.woff +0 -0
  6. data/app/assets/fonts/semantic-ui/Lato-BoldItalic.woff2 +0 -0
  7. data/app/assets/fonts/semantic-ui/Lato-Italic.woff +0 -0
  8. data/app/assets/fonts/semantic-ui/Lato-Italic.woff2 +0 -0
  9. data/app/assets/fonts/semantic-ui/Lato-Regular.woff +0 -0
  10. data/app/assets/fonts/semantic-ui/Lato-Regular.woff2 +0 -0
  11. data/app/assets/fonts/semantic-ui/LatoLatin-Bold.woff +0 -0
  12. data/app/assets/fonts/semantic-ui/LatoLatin-Bold.woff2 +0 -0
  13. data/app/assets/fonts/semantic-ui/LatoLatin-BoldItalic.woff +0 -0
  14. data/app/assets/fonts/semantic-ui/LatoLatin-BoldItalic.woff2 +0 -0
  15. data/app/assets/fonts/semantic-ui/LatoLatin-Italic.woff +0 -0
  16. data/app/assets/fonts/semantic-ui/LatoLatin-Italic.woff2 +0 -0
  17. data/app/assets/fonts/semantic-ui/LatoLatin-Regular.woff +0 -0
  18. data/app/assets/fonts/semantic-ui/LatoLatin-Regular.woff2 +0 -0
  19. data/app/assets/javascripts/semantic-ui/accordion.js +4 -8
  20. data/app/assets/javascripts/semantic-ui/api.js +22 -15
  21. data/app/assets/javascripts/semantic-ui/calendar.js +1 -6
  22. data/app/assets/javascripts/semantic-ui/checkbox.js +4 -6
  23. data/app/assets/javascripts/semantic-ui/dimmer.js +3 -7
  24. data/app/assets/javascripts/semantic-ui/dropdown.js +58 -35
  25. data/app/assets/javascripts/semantic-ui/embed.js +2 -7
  26. data/app/assets/javascripts/semantic-ui/flyout.js +56 -86
  27. data/app/assets/javascripts/semantic-ui/form.js +216 -157
  28. data/app/assets/javascripts/semantic-ui/modal.js +58 -39
  29. data/app/assets/javascripts/semantic-ui/nag.js +17 -9
  30. data/app/assets/javascripts/semantic-ui/popup.js +46 -26
  31. data/app/assets/javascripts/semantic-ui/progress.js +3 -34
  32. data/app/assets/javascripts/semantic-ui/rating.js +1 -5
  33. data/app/assets/javascripts/semantic-ui/search.js +5 -8
  34. data/app/assets/javascripts/semantic-ui/shape.js +15 -41
  35. data/app/assets/javascripts/semantic-ui/sidebar.js +21 -64
  36. data/app/assets/javascripts/semantic-ui/site.js +1 -1
  37. data/app/assets/javascripts/semantic-ui/slider.js +130 -34
  38. data/app/assets/javascripts/semantic-ui/state.js +23 -20
  39. data/app/assets/javascripts/semantic-ui/sticky.js +17 -16
  40. data/app/assets/javascripts/semantic-ui/tab.js +18 -8
  41. data/app/assets/javascripts/semantic-ui/toast.js +19 -11
  42. data/app/assets/javascripts/semantic-ui/transition.js +11 -66
  43. data/app/assets/javascripts/semantic-ui/visibility.js +15 -6
  44. data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +1 -1
  45. data/app/assets/stylesheets/semantic-ui/collections/_form.scss +118 -56
  46. data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +113 -107
  47. data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +39 -9
  48. data/app/assets/stylesheets/semantic-ui/collections/_message.scss +1 -1
  49. data/app/assets/stylesheets/semantic-ui/collections/_table.scss +66 -2
  50. data/app/assets/stylesheets/semantic-ui/elements/_button.scss +2 -2
  51. data/app/assets/stylesheets/semantic-ui/elements/_container.scss +62 -1
  52. data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +1 -1
  53. data/app/assets/stylesheets/semantic-ui/elements/_emoji.scss +698 -250
  54. data/app/assets/stylesheets/semantic-ui/elements/_flag.scss +3 -2
  55. data/app/assets/stylesheets/semantic-ui/elements/_header.scss +1 -1
  56. data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +62 -62
  57. data/app/assets/stylesheets/semantic-ui/elements/_image.scss +1 -1
  58. data/app/assets/stylesheets/semantic-ui/elements/_input.scss +61 -51
  59. data/app/assets/stylesheets/semantic-ui/elements/_label.scss +21 -2
  60. data/app/assets/stylesheets/semantic-ui/elements/_list.scss +13 -13
  61. data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +282 -282
  62. data/app/assets/stylesheets/semantic-ui/elements/_placeholder.scss +1 -1
  63. data/app/assets/stylesheets/semantic-ui/elements/_rail.scss +1 -1
  64. data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +1 -1
  65. data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +186 -37
  66. data/app/assets/stylesheets/semantic-ui/elements/_step.scss +4 -4
  67. data/app/assets/stylesheets/semantic-ui/elements/_text.scss +2 -2
  68. data/app/assets/stylesheets/semantic-ui/globals/_reset.scss +1 -1
  69. data/app/assets/stylesheets/semantic-ui/globals/_site.scss +1 -10
  70. data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +1 -1
  71. data/app/assets/stylesheets/semantic-ui/modules/_calendar.scss +145 -8
  72. data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +89 -45
  73. data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +3 -3
  74. data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +126 -31
  75. data/app/assets/stylesheets/semantic-ui/modules/_embed.scss +2 -2
  76. data/app/assets/stylesheets/semantic-ui/modules/_flyout.scss +1 -1
  77. data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +10 -3
  78. data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +1 -1
  79. data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +188 -42
  80. data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +1 -1
  81. data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +1 -1
  82. data/app/assets/stylesheets/semantic-ui/modules/_search.scss +26 -1
  83. data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +1 -1
  84. data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +1 -1
  85. data/app/assets/stylesheets/semantic-ui/modules/_slider.scss +9 -6
  86. data/app/assets/stylesheets/semantic-ui/modules/_sticky.scss +1 -1
  87. data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +1 -1
  88. data/app/assets/stylesheets/semantic-ui/modules/_toast.scss +6 -1
  89. data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +1 -1
  90. data/app/assets/stylesheets/semantic-ui/views/_ad.scss +1 -1
  91. data/app/assets/stylesheets/semantic-ui/views/_card.scss +1 -1
  92. data/app/assets/stylesheets/semantic-ui/views/_comment.scss +6 -1
  93. data/app/assets/stylesheets/semantic-ui/views/_feed.scss +486 -5
  94. data/app/assets/stylesheets/semantic-ui/views/_item.scss +7 -2
  95. data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +1 -1
  96. data/lib/fomantic/ui/sass/version.rb +2 -2
  97. metadata +1 -1
@@ -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
 
@@ -105,9 +103,7 @@
105
103
  module.setup.layout();
106
104
  module.setup.labels();
107
105
 
108
- if (!module.is.disabled()) {
109
- module.bind.events();
110
- }
106
+ module.bind.events();
111
107
 
112
108
  module.read.metadata();
113
109
  module.read.settings();
@@ -139,20 +135,32 @@
139
135
  $module.attr('tabindex', 0);
140
136
  }
141
137
  if ($module.find('.inner').length === 0) {
142
- $module.append("<div class='inner'>"
143
- + "<div class='track'></div>"
144
- + "<div class='track-fill'></div>"
145
- + "<div class='thumb'></div>"
138
+ $module.append('<div class="inner">'
139
+ + '<div class="track"></div>'
140
+ + '<div class="track-fill"></div>'
141
+ + '<div class="thumb"></div>'
146
142
  + '</div>');
147
143
  }
148
144
  precision = module.get.precision();
149
145
  $thumb = $module.find('.thumb:not(.second)');
146
+ if (settings.showThumbTooltip) {
147
+ $thumb
148
+ .attr('data-position', settings.tooltipConfig.position)
149
+ .attr('data-variation', settings.tooltipConfig.variation)
150
+ ;
151
+ }
150
152
  $currThumb = $thumb;
151
153
  if (module.is.range()) {
152
154
  if ($module.find('.thumb.second').length === 0) {
153
- $module.find('.inner').append("<div class='thumb second'></div>");
155
+ $module.find('.inner').append('<div class="thumb second"></div>');
154
156
  }
155
157
  $secondThumb = $module.find('.thumb.second');
158
+ if (settings.showThumbTooltip) {
159
+ $secondThumb
160
+ .attr('data-position', settings.tooltipConfig.position)
161
+ .attr('data-variation', settings.tooltipConfig.variation)
162
+ ;
163
+ }
156
164
  }
157
165
  $track = $module.find('.track');
158
166
  $trackFill = $module.find('.track-fill');
@@ -206,9 +214,10 @@
206
214
  for (var i = 0, len = module.get.numLabels(); i <= len; i++) {
207
215
  var
208
216
  labelText = module.get.label(i),
209
- $label = labelText !== ''
217
+ showLabel = settings.restrictedLabels.length === 0 || settings.restrictedLabels.indexOf(labelText) >= 0,
218
+ $label = labelText !== '' && (showLabel || settings.showLabelTicks === 'always')
210
219
  ? (!(i % module.get.gapRatio())
211
- ? $('<li class="label">' + labelText + '</li>')
220
+ ? $('<li class="label">' + (showLabel ? labelText : '') + '</li>')
212
221
  : $('<li class="halftick label"></li>'))
213
222
  : null,
214
223
  ratio = i / len
@@ -352,6 +361,18 @@
352
361
  ;
353
362
  $currThumb = initialPosition > newPos ? $thumb : $secondThumb;
354
363
  }
364
+ if (module.is.range() && (settings.minRange || settings.maxRange)) {
365
+ var currentRangeDiff = module.get.currentRangeDiff(value),
366
+ isSecondThumb = $currThumb.hasClass('second')
367
+ ;
368
+ if ((settings.minRange && currentRangeDiff < settings.minRange)
369
+ || (settings.maxRange && currentRangeDiff > settings.maxRange)
370
+ || (settings.preventCrossover && !isSecondThumb && value > module.secondThumbVal)
371
+ || (settings.preventCrossover && isSecondThumb && value < module.thumbVal)
372
+ ) {
373
+ return;
374
+ }
375
+ }
355
376
  if (module.get.step() === 0 || module.is.smooth()) {
356
377
  var
357
378
  thumbVal = module.thumbVal,
@@ -387,6 +408,17 @@
387
408
  return;
388
409
  }
389
410
  var value = module.determine.valueFromEvent(event);
411
+ if (module.is.range() && (settings.minRange || settings.maxRange)) {
412
+ if ($currThumb === undefined) {
413
+ $currThumb = value <= module.get.currentThumbValue() ? $thumb : $secondThumb;
414
+ }
415
+ var currentRangeDiff = module.get.currentRangeDiff(value);
416
+ if (settings.minRange && currentRangeDiff < settings.minRange) {
417
+ value = module.get.edgeValue(value, settings.minRange);
418
+ } else if (settings.maxRange && currentRangeDiff > settings.maxRange) {
419
+ value = module.get.edgeValue(value, settings.maxRange);
420
+ }
421
+ }
390
422
  module.set.value(value);
391
423
  module.unbind.slidingEvents();
392
424
  touchIdentifier = undefined;
@@ -403,6 +435,9 @@
403
435
  }
404
436
  },
405
437
  keydown: function (event, first) {
438
+ if (module.is.disabled()) {
439
+ return;
440
+ }
406
441
  if (settings.preventCrossover && module.is.range() && module.thumbVal === module.secondThumbVal) {
407
442
  $currThumb = undefined;
408
443
  }
@@ -439,7 +474,7 @@
439
474
  }
440
475
  },
441
476
  activateFocus: function (event) {
442
- if (!module.is.focused() && module.is.hover() && module.determine.keyMovement(event) !== NO_STEP) {
477
+ if (!module.is.disabled() && !module.is.focused() && module.is.hover() && module.determine.keyMovement(event) !== NO_STEP) {
443
478
  event.preventDefault();
444
479
  module.event.keydown(event, true);
445
480
  $module.trigger('focus');
@@ -504,7 +539,13 @@
504
539
 
505
540
  is: {
506
541
  range: function () {
507
- return $module.hasClass(settings.className.range);
542
+ var isRange = $module.hasClass(className.range);
543
+ if (!isRange && (settings.minRange || settings.maxRange)) {
544
+ $module.addClass(className.range);
545
+ isRange = true;
546
+ }
547
+
548
+ return isRange;
508
549
  },
509
550
  hover: function () {
510
551
  return isHover;
@@ -513,23 +554,56 @@
513
554
  return $module.is(':focus');
514
555
  },
515
556
  disabled: function () {
516
- return $module.hasClass(settings.className.disabled);
557
+ return $module.hasClass(className.disabled);
517
558
  },
518
559
  labeled: function () {
519
- return $module.hasClass(settings.className.labeled);
560
+ var isLabeled = $module.hasClass(className.labeled);
561
+ if (!isLabeled && (settings.restrictedLabels.length > 0 || settings.showLabelTicks !== false)) {
562
+ $module.addClass(className.labeled);
563
+ isLabeled = true;
564
+ }
565
+
566
+ return isLabeled;
520
567
  },
521
568
  reversed: function () {
522
- return $module.hasClass(settings.className.reversed);
569
+ return $module.hasClass(className.reversed);
523
570
  },
524
571
  vertical: function () {
525
- return $module.hasClass(settings.className.vertical);
572
+ return $module.hasClass(className.vertical);
526
573
  },
527
574
  smooth: function () {
528
- return settings.smooth || $module.hasClass(settings.className.smooth);
575
+ return settings.smooth || $module.hasClass(className.smooth);
529
576
  },
530
577
  },
531
578
 
532
579
  get: {
580
+ currentRangeDiff: function (value) {
581
+ var currentRangeDiff;
582
+ if ($currThumb.hasClass('second')) {
583
+ currentRangeDiff = module.thumbVal < value
584
+ ? value - module.thumbVal
585
+ : module.thumbVal - value;
586
+ } else {
587
+ currentRangeDiff = module.secondThumbVal > value
588
+ ? module.secondThumbVal - value
589
+ : value - module.secondThumbVal;
590
+ }
591
+
592
+ return currentRangeDiff;
593
+ },
594
+ edgeValue: function (value, edgeValue) {
595
+ if ($currThumb.hasClass('second')) {
596
+ value = module.thumbVal < value
597
+ ? module.thumbVal + edgeValue
598
+ : module.thumbVal - edgeValue;
599
+ } else {
600
+ value = module.secondThumbVal < value
601
+ ? module.secondThumbVal + edgeValue
602
+ : module.secondThumbVal - edgeValue;
603
+ }
604
+
605
+ return value;
606
+ },
533
607
  trackOffset: function () {
534
608
  if (module.is.vertical()) {
535
609
  return $track.offset().top;
@@ -600,7 +674,8 @@
600
674
  var
601
675
  step = module.get.step(),
602
676
  min = module.get.min(),
603
- quotient = step === 0 ? 0 : Math.floor((settings.max - min) / step),
677
+ precision = module.get.precision(),
678
+ quotient = step === 0 ? 0 : Math.floor(Math.round(((settings.max - min) / step) * precision) / precision),
604
679
  remainder = step === 0 ? 0 : (settings.max - min) % step
605
680
  ;
606
681
 
@@ -610,7 +685,9 @@
610
685
  return settings.step;
611
686
  },
612
687
  numLabels: function () {
613
- var value = Math.round((module.get.max() - module.get.min()) / (module.get.step() === 0 ? 1 : module.get.step()));
688
+ var step = module.get.step(),
689
+ precision = module.get.precision(),
690
+ value = Math.round(((module.get.max() - module.get.min()) / (step === 0 ? 1 : step)) * precision) / precision;
614
691
  module.debug('Determined that there should be ' + value + ' labels');
615
692
 
616
693
  return value;
@@ -625,7 +702,9 @@
625
702
 
626
703
  switch (settings.labelType) {
627
704
  case settings.labelTypes.number: {
628
- return Math.round(((value * (module.get.step() === 0 ? 1 : module.get.step())) + module.get.min()) * precision) / precision;
705
+ var step = module.get.step();
706
+
707
+ return Math.round(((value * (step === 0 ? 1 : step)) + module.get.min()) * precision) / precision;
629
708
  }
630
709
  case settings.labelTypes.letter: {
631
710
  return alphabet[value % 26];
@@ -733,13 +812,10 @@
733
812
  return thumbDelta <= secondThumbDelta ? thumbPos : secondThumbPos;
734
813
  },
735
814
  thumbPos: function ($element) {
736
- var
737
- pos = module.is.vertical()
738
- ? (module.is.reversed() ? $element.css('bottom') : $element.css('top'))
739
- : (module.is.reversed() ? $element.css('right') : $element.css('left'))
815
+ return module.is.vertical()
816
+ ? (module.is.reversed() ? $element.css('bottom') : $element.css('top'))
817
+ : (module.is.reversed() ? $element.css('right') : $element.css('left'))
740
818
  ;
741
-
742
- return pos;
743
819
  },
744
820
  positionFromValue: function (val) {
745
821
  var
@@ -763,6 +839,7 @@
763
839
  position = Math.round(ratio * trackLength),
764
840
  adjustedPos = step === 0 ? position : Math.round(position / step) * step
765
841
  ;
842
+ module.verbose('Determined position: ' + position + ' from ratio: ' + ratio);
766
843
 
767
844
  return adjustedPos;
768
845
  },
@@ -986,12 +1063,12 @@
986
1063
  }
987
1064
  if (!$currThumb.hasClass('second')) {
988
1065
  if (settings.preventCrossover && module.is.range()) {
989
- newValue = Math.min(module.secondThumbVal, newValue);
1066
+ newValue = Math.min(module.secondThumbVal - (settings.minRange || 0), newValue);
990
1067
  }
991
1068
  module.thumbVal = newValue;
992
1069
  } else {
993
1070
  if (settings.preventCrossover && module.is.range()) {
994
- newValue = Math.max(module.thumbVal, newValue);
1071
+ newValue = Math.max(module.thumbVal + (settings.minRange || 0), newValue);
995
1072
  }
996
1073
  module.secondThumbVal = newValue;
997
1074
  }
@@ -1010,6 +1087,10 @@
1010
1087
  thumbVal = module.thumbVal || module.get.min(),
1011
1088
  secondThumbVal = module.secondThumbVal || module.get.min()
1012
1089
  ;
1090
+ if (settings.showThumbTooltip) {
1091
+ var precision = module.get.precision();
1092
+ $targetThumb.attr('data-tooltip', Math.round(newValue * precision) / precision);
1093
+ }
1013
1094
  if (module.is.range()) {
1014
1095
  if (!$targetThumb.hasClass('second')) {
1015
1096
  position = newPos;
@@ -1098,6 +1179,14 @@
1098
1179
  settings: function () {
1099
1180
  if (settings.start !== false) {
1100
1181
  if (module.is.range()) {
1182
+ var rangeDiff = settings.end - settings.start;
1183
+ if (rangeDiff < 0
1184
+ || (settings.minRange && rangeDiff < settings.minRange)
1185
+ || (settings.maxRange && rangeDiff > settings.maxRange)
1186
+ || (settings.minRange && settings.maxRange && settings.minRange > settings.maxRange)
1187
+ ) {
1188
+ module.error(error.invalidRanges, settings.start, settings.end, settings.minRange, settings.maxRange);
1189
+ }
1101
1190
  module.debug('Start position set from settings', settings.start, settings.end);
1102
1191
  module.set.rangeValue(settings.start, settings.end);
1103
1192
  } else {
@@ -1178,7 +1267,7 @@
1178
1267
  });
1179
1268
  }
1180
1269
  clearTimeout(module.performance.timer);
1181
- module.performance.timer = setTimeout(module.performance.display, 500);
1270
+ module.performance.timer = setTimeout(function () { module.performance.display(); }, 500);
1182
1271
  },
1183
1272
  display: function () {
1184
1273
  var
@@ -1191,9 +1280,6 @@
1191
1280
  totalTime += data['Execution Time'];
1192
1281
  });
1193
1282
  title += ' ' + totalTime + 'ms';
1194
- if (moduleSelector) {
1195
- title += ' \'' + moduleSelector + '\'';
1196
- }
1197
1283
  if (performance.length > 0) {
1198
1284
  console.groupCollapsed(title);
1199
1285
  if (console.table) {
@@ -1293,6 +1379,7 @@
1293
1379
  error: {
1294
1380
  method: 'The method you called is not defined.',
1295
1381
  notrange: 'This slider is not a range slider',
1382
+ invalidRanges: 'Invalid range settings (start/end/minRange/maxRange)',
1296
1383
  },
1297
1384
 
1298
1385
  metadata: {
@@ -1305,6 +1392,8 @@
1305
1392
  step: 1,
1306
1393
  start: 0,
1307
1394
  end: 20,
1395
+ minRange: false,
1396
+ maxRange: false,
1308
1397
  labelType: 'number',
1309
1398
  showLabelTicks: false,
1310
1399
  smooth: false,
@@ -1341,6 +1430,13 @@
1341
1430
  downArrow: 40,
1342
1431
  },
1343
1432
 
1433
+ restrictedLabels: [],
1434
+ showThumbTooltip: false,
1435
+ tooltipConfig: {
1436
+ position: 'top center',
1437
+ variation: 'tiny black',
1438
+ },
1439
+
1344
1440
  labelTypes: {
1345
1441
  number: 'number',
1346
1442
  letter: 'letter',
@@ -23,15 +23,25 @@
23
23
  var
24
24
  $allModules = $(this),
25
25
 
26
- moduleSelector = $allModules.selector || '',
27
-
28
26
  time = Date.now(),
29
27
  performance = [],
30
28
 
31
29
  query = arguments[0],
32
30
  methodInvoked = typeof query === 'string',
33
31
  queryArguments = [].slice.call(arguments, 1),
32
+ contextCheck = function (context, win) {
33
+ var $context;
34
+ if ([window, document].indexOf(context) >= 0) {
35
+ $context = $(context);
36
+ } else {
37
+ $context = $(win.document).find(context);
38
+ if ($context.length === 0) {
39
+ $context = win.frameElement ? contextCheck(context, win.parent) : window;
40
+ }
41
+ }
34
42
 
43
+ return $context;
44
+ },
35
45
  returnedValue
36
46
  ;
37
47
  $allModules.each(function () {
@@ -51,6 +61,7 @@
51
61
  moduleNamespace = namespace + '-module',
52
62
 
53
63
  $module = $(this),
64
+ $context = settings.context ? contextCheck(settings.context, window) : $module,
54
65
 
55
66
  element = this,
56
67
  instance = $module.data(moduleNamespace),
@@ -68,19 +79,11 @@
68
79
  }
69
80
 
70
81
  // bind events with delegated events
71
- if (settings.context && moduleSelector !== '') {
72
- ([window, document].indexOf(settings.context) < 0 ? $(document).find(settings.context) : $(settings.context))
73
- .on(moduleSelector, 'mouseenter' + eventNamespace, module.change.text)
74
- .on(moduleSelector, 'mouseleave' + eventNamespace, module.reset.text)
75
- .on(moduleSelector, 'click' + eventNamespace, module.toggle.state)
76
- ;
77
- } else {
78
- $module
79
- .on('mouseenter' + eventNamespace, module.change.text)
80
- .on('mouseleave' + eventNamespace, module.reset.text)
81
- .on('click' + eventNamespace, module.toggle.state)
82
- ;
83
- }
82
+ $context
83
+ .on('mouseenter' + eventNamespace, module.change.text)
84
+ .on('mouseleave' + eventNamespace, module.reset.text)
85
+ .on('click' + eventNamespace, module.toggle.state)
86
+ ;
84
87
  module.instantiate();
85
88
  },
86
89
 
@@ -94,8 +97,11 @@
94
97
 
95
98
  destroy: function () {
96
99
  module.verbose('Destroying previous module', instance);
97
- $module
100
+ $context
98
101
  .off(eventNamespace)
102
+ ;
103
+ $module
104
+ .removeData(metadata.storedText)
99
105
  .removeData(moduleNamespace)
100
106
  ;
101
107
  },
@@ -476,7 +482,7 @@
476
482
  });
477
483
  }
478
484
  clearTimeout(module.performance.timer);
479
- module.performance.timer = setTimeout(module.performance.display, 500);
485
+ module.performance.timer = setTimeout(function () { module.performance.display(); }, 500);
480
486
  },
481
487
  display: function () {
482
488
  var
@@ -489,9 +495,6 @@
489
495
  totalTime += data['Execution Time'];
490
496
  });
491
497
  title += ' ' + totalTime + 'ms';
492
- if (moduleSelector) {
493
- title += ' \'' + moduleSelector + '\'';
494
- }
495
498
  if (performance.length > 0) {
496
499
  console.groupCollapsed(title);
497
500
  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
  }
@@ -742,7 +746,7 @@
742
746
  });
743
747
  }
744
748
  clearTimeout(module.performance.timer);
745
- module.performance.timer = setTimeout(module.performance.display, 0);
749
+ module.performance.timer = setTimeout(function () { module.performance.display(); }, 0);
746
750
  },
747
751
  display: function () {
748
752
  var
@@ -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) {
@@ -30,14 +30,25 @@
30
30
  ? $(window)
31
31
  : $(this),
32
32
  $document = $(document),
33
- moduleSelector = $allModules.selector || '',
34
33
  time = Date.now(),
35
34
  performance = [],
36
35
 
37
36
  query = arguments[0],
38
37
  methodInvoked = typeof query === 'string',
39
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) : window;
47
+ }
48
+ }
40
49
 
50
+ return $context;
51
+ },
41
52
  initializedHistory = false,
42
53
  returnedValue
43
54
  ;
@@ -88,7 +99,7 @@
88
99
  module.bind.events();
89
100
 
90
101
  if (settings.history && !initializedHistory) {
91
- module.initializeHistory();
102
+ settings.history = module.initializeHistory();
92
103
  initializedHistory = true;
93
104
  }
94
105
 
@@ -98,7 +109,7 @@
98
109
  module.debug('No active tab detected, setting tab active', activeTab);
99
110
  module.changeTab(activeTab);
100
111
  }
101
- if (activeTab !== null && settings.history) {
112
+ if (activeTab !== null && settings.history && settings.historyType === 'state') {
102
113
  var autoUpdate = $.address.autoUpdate();
103
114
  $.address.autoUpdate(false);
104
115
  $.address.value(activeTab);
@@ -152,7 +163,7 @@
152
163
  $context = $reference.parent();
153
164
  module.verbose('Determined parent element for creating context', $context);
154
165
  } else if (settings.context) {
155
- $context = [window, document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $(settings.context);
166
+ $context = contextCheck(settings.context, window);
156
167
  module.verbose('Using selector for tab context', settings.context, $context);
157
168
  } else {
158
169
  $context = $('body');
@@ -191,6 +202,8 @@
191
202
  $.address
192
203
  .bind('change', module.event.history.change)
193
204
  ;
205
+
206
+ return true;
194
207
  },
195
208
 
196
209
  event: {
@@ -775,7 +788,7 @@
775
788
  });
776
789
  }
777
790
  clearTimeout(module.performance.timer);
778
- module.performance.timer = setTimeout(module.performance.display, 500);
791
+ module.performance.timer = setTimeout(function () { module.performance.display(); }, 500);
779
792
  },
780
793
  display: function () {
781
794
  var
@@ -788,9 +801,6 @@
788
801
  totalTime += data['Execution Time'];
789
802
  });
790
803
  title += ' ' + totalTime + 'ms';
791
- if (moduleSelector) {
792
- title += ' \'' + moduleSelector + '\'';
793
- }
794
804
  if (performance.length > 0) {
795
805
  console.groupCollapsed(title);
796
806
  if (console.table) {