fomantic-ui-sass 2.8.8.1 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/app/assets/fonts/semantic-ui/brand-icons.eot +0 -0
  4. data/app/assets/fonts/semantic-ui/brand-icons.svg +41 -6
  5. data/app/assets/fonts/semantic-ui/brand-icons.ttf +0 -0
  6. data/app/assets/fonts/semantic-ui/brand-icons.woff +0 -0
  7. data/app/assets/fonts/semantic-ui/brand-icons.woff2 +0 -0
  8. data/app/assets/fonts/semantic-ui/icons.eot +0 -0
  9. data/app/assets/fonts/semantic-ui/icons.svg +245 -7
  10. data/app/assets/fonts/semantic-ui/icons.ttf +0 -0
  11. data/app/assets/fonts/semantic-ui/icons.woff +0 -0
  12. data/app/assets/fonts/semantic-ui/icons.woff2 +0 -0
  13. data/app/assets/fonts/semantic-ui/outline-icons.eot +0 -0
  14. data/app/assets/fonts/semantic-ui/outline-icons.svg +2 -2
  15. data/app/assets/fonts/semantic-ui/outline-icons.ttf +0 -0
  16. data/app/assets/fonts/semantic-ui/outline-icons.woff +0 -0
  17. data/app/assets/fonts/semantic-ui/outline-icons.woff2 +0 -0
  18. data/app/assets/javascripts/semantic-ui/accordion.js +9 -3
  19. data/app/assets/javascripts/semantic-ui/api.js +92 -33
  20. data/app/assets/javascripts/semantic-ui/calendar.js +200 -82
  21. data/app/assets/javascripts/semantic-ui/checkbox.js +20 -13
  22. data/app/assets/javascripts/semantic-ui/dimmer.js +24 -9
  23. data/app/assets/javascripts/semantic-ui/dropdown.js +250 -205
  24. data/app/assets/javascripts/semantic-ui/embed.js +13 -9
  25. data/app/assets/javascripts/semantic-ui/flyout.js +1530 -0
  26. data/app/assets/javascripts/semantic-ui/form.js +47 -41
  27. data/app/assets/javascripts/semantic-ui/modal.js +187 -83
  28. data/app/assets/javascripts/semantic-ui/nag.js +2 -2
  29. data/app/assets/javascripts/semantic-ui/popup.js +16 -22
  30. data/app/assets/javascripts/semantic-ui/progress.js +7 -4
  31. data/app/assets/javascripts/semantic-ui/rating.js +7 -3
  32. data/app/assets/javascripts/semantic-ui/search.js +47 -20
  33. data/app/assets/javascripts/semantic-ui/shape.js +3 -3
  34. data/app/assets/javascripts/semantic-ui/sidebar.js +140 -43
  35. data/app/assets/javascripts/semantic-ui/site.js +1 -1
  36. data/app/assets/javascripts/semantic-ui/slider.js +78 -63
  37. data/app/assets/javascripts/semantic-ui/state.js +2 -2
  38. data/app/assets/javascripts/semantic-ui/sticky.js +30 -19
  39. data/app/assets/javascripts/semantic-ui/tab.js +24 -6
  40. data/app/assets/javascripts/semantic-ui/toast.js +67 -33
  41. data/app/assets/javascripts/semantic-ui/transition.js +27 -22
  42. data/app/assets/javascripts/semantic-ui/visibility.js +5 -5
  43. data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +1 -1
  44. data/app/assets/stylesheets/semantic-ui/collections/_form.scss +160 -83
  45. data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +25 -21
  46. data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +110 -78
  47. data/app/assets/stylesheets/semantic-ui/collections/_message.scss +43 -43
  48. data/app/assets/stylesheets/semantic-ui/collections/_table.scss +1684 -272
  49. data/app/assets/stylesheets/semantic-ui/elements/_button.scss +204 -157
  50. data/app/assets/stylesheets/semantic-ui/elements/_container.scss +98 -4
  51. data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +31 -31
  52. data/app/assets/stylesheets/semantic-ui/elements/_emoji.scss +10799 -8841
  53. data/app/assets/stylesheets/semantic-ui/elements/_flag.scss +1021 -915
  54. data/app/assets/stylesheets/semantic-ui/elements/_header.scss +6 -4
  55. data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +2110 -2061
  56. data/app/assets/stylesheets/semantic-ui/elements/_image.scss +1 -1
  57. data/app/assets/stylesheets/semantic-ui/elements/_input.scss +759 -22
  58. data/app/assets/stylesheets/semantic-ui/elements/_label.scss +72 -68
  59. data/app/assets/stylesheets/semantic-ui/elements/_list.scss +31 -31
  60. data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +352 -352
  61. data/app/assets/stylesheets/semantic-ui/elements/_placeholder.scss +33 -33
  62. data/app/assets/stylesheets/semantic-ui/elements/_rail.scss +1 -1
  63. data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +1 -1
  64. data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +118 -34
  65. data/app/assets/stylesheets/semantic-ui/elements/_step.scss +32 -32
  66. data/app/assets/stylesheets/semantic-ui/elements/_text.scss +1 -1
  67. data/app/assets/stylesheets/semantic-ui/globals/_reset.scss +5 -4
  68. data/app/assets/stylesheets/semantic-ui/globals/_site.scss +139 -42
  69. data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +177 -37
  70. data/app/assets/stylesheets/semantic-ui/modules/_calendar.scss +18 -1
  71. data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +93 -92
  72. data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +33 -18
  73. data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +101 -51
  74. data/app/assets/stylesheets/semantic-ui/modules/_embed.scss +5 -5
  75. data/app/assets/stylesheets/semantic-ui/modules/_flyout.scss +592 -0
  76. data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +37 -6
  77. data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +1 -1
  78. data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +103 -105
  79. data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +1 -1
  80. data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +7 -46
  81. data/app/assets/stylesheets/semantic-ui/modules/_search.scss +6 -6
  82. data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +1 -1
  83. data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +23 -9
  84. data/app/assets/stylesheets/semantic-ui/modules/_slider.scss +17 -17
  85. data/app/assets/stylesheets/semantic-ui/modules/_sticky.scss +1 -1
  86. data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +5 -5
  87. data/app/assets/stylesheets/semantic-ui/modules/_toast.scss +49 -1
  88. data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +1 -1
  89. data/app/assets/stylesheets/semantic-ui/views/_ad.scss +4 -4
  90. data/app/assets/stylesheets/semantic-ui/views/_card.scss +754 -117
  91. data/app/assets/stylesheets/semantic-ui/views/_comment.scss +12 -12
  92. data/app/assets/stylesheets/semantic-ui/views/_feed.scss +29 -29
  93. data/app/assets/stylesheets/semantic-ui/views/_item.scss +17 -17
  94. data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +4 -4
  95. data/lib/fomantic/ui/sass/version.rb +2 -2
  96. metadata +5 -3
@@ -70,6 +70,7 @@ $.fn.slider = function(parameters) {
70
70
 
71
71
  $module = $(this),
72
72
  $currThumb,
73
+ touchIdentifier,
73
74
  $thumb,
74
75
  $secondThumb,
75
76
  $track,
@@ -86,7 +87,6 @@ $.fn.slider = function(parameters) {
86
87
  secondPos,
87
88
  offset,
88
89
  precision,
89
- isTouch,
90
90
  gapRatio = 1,
91
91
  previousValue,
92
92
 
@@ -104,7 +104,6 @@ $.fn.slider = function(parameters) {
104
104
  currentRange += 1;
105
105
  documentEventID = currentRange;
106
106
 
107
- isTouch = module.setup.testOutTouch();
108
107
  module.setup.layout();
109
108
  module.setup.labels();
110
109
 
@@ -175,14 +174,6 @@ $.fn.slider = function(parameters) {
175
174
  }
176
175
  }
177
176
  },
178
- testOutTouch: function() {
179
- try {
180
- document.createEvent('TouchEvent');
181
- return true;
182
- } catch (e) {
183
- return false;
184
- }
185
- },
186
177
  customLabel: function() {
187
178
  var
188
179
  $children = $labels.find('.label'),
@@ -236,9 +227,6 @@ $.fn.slider = function(parameters) {
236
227
  module.bind.globalKeyboardEvents();
237
228
  module.bind.keyboardEvents();
238
229
  module.bind.mouseEvents();
239
- if(module.is.touch()) {
240
- module.bind.touchEvents();
241
- }
242
230
  if (settings.autoAdjustLabels) {
243
231
  module.bind.windowEvents();
244
232
  }
@@ -251,7 +239,7 @@ $.fn.slider = function(parameters) {
251
239
  $(document).on('keydown' + eventNamespace + documentEventID, module.event.activateFocus);
252
240
  },
253
241
  mouseEvents: function() {
254
- module.verbose('Binding mouse events');
242
+ module.verbose('Binding mouse and touch events');
255
243
  $module.find('.track, .thumb, .inner').on('mousedown' + eventNamespace, function(event) {
256
244
  event.stopImmediatePropagation();
257
245
  event.preventDefault();
@@ -264,27 +252,20 @@ $.fn.slider = function(parameters) {
264
252
  $module.on('mouseleave' + eventNamespace, function(event) {
265
253
  isHover = false;
266
254
  });
267
- },
268
- touchEvents: function() {
269
- module.verbose('Binding touch events');
270
- $module.find('.track, .thumb, .inner').on('touchstart' + eventNamespace, function(event) {
271
- event.stopImmediatePropagation();
272
- event.preventDefault();
273
- module.event.down(event);
274
- });
275
- $module.on('touchstart' + eventNamespace, module.event.down);
255
+ // All touch events are invoked on the element where the touch *started*. Thus, we can bind them all
256
+ // on the thumb(s) and don't need to worry about interference with other components, i.e. no dynamic binding
257
+ // and unbinding required.
258
+ $module.find('.thumb')
259
+ .on('touchstart' + eventNamespace, module.event.touchDown)
260
+ .on('touchmove' + eventNamespace, module.event.move)
261
+ .on('touchend' + eventNamespace, module.event.up)
262
+ .on('touchcancel' + eventNamespace, module.event.touchCancel);
276
263
  },
277
264
  slidingEvents: function() {
278
265
  // these don't need the identifier because we only ever want one of them to be registered with document
279
266
  module.verbose('Binding page wide events while handle is being draged');
280
- if(module.is.touch()) {
281
- $(document).on('touchmove' + eventNamespace, module.event.move);
282
- $(document).on('touchend' + eventNamespace, module.event.up);
283
- }
284
- else {
285
- $(document).on('mousemove' + eventNamespace, module.event.move);
286
- $(document).on('mouseup' + eventNamespace, module.event.up);
287
- }
267
+ $(document).on('mousemove' + eventNamespace, module.event.move);
268
+ $(document).on('mouseup' + eventNamespace, module.event.up);
288
269
  },
289
270
  windowEvents: function() {
290
271
  $window.on('resize' + eventNamespace, module.event.resize);
@@ -294,24 +275,22 @@ $.fn.slider = function(parameters) {
294
275
  unbind: {
295
276
  events: function() {
296
277
  $module.find('.track, .thumb, .inner').off('mousedown' + eventNamespace);
297
- $module.find('.track, .thumb, .inner').off('touchstart' + eventNamespace);
298
278
  $module.off('mousedown' + eventNamespace);
299
279
  $module.off('mouseenter' + eventNamespace);
300
280
  $module.off('mouseleave' + eventNamespace);
301
- $module.off('touchstart' + eventNamespace);
281
+ $module.find('.thumb')
282
+ .off('touchstart' + eventNamespace)
283
+ .off('touchmove' + eventNamespace)
284
+ .off('touchend' + eventNamespace)
285
+ .off('touchcancel' + eventNamespace);
302
286
  $module.off('keydown' + eventNamespace);
303
287
  $module.off('focusout' + eventNamespace);
304
288
  $(document).off('keydown' + eventNamespace + documentEventID, module.event.activateFocus);
305
289
  $window.off('resize' + eventNamespace);
306
290
  },
307
291
  slidingEvents: function() {
308
- if(module.is.touch()) {
309
- $(document).off('touchmove' + eventNamespace);
310
- $(document).off('touchend' + eventNamespace);
311
- } else {
312
- $(document).off('mousemove' + eventNamespace);
313
- $(document).off('mouseup' + eventNamespace);
314
- }
292
+ $(document).off('mousemove' + eventNamespace);
293
+ $(document).off('mouseup' + eventNamespace);
315
294
  },
316
295
  },
317
296
 
@@ -341,10 +320,31 @@ $.fn.slider = function(parameters) {
341
320
  module.bind.slidingEvents();
342
321
  }
343
322
  },
323
+ touchDown: function(event) {
324
+ event.preventDefault(); // disable mouse emulation and touch-scrolling
325
+ event.stopImmediatePropagation();
326
+ if(touchIdentifier !== undefined) {
327
+ // ignore multiple touches on the same slider --
328
+ // we cannot handle changing both thumbs at once due to shared state
329
+ return;
330
+ }
331
+ $currThumb = $(event.target);
332
+ var touchEvent = event.touches ? event : event.originalEvent;
333
+ touchIdentifier = touchEvent.targetTouches[0].identifier;
334
+ if(previousValue === undefined) {
335
+ previousValue = module.get.currentThumbValue();
336
+ }
337
+ },
344
338
  move: function(event) {
345
- event.preventDefault();
339
+ if(event.type == 'mousemove') {
340
+ event.preventDefault(); // prevent text selection etc.
341
+ }
342
+ if(module.is.disabled()) {
343
+ // touch events are always bound, so we need to prevent touch-sliding on disabled sliders here
344
+ return;
345
+ }
346
346
  var value = module.determine.valueFromEvent(event);
347
- if($currThumb === undefined) {
347
+ if(event.type == 'mousemove' && $currThumb === undefined) {
348
348
  var
349
349
  eventPos = module.determine.eventPos(event),
350
350
  newPos = module.determine.pos(eventPos)
@@ -381,10 +381,23 @@ $.fn.slider = function(parameters) {
381
381
  },
382
382
  up: function(event) {
383
383
  event.preventDefault();
384
+ if(module.is.disabled()) {
385
+ // touch events are always bound, so we need to prevent touch-sliding on disabled sliders here
386
+ return;
387
+ }
384
388
  var value = module.determine.valueFromEvent(event);
385
389
  module.set.value(value);
386
390
  module.unbind.slidingEvents();
391
+ touchIdentifier = undefined;
392
+ if (previousValue !== undefined) {
393
+ previousValue = undefined;
394
+ }
395
+ },
396
+ touchCancel: function(event) {
397
+ event.preventDefault();
398
+ touchIdentifier = undefined;
387
399
  if (previousValue !== undefined) {
400
+ module.update.value(previousValue);
388
401
  previousValue = undefined;
389
402
  }
390
403
  },
@@ -441,8 +454,8 @@ $.fn.slider = function(parameters) {
441
454
  module.setup.labels();
442
455
  },
443
456
  takeStep: function(multiplier) {
457
+ multiplier = multiplier != undefined ? multiplier : 1;
444
458
  var
445
- multiplier = multiplier != undefined ? multiplier : 1,
446
459
  step = module.get.step(),
447
460
  currValue = module.get.currentThumbValue()
448
461
  ;
@@ -459,8 +472,8 @@ $.fn.slider = function(parameters) {
459
472
  },
460
473
 
461
474
  backStep: function(multiplier) {
475
+ multiplier = multiplier != undefined ? multiplier : 1;
462
476
  var
463
- multiplier = multiplier != undefined ? multiplier : 1,
464
477
  step = module.get.step(),
465
478
  currValue = module.get.currentThumbValue()
466
479
  ;
@@ -500,9 +513,6 @@ $.fn.slider = function(parameters) {
500
513
  },
501
514
  smooth: function() {
502
515
  return settings.smooth || $module.hasClass(settings.className.smooth);
503
- },
504
- touch: function() {
505
- return isTouch;
506
516
  }
507
517
  },
508
518
 
@@ -711,11 +721,11 @@ $.fn.slider = function(parameters) {
711
721
  ;
712
722
  return pos;
713
723
  },
714
- positionFromValue: function(value) {
724
+ positionFromValue: function(val) {
715
725
  var
716
726
  min = module.get.min(),
717
727
  max = module.get.max(),
718
- value = value > max ? max : value < min ? min : value,
728
+ value = val > max ? max : val < min ? min : val,
719
729
  trackLength = module.get.trackLength(),
720
730
  ratio = (value - min) / (max - min),
721
731
  position = Math.round(ratio * trackLength)
@@ -766,12 +776,19 @@ $.fn.slider = function(parameters) {
766
776
  return value;
767
777
  },
768
778
  eventPos: function(event) {
769
- if(module.is.touch()) {
779
+ if(event.type === "touchmove" || event.type === "touchend") {
780
+ var
781
+ touchEvent = event.touches ? event : event.originalEvent,
782
+ touch = touchEvent.changedTouches[0]; // fall back to first touch if correct touch not found
783
+ for(var i=0; i < touchEvent.touches.length; i++) {
784
+ if(touchEvent.touches[i].identifier === touchIdentifier) {
785
+ touch = touchEvent.touches[i];
786
+ break;
787
+ }
788
+ }
770
789
  var
771
- touchEvent = event.changedTouches ? event : event.originalEvent,
772
- touches = touchEvent.changedTouches[0] ? touchEvent.changedTouches : touchEvent.touches,
773
- touchY = touches[0].pageY,
774
- touchX = touches[0].pageX
790
+ touchY = touch.pageY,
791
+ touchX = touch.pageX
775
792
  ;
776
793
  return module.is.vertical() ? touchY : touchX;
777
794
  }
@@ -916,14 +933,12 @@ $.fn.slider = function(parameters) {
916
933
  },
917
934
  position: function(position, which) {
918
935
  var thumbVal = module.determine.value(position);
919
- switch (which) {
920
- case 'second':
921
- module.secondThumbVal = thumbVal;
922
- module.update.position(thumbVal, $secondThumb);
923
- break;
924
- default:
925
- module.thumbVal = thumbVal;
926
- module.update.position(thumbVal, $thumb);
936
+ if (which === 'second') {
937
+ module.secondThumbVal = thumbVal;
938
+ module.update.position(thumbVal, $secondThumb);
939
+ } else {
940
+ module.thumbVal = thumbVal;
941
+ module.update.position(thumbVal, $thumb);
927
942
  }
928
943
  value = Math.abs(module.thumbVal - (module.secondThumbVal || 0));
929
944
  module.set.value(value);
@@ -1192,7 +1207,7 @@ $.fn.slider = function(parameters) {
1192
1207
  response
1193
1208
  ;
1194
1209
  passedArguments = passedArguments || queryArguments;
1195
- context = element || context;
1210
+ context = context || element;
1196
1211
  if(typeof query == 'string' && object !== undefined) {
1197
1212
  query = query.split(/[\. ]/);
1198
1213
  maxDepth = query.length - 1;
@@ -74,7 +74,7 @@ $.fn.state = function(parameters) {
74
74
 
75
75
  // bind events with delegated events
76
76
  if(settings.context && moduleSelector !== '') {
77
- $(settings.context)
77
+ ([window,document].indexOf(settings.context) < 0 ? $(document).find(settings.context) : $(settings.context))
78
78
  .on(moduleSelector, 'mouseenter' + eventNamespace, module.change.text)
79
79
  .on(moduleSelector, 'mouseleave' + eventNamespace, module.reset.text)
80
80
  .on(moduleSelector, 'click' + eventNamespace, module.toggle.state)
@@ -527,7 +527,7 @@ $.fn.state = function(parameters) {
527
527
  response
528
528
  ;
529
529
  passedArguments = passedArguments || queryArguments;
530
- context = element || context;
530
+ context = context || element;
531
531
  if(typeof query == 'string' && object !== undefined) {
532
532
  query = query.split(/[\. ]/);
533
533
  maxDepth = query.length - 1;
@@ -53,7 +53,7 @@ $.fn.sticky = function(parameters) {
53
53
 
54
54
  $module = $(this),
55
55
  $window = $(window),
56
- $scroll = $(settings.scrollContext),
56
+ $scroll = [window,document].indexOf(settings.scrollContext) < 0 ? $(document).find(settings.scrollContext) : $(settings.scrollContext),
57
57
  $container,
58
58
  $context,
59
59
 
@@ -139,7 +139,7 @@ $.fn.sticky = function(parameters) {
139
139
 
140
140
  determineContainer: function() {
141
141
  if(settings.container) {
142
- $container = $(settings.container);
142
+ $container = [window,document].indexOf(settings.container) < 0 ? $(document).find(settings.container) : $(settings.container);
143
143
  }
144
144
  else {
145
145
  $container = $module.offsetParent();
@@ -148,14 +148,13 @@ $.fn.sticky = function(parameters) {
148
148
 
149
149
  determineContext: function() {
150
150
  if(settings.context) {
151
- $context = $(settings.context);
151
+ $context = [window,document].indexOf(settings.context) < 0 ? $(document).find(settings.context) : $(settings.context);
152
152
  }
153
153
  else {
154
154
  $context = $container;
155
155
  }
156
156
  if($context.length === 0) {
157
157
  module.error(error.invalidContext, settings.context, $module);
158
- return;
159
158
  }
160
159
  },
161
160
 
@@ -166,7 +165,6 @@ $.fn.sticky = function(parameters) {
166
165
  if(module.cache.element.height > module.cache.context.height) {
167
166
  module.reset();
168
167
  module.error(error.elementSize, $module);
169
- return;
170
168
  }
171
169
  },
172
170
 
@@ -317,13 +315,8 @@ $.fn.sticky = function(parameters) {
317
315
  direction = 'down'
318
316
  ;
319
317
  scroll = scroll || $scroll.scrollTop();
320
- if(module.lastScroll !== undefined) {
321
- if(module.lastScroll < scroll) {
322
- direction = 'down';
323
- }
324
- else if(module.lastScroll > scroll) {
318
+ if(module.lastScroll && module.lastScroll > scroll) {
325
319
  direction = 'up';
326
- }
327
320
  }
328
321
  return direction;
329
322
  },
@@ -371,7 +364,7 @@ $.fn.sticky = function(parameters) {
371
364
  lastScroll: function() {
372
365
  delete module.lastScroll;
373
366
  },
374
- elementScroll: function(scroll) {
367
+ elementScroll: function() {
375
368
  delete module.elementScroll;
376
369
  },
377
370
  minimumSize: function() {
@@ -393,14 +386,26 @@ $.fn.sticky = function(parameters) {
393
386
  },
394
387
  containerSize: function() {
395
388
  var
396
- tagName = $container.get(0).tagName
389
+ tagName = $container[0].tagName
397
390
  ;
398
- if(tagName === 'HTML' || tagName == 'body') {
391
+ if(tagName === 'HTML' || tagName === 'body') {
399
392
  // this can trigger for too many reasons
400
393
  //module.error(error.container, tagName, $module);
401
394
  module.determineContainer();
402
395
  }
403
396
  else {
397
+ var tallestHeight = Math.max(module.cache.context.height, module.cache.element.height);
398
+ if(tallestHeight - $container.outerHeight() > settings.jitter) {
399
+ module.debug('Context is taller than container. Specifying exact height for container', module.cache.context.height);
400
+ $container.css({
401
+ height: tallestHeight,
402
+ });
403
+ }
404
+ else {
405
+ $container.css({
406
+ height: '',
407
+ });
408
+ }
404
409
  if( Math.abs($container.outerHeight() - module.cache.context.height) > settings.jitter) {
405
410
  module.debug('Context has padding, specifying exact height for container', module.cache.context.height);
406
411
  $container.css({
@@ -467,9 +472,9 @@ $.fn.sticky = function(parameters) {
467
472
  }
468
473
  },
469
474
 
470
- stick: function(scroll) {
475
+ stick: function(scrollPosition) {
471
476
  var
472
- cachedPosition = scroll || $scroll.scrollTop(),
477
+ cachedPosition = scrollPosition || $scroll.scrollTop(),
473
478
  cache = module.cache,
474
479
  fits = cache.fits,
475
480
  sameHeight = cache.sameHeight,
@@ -499,7 +504,7 @@ $.fn.sticky = function(parameters) {
499
504
  module.bindBottom();
500
505
  }
501
506
  else if(scroll.top > element.top) {
502
- if( (element.height + scroll.top - elementScroll) >= context.bottom ) {
507
+ if( (element.height + scroll.top - elementScroll) >= context.bottom && element.height < context.height) {
503
508
  module.debug('Initial element position is bottom of container');
504
509
  module.bindBottom();
505
510
  }
@@ -578,6 +583,9 @@ $.fn.sticky = function(parameters) {
578
583
  bindTop: function() {
579
584
  module.debug('Binding element to top of parent container');
580
585
  module.remove.offset();
586
+ if(settings.setSize) {
587
+ module.set.size();
588
+ }
581
589
  $module
582
590
  .css({
583
591
  left : '',
@@ -595,6 +603,9 @@ $.fn.sticky = function(parameters) {
595
603
  bindBottom: function() {
596
604
  module.debug('Binding element to bottom of parent container');
597
605
  module.remove.offset();
606
+ if(settings.setSize) {
607
+ module.set.size();
608
+ }
598
609
  $module
599
610
  .css({
600
611
  left : '',
@@ -816,7 +827,7 @@ $.fn.sticky = function(parameters) {
816
827
  response
817
828
  ;
818
829
  passedArguments = passedArguments || queryArguments;
819
- context = element || context;
830
+ context = context || element;
820
831
  if(typeof query == 'string' && object !== undefined) {
821
832
  query = query.split(/[\. ]/);
822
833
  maxDepth = query.length - 1;
@@ -938,7 +949,7 @@ $.fn.sticky.settings = {
938
949
 
939
950
  error : {
940
951
  container : 'Sticky element must be inside a relative container',
941
- visible : 'Element is hidden, you must call refresh after element becomes visible. Use silent setting to surpress this warning in production.',
952
+ visible : 'Element is hidden, you must call refresh after element becomes visible. Use silent setting to suppress this warning in production.',
942
953
  method : 'The method you called is not defined.',
943
954
  invalidContext : 'Context specified does not exist',
944
955
  elementSize : 'Sticky element is larger than its container, cannot create sticky.'
@@ -100,10 +100,18 @@ $.fn.tab = function(parameters) {
100
100
  initializedHistory = true;
101
101
  }
102
102
 
103
- if(settings.autoTabActivation && instance === undefined && module.determine.activeTab() == null) {
104
- module.debug('No active tab detected, setting first tab active', module.get.initialPath());
105
- module.changeTab(settings.autoTabActivation === true ? module.get.initialPath() : settings.autoTabActivation);
106
- };
103
+ var activeTab = module.determine.activeTab();
104
+ if(settings.autoTabActivation && instance === undefined && activeTab == null) {
105
+ activeTab = settings.autoTabActivation === true ? module.get.initialPath() : settings.autoTabActivation;
106
+ module.debug('No active tab detected, setting tab active', activeTab);
107
+ module.changeTab(activeTab);
108
+ }
109
+ if(activeTab != null && settings.history) {
110
+ var autoUpdate = $.address.autoUpdate();
111
+ $.address.autoUpdate(false);
112
+ $.address.value(activeTab);
113
+ $.address.autoUpdate(autoUpdate);
114
+ }
107
115
 
108
116
  module.instantiate();
109
117
  },
@@ -154,7 +162,7 @@ $.fn.tab = function(parameters) {
154
162
  module.verbose('Determined parent element for creating context', $context);
155
163
  }
156
164
  else if(settings.context) {
157
- $context = $(settings.context);
165
+ $context = [window,document].indexOf(settings.context) < 0 ? $(document).find(settings.context) : $(settings.context);
158
166
  module.verbose('Using selector for tab context', settings.context, $context);
159
167
  }
160
168
  else {
@@ -203,6 +211,7 @@ $.fn.tab = function(parameters) {
203
211
  .history(true)
204
212
  .state(settings.path)
205
213
  ;
214
+ $(window).trigger('popstate');
206
215
  }
207
216
  else {
208
217
  module.error(error.path);
@@ -370,6 +379,10 @@ $.fn.tab = function(parameters) {
370
379
  module.verbose('Tab parameters found', nextPathArray);
371
380
  }
372
381
  }
382
+ if (settings.onBeforeChange.call(element, currentPath) === false) {
383
+ module.debug('onBeforeChange returned false, cancelling tab change', $tab);
384
+ return false;
385
+ }
373
386
  if(isLastTab && remoteContent) {
374
387
  if(!shouldIgnoreLoad) {
375
388
  module.activate.navigation(currentPath);
@@ -406,6 +419,10 @@ $.fn.tab = function(parameters) {
406
419
  // if anchor exists use parent tab
407
420
  if($anchor && $anchor.length > 0 && currentPath) {
408
421
  module.debug('Anchor link used, opening parent tab', $tab, $anchor);
422
+ if (settings.onBeforeChange.call(element, currentPath) === false) {
423
+ module.debug('onBeforeChange returned false, cancelling tab change', $tab);
424
+ return false;
425
+ }
409
426
  if( !$tab.hasClass(className.active) ) {
410
427
  setTimeout(function() {
411
428
  module.scrollTo($anchor);
@@ -851,7 +868,7 @@ $.fn.tab = function(parameters) {
851
868
  response
852
869
  ;
853
870
  passedArguments = passedArguments || queryArguments;
854
- context = element || context;
871
+ context = context || element;
855
872
  if(typeof query == 'string' && object !== undefined) {
856
873
  query = query.split(/[\. ]/);
857
874
  maxDepth = query.length - 1;
@@ -959,6 +976,7 @@ $.fn.tab.settings = {
959
976
  onLoad : function(tabPath, parameterArray, historyEvent) {}, // called on every load
960
977
  onVisible : function(tabPath, parameterArray, historyEvent) {}, // called every time tab visible
961
978
  onRequest : function(tabPath, parameterArray, historyEvent) {}, // called ever time a tab beings loading remote content
979
+ onBeforeChange: function(tabPath) {}, // called before a tab is about to be changed. Returning false will cancel the tab change
962
980
 
963
981
  templates : {
964
982
  determineTitle: function(tabArray) {} // returns page title for path