twbs_sass_rails 3.4.0 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/Appraisals +2 -2
  3. data/CHANGELOG.md +5 -0
  4. data/gemfiles/rails_4.1.gemfile +1 -1
  5. data/gemfiles/rails_4.2.gemfile +1 -1
  6. data/lib/twbs_sass_rails/version.rb +1 -1
  7. data/vendor/assets/javascripts/twbs/bootstrap/affix.js +3 -3
  8. data/vendor/assets/javascripts/twbs/bootstrap/alert.js +2 -2
  9. data/vendor/assets/javascripts/twbs/bootstrap/button.js +13 -9
  10. data/vendor/assets/javascripts/twbs/bootstrap/carousel.js +2 -2
  11. data/vendor/assets/javascripts/twbs/bootstrap/collapse.js +2 -2
  12. data/vendor/assets/javascripts/twbs/bootstrap/dropdown.js +46 -42
  13. data/vendor/assets/javascripts/twbs/bootstrap/modal.js +5 -7
  14. data/vendor/assets/javascripts/twbs/bootstrap/popover.js +2 -2
  15. data/vendor/assets/javascripts/twbs/bootstrap/scrollspy.js +2 -2
  16. data/vendor/assets/javascripts/twbs/bootstrap/tab.js +5 -3
  17. data/vendor/assets/javascripts/twbs/bootstrap/tooltip.js +58 -20
  18. data/vendor/assets/javascripts/twbs/bootstrap/transition.js +1 -1
  19. data/vendor/assets/javascripts/twbs/bootstrap.js +2 -2
  20. data/vendor/assets/stylesheets/twbs/_bootstrap.scss +6 -0
  21. data/vendor/assets/stylesheets/twbs/bootstrap/_badges.scss +1 -1
  22. data/vendor/assets/stylesheets/twbs/bootstrap/_button-groups.scss +3 -2
  23. data/vendor/assets/stylesheets/twbs/bootstrap/_buttons.scss +13 -5
  24. data/vendor/assets/stylesheets/twbs/bootstrap/_carousel.scss +2 -2
  25. data/vendor/assets/stylesheets/twbs/bootstrap/_dropdowns.scss +3 -1
  26. data/vendor/assets/stylesheets/twbs/bootstrap/_forms.scss +46 -13
  27. data/vendor/assets/stylesheets/twbs/bootstrap/_glyphicons.scss +11 -9
  28. data/vendor/assets/stylesheets/twbs/bootstrap/_input-groups.scss +1 -0
  29. data/vendor/assets/stylesheets/twbs/bootstrap/_jumbotron.scss +5 -3
  30. data/vendor/assets/stylesheets/twbs/bootstrap/_list-group.scss +9 -3
  31. data/vendor/assets/stylesheets/twbs/bootstrap/_media.scss +5 -0
  32. data/vendor/assets/stylesheets/twbs/bootstrap/_mixins.scss +1 -0
  33. data/vendor/assets/stylesheets/twbs/bootstrap/_normalize.scss +8 -11
  34. data/vendor/assets/stylesheets/twbs/bootstrap/_pagination.scss +3 -2
  35. data/vendor/assets/stylesheets/twbs/bootstrap/_panels.scss +6 -0
  36. data/vendor/assets/stylesheets/twbs/bootstrap/_popovers.scss +4 -8
  37. data/vendor/assets/stylesheets/twbs/bootstrap/_print.scss +0 -6
  38. data/vendor/assets/stylesheets/twbs/bootstrap/_responsive-utilities.scss +4 -2
  39. data/vendor/assets/stylesheets/twbs/bootstrap/_scaffolding.scss +1 -2
  40. data/vendor/assets/stylesheets/twbs/bootstrap/_theme.scss +23 -5
  41. data/vendor/assets/stylesheets/twbs/bootstrap/_tooltip.scss +4 -5
  42. data/vendor/assets/stylesheets/twbs/bootstrap/_variables.scss +7 -1
  43. data/vendor/assets/stylesheets/twbs/bootstrap/mixins/_background-variant.scss +2 -1
  44. data/vendor/assets/stylesheets/twbs/bootstrap/mixins/_buttons.scss +18 -2
  45. data/vendor/assets/stylesheets/twbs/bootstrap/mixins/_grid-framework.scss +2 -2
  46. data/vendor/assets/stylesheets/twbs/bootstrap/mixins/_grid.scss +2 -2
  47. data/vendor/assets/stylesheets/twbs/bootstrap/mixins/_hide-text.scss +1 -1
  48. data/vendor/assets/stylesheets/twbs/bootstrap/mixins/_list-group.scss +3 -2
  49. data/vendor/assets/stylesheets/twbs/bootstrap/mixins/_pagination.scss +2 -1
  50. data/vendor/assets/stylesheets/twbs/bootstrap/mixins/_reset-text.scss +18 -0
  51. data/vendor/assets/stylesheets/twbs/bootstrap/mixins/_responsive-visibility.scss +1 -1
  52. data/vendor/assets/stylesheets/twbs/bootstrap/mixins/_text-emphasis.scss +2 -1
  53. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5cb795ddff3d3aae16c22a6929a878923c941f59
4
- data.tar.gz: db7f86b112c1f11f1aebaf7af19d86bb2748baa9
3
+ metadata.gz: d8c9cc349df830a1592dee81eef8e64a1ca77b28
4
+ data.tar.gz: c6be6dc4532e23b0c947716af5cb443db9ef0d9e
5
5
  SHA512:
6
- metadata.gz: c6a2c111b4ebd1cf306c06e7da8394c40be8c69349bb4e0b930ab4b3660379d3712cc7e83571a88f1e868e013a4b24c2c7d98123acdd130b8018f0bbd8782aab
7
- data.tar.gz: b5f3bfb2c22ece7d2679cbf421f9711823914fd1415749a47c038c00e7ad6831805f45794110dfb0e151108a8cafe06ad8842bb2663937aabadc8fa1c2871d55
6
+ metadata.gz: 7327e16460427b39b1c482a7f01c1474dcce46b9cc6dc5e7bf0729816be78bc15cf741845a2b10586f53806c014ed55c38537352635825c0035c1176706d25b5
7
+ data.tar.gz: 4d2791839e2f5dc50107f16c4763b8e69bb8f5a0c1431365ca54e557eda107e19695816f8fa245db4df1f558cc27479c673d177100f16af4e2c090063d590f0b
data/Appraisals CHANGED
@@ -3,9 +3,9 @@ appraise 'rails-4.0' do
3
3
  end
4
4
 
5
5
  appraise 'rails-4.1' do
6
- gem 'rails', '4.1.10'
6
+ gem 'rails', '4.1.11'
7
7
  end
8
8
 
9
9
  appraise 'rails-4.2' do
10
- gem 'rails', '4.2.1'
10
+ gem 'rails', '4.2.2'
11
11
  end
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.5.0
4
+
5
+ * bootstrap-sass 3.3.5
6
+ * Test against Rails 4.1.11 and 4.2.2
7
+
3
8
  ## 3.4.0
4
9
 
5
10
  * bootstrap-sass 3.3.4
@@ -2,6 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "rails", "4.1.10"
5
+ gem "rails", "4.1.11"
6
6
 
7
7
  gemspec :path => "../"
@@ -2,6 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "rails", "4.2.1"
5
+ gem "rails", "4.2.2"
6
6
 
7
7
  gemspec :path => "../"
@@ -1,3 +1,3 @@
1
1
  module TwbsSassRails
2
- VERSION = "3.4.0"
2
+ VERSION = "3.5.0"
3
3
  end
@@ -1,5 +1,5 @@
1
1
  /* ========================================================================
2
- * Bootstrap: affix.js v3.3.4
2
+ * Bootstrap: affix.js v3.3.5
3
3
  * http://getbootstrap.com/javascript/#affix
4
4
  * ========================================================================
5
5
  * Copyright 2011-2015 Twitter, Inc.
@@ -28,7 +28,7 @@
28
28
  this.checkPosition()
29
29
  }
30
30
 
31
- Affix.VERSION = '3.3.4'
31
+ Affix.VERSION = '3.3.5'
32
32
 
33
33
  Affix.RESET = 'affix affix-top affix-bottom'
34
34
 
@@ -78,7 +78,7 @@
78
78
  var offset = this.options.offset
79
79
  var offsetTop = offset.top
80
80
  var offsetBottom = offset.bottom
81
- var scrollHeight = $(document.body).height()
81
+ var scrollHeight = Math.max($(document).height(), $(document.body).height())
82
82
 
83
83
  if (typeof offset != 'object') offsetBottom = offsetTop = offset
84
84
  if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
@@ -1,5 +1,5 @@
1
1
  /* ========================================================================
2
- * Bootstrap: alert.js v3.3.4
2
+ * Bootstrap: alert.js v3.3.5
3
3
  * http://getbootstrap.com/javascript/#alerts
4
4
  * ========================================================================
5
5
  * Copyright 2011-2015 Twitter, Inc.
@@ -18,7 +18,7 @@
18
18
  $(el).on('click', dismiss, this.close)
19
19
  }
20
20
 
21
- Alert.VERSION = '3.3.4'
21
+ Alert.VERSION = '3.3.5'
22
22
 
23
23
  Alert.TRANSITION_DURATION = 150
24
24
 
@@ -1,5 +1,5 @@
1
1
  /* ========================================================================
2
- * Bootstrap: button.js v3.3.4
2
+ * Bootstrap: button.js v3.3.5
3
3
  * http://getbootstrap.com/javascript/#buttons
4
4
  * ========================================================================
5
5
  * Copyright 2011-2015 Twitter, Inc.
@@ -19,7 +19,7 @@
19
19
  this.isLoading = false
20
20
  }
21
21
 
22
- Button.VERSION = '3.3.4'
22
+ Button.VERSION = '3.3.5'
23
23
 
24
24
  Button.DEFAULTS = {
25
25
  loadingText: 'loading...'
@@ -31,7 +31,7 @@
31
31
  var val = $el.is('input') ? 'val' : 'html'
32
32
  var data = $el.data()
33
33
 
34
- state = state + 'Text'
34
+ state += 'Text'
35
35
 
36
36
  if (data.resetText == null) $el.data('resetText', $el[val]())
37
37
 
@@ -56,15 +56,19 @@
56
56
  if ($parent.length) {
57
57
  var $input = this.$element.find('input')
58
58
  if ($input.prop('type') == 'radio') {
59
- if ($input.prop('checked') && this.$element.hasClass('active')) changed = false
60
- else $parent.find('.active').removeClass('active')
59
+ if ($input.prop('checked')) changed = false
60
+ $parent.find('.active').removeClass('active')
61
+ this.$element.addClass('active')
62
+ } else if ($input.prop('type') == 'checkbox') {
63
+ if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false
64
+ this.$element.toggleClass('active')
61
65
  }
62
- if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
66
+ $input.prop('checked', this.$element.hasClass('active'))
67
+ if (changed) $input.trigger('change')
63
68
  } else {
64
69
  this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
70
+ this.$element.toggleClass('active')
65
71
  }
66
-
67
- if (changed) this.$element.toggleClass('active')
68
72
  }
69
73
 
70
74
 
@@ -107,7 +111,7 @@
107
111
  var $btn = $(e.target)
108
112
  if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
109
113
  Plugin.call($btn, 'toggle')
110
- e.preventDefault()
114
+ if (!($(e.target).is('input[type="radio"]') || $(e.target).is('input[type="checkbox"]'))) e.preventDefault()
111
115
  })
112
116
  .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
113
117
  $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
@@ -1,5 +1,5 @@
1
1
  /* ========================================================================
2
- * Bootstrap: carousel.js v3.3.4
2
+ * Bootstrap: carousel.js v3.3.5
3
3
  * http://getbootstrap.com/javascript/#carousel
4
4
  * ========================================================================
5
5
  * Copyright 2011-2015 Twitter, Inc.
@@ -30,7 +30,7 @@
30
30
  .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
31
31
  }
32
32
 
33
- Carousel.VERSION = '3.3.4'
33
+ Carousel.VERSION = '3.3.5'
34
34
 
35
35
  Carousel.TRANSITION_DURATION = 600
36
36
 
@@ -1,5 +1,5 @@
1
1
  /* ========================================================================
2
- * Bootstrap: collapse.js v3.3.4
2
+ * Bootstrap: collapse.js v3.3.5
3
3
  * http://getbootstrap.com/javascript/#collapse
4
4
  * ========================================================================
5
5
  * Copyright 2011-2015 Twitter, Inc.
@@ -29,7 +29,7 @@
29
29
  if (this.options.toggle) this.toggle()
30
30
  }
31
31
 
32
- Collapse.VERSION = '3.3.4'
32
+ Collapse.VERSION = '3.3.5'
33
33
 
34
34
  Collapse.TRANSITION_DURATION = 350
35
35
 
@@ -1,5 +1,5 @@
1
1
  /* ========================================================================
2
- * Bootstrap: dropdown.js v3.3.4
2
+ * Bootstrap: dropdown.js v3.3.5
3
3
  * http://getbootstrap.com/javascript/#dropdowns
4
4
  * ========================================================================
5
5
  * Copyright 2011-2015 Twitter, Inc.
@@ -19,7 +19,41 @@
19
19
  $(element).on('click.bs.dropdown', this.toggle)
20
20
  }
21
21
 
22
- Dropdown.VERSION = '3.3.4'
22
+ Dropdown.VERSION = '3.3.5'
23
+
24
+ function getParent($this) {
25
+ var selector = $this.attr('data-target')
26
+
27
+ if (!selector) {
28
+ selector = $this.attr('href')
29
+ selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
30
+ }
31
+
32
+ var $parent = selector && $(selector)
33
+
34
+ return $parent && $parent.length ? $parent : $this.parent()
35
+ }
36
+
37
+ function clearMenus(e) {
38
+ if (e && e.which === 3) return
39
+ $(backdrop).remove()
40
+ $(toggle).each(function () {
41
+ var $this = $(this)
42
+ var $parent = getParent($this)
43
+ var relatedTarget = { relatedTarget: this }
44
+
45
+ if (!$parent.hasClass('open')) return
46
+
47
+ if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return
48
+
49
+ $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
50
+
51
+ if (e.isDefaultPrevented()) return
52
+
53
+ $this.attr('aria-expanded', 'false')
54
+ $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
55
+ })
56
+ }
23
57
 
24
58
  Dropdown.prototype.toggle = function (e) {
25
59
  var $this = $(this)
@@ -34,7 +68,10 @@
34
68
  if (!isActive) {
35
69
  if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
36
70
  // if mobile we use a backdrop because click events don't delegate
37
- $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
71
+ $(document.createElement('div'))
72
+ .addClass('dropdown-backdrop')
73
+ .insertAfter($(this))
74
+ .on('click', clearMenus)
38
75
  }
39
76
 
40
77
  var relatedTarget = { relatedTarget: this }
@@ -67,57 +104,25 @@
67
104
  var $parent = getParent($this)
68
105
  var isActive = $parent.hasClass('open')
69
106
 
70
- if ((!isActive && e.which != 27) || (isActive && e.which == 27)) {
107
+ if (!isActive && e.which != 27 || isActive && e.which == 27) {
71
108
  if (e.which == 27) $parent.find(toggle).trigger('focus')
72
109
  return $this.trigger('click')
73
110
  }
74
111
 
75
112
  var desc = ' li:not(.disabled):visible a'
76
- var $items = $parent.find('[role="menu"]' + desc + ', [role="listbox"]' + desc)
113
+ var $items = $parent.find('.dropdown-menu' + desc)
77
114
 
78
115
  if (!$items.length) return
79
116
 
80
117
  var index = $items.index(e.target)
81
118
 
82
- if (e.which == 38 && index > 0) index-- // up
83
- if (e.which == 40 && index < $items.length - 1) index++ // down
84
- if (!~index) index = 0
119
+ if (e.which == 38 && index > 0) index-- // up
120
+ if (e.which == 40 && index < $items.length - 1) index++ // down
121
+ if (!~index) index = 0
85
122
 
86
123
  $items.eq(index).trigger('focus')
87
124
  }
88
125
 
89
- function clearMenus(e) {
90
- if (e && e.which === 3) return
91
- $(backdrop).remove()
92
- $(toggle).each(function () {
93
- var $this = $(this)
94
- var $parent = getParent($this)
95
- var relatedTarget = { relatedTarget: this }
96
-
97
- if (!$parent.hasClass('open')) return
98
-
99
- $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
100
-
101
- if (e.isDefaultPrevented()) return
102
-
103
- $this.attr('aria-expanded', 'false')
104
- $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
105
- })
106
- }
107
-
108
- function getParent($this) {
109
- var selector = $this.attr('data-target')
110
-
111
- if (!selector) {
112
- selector = $this.attr('href')
113
- selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
114
- }
115
-
116
- var $parent = selector && $(selector)
117
-
118
- return $parent && $parent.length ? $parent : $this.parent()
119
- }
120
-
121
126
 
122
127
  // DROPDOWN PLUGIN DEFINITION
123
128
  // ==========================
@@ -155,7 +160,6 @@
155
160
  .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
156
161
  .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
157
162
  .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)
158
- .on('keydown.bs.dropdown.data-api', '[role="menu"]', Dropdown.prototype.keydown)
159
- .on('keydown.bs.dropdown.data-api', '[role="listbox"]', Dropdown.prototype.keydown)
163
+ .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown)
160
164
 
161
165
  }(jQuery);
@@ -1,5 +1,5 @@
1
1
  /* ========================================================================
2
- * Bootstrap: modal.js v3.3.4
2
+ * Bootstrap: modal.js v3.3.5
3
3
  * http://getbootstrap.com/javascript/#modals
4
4
  * ========================================================================
5
5
  * Copyright 2011-2015 Twitter, Inc.
@@ -33,7 +33,7 @@
33
33
  }
34
34
  }
35
35
 
36
- Modal.VERSION = '3.3.4'
36
+ Modal.VERSION = '3.3.5'
37
37
 
38
38
  Modal.TRANSITION_DURATION = 300
39
39
  Modal.BACKDROP_TRANSITION_DURATION = 150
@@ -90,9 +90,7 @@
90
90
  that.$element[0].offsetWidth // force reflow
91
91
  }
92
92
 
93
- that.$element
94
- .addClass('in')
95
- .attr('aria-hidden', false)
93
+ that.$element.addClass('in')
96
94
 
97
95
  that.enforceFocus()
98
96
 
@@ -126,7 +124,6 @@
126
124
 
127
125
  this.$element
128
126
  .removeClass('in')
129
- .attr('aria-hidden', true)
130
127
  .off('click.dismiss.bs.modal')
131
128
  .off('mouseup.dismiss.bs.modal')
132
129
 
@@ -190,7 +187,8 @@
190
187
  if (this.isShown && this.options.backdrop) {
191
188
  var doAnimate = $.support.transition && animate
192
189
 
193
- this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
190
+ this.$backdrop = $(document.createElement('div'))
191
+ .addClass('modal-backdrop ' + animate)
194
192
  .appendTo(this.$body)
195
193
 
196
194
  this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
@@ -1,5 +1,5 @@
1
1
  /* ========================================================================
2
- * Bootstrap: popover.js v3.3.4
2
+ * Bootstrap: popover.js v3.3.5
3
3
  * http://getbootstrap.com/javascript/#popovers
4
4
  * ========================================================================
5
5
  * Copyright 2011-2015 Twitter, Inc.
@@ -19,7 +19,7 @@
19
19
 
20
20
  if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
21
21
 
22
- Popover.VERSION = '3.3.4'
22
+ Popover.VERSION = '3.3.5'
23
23
 
24
24
  Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
25
25
  placement: 'right',
@@ -1,5 +1,5 @@
1
1
  /* ========================================================================
2
- * Bootstrap: scrollspy.js v3.3.4
2
+ * Bootstrap: scrollspy.js v3.3.5
3
3
  * http://getbootstrap.com/javascript/#scrollspy
4
4
  * ========================================================================
5
5
  * Copyright 2011-2015 Twitter, Inc.
@@ -28,7 +28,7 @@
28
28
  this.process()
29
29
  }
30
30
 
31
- ScrollSpy.VERSION = '3.3.4'
31
+ ScrollSpy.VERSION = '3.3.5'
32
32
 
33
33
  ScrollSpy.DEFAULTS = {
34
34
  offset: 10
@@ -1,5 +1,5 @@
1
1
  /* ========================================================================
2
- * Bootstrap: tab.js v3.3.4
2
+ * Bootstrap: tab.js v3.3.5
3
3
  * http://getbootstrap.com/javascript/#tabs
4
4
  * ========================================================================
5
5
  * Copyright 2011-2015 Twitter, Inc.
@@ -14,10 +14,12 @@
14
14
  // ====================
15
15
 
16
16
  var Tab = function (element) {
17
+ // jscs:disable requireDollarBeforejQueryAssignment
17
18
  this.element = $(element)
19
+ // jscs:enable requireDollarBeforejQueryAssignment
18
20
  }
19
21
 
20
- Tab.VERSION = '3.3.4'
22
+ Tab.VERSION = '3.3.5'
21
23
 
22
24
  Tab.TRANSITION_DURATION = 150
23
25
 
@@ -65,7 +67,7 @@
65
67
  var $active = container.find('> .active')
66
68
  var transition = callback
67
69
  && $.support.transition
68
- && (($active.length && $active.hasClass('fade')) || !!container.find('> .fade').length)
70
+ && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)
69
71
 
70
72
  function next() {
71
73
  $active
@@ -1,5 +1,5 @@
1
1
  /* ========================================================================
2
- * Bootstrap: tooltip.js v3.3.4
2
+ * Bootstrap: tooltip.js v3.3.5
3
3
  * http://getbootstrap.com/javascript/#tooltip
4
4
  * Inspired by the original jQuery.tipsy by Jason Frame
5
5
  * ========================================================================
@@ -21,11 +21,12 @@
21
21
  this.timeout = null
22
22
  this.hoverState = null
23
23
  this.$element = null
24
+ this.inState = null
24
25
 
25
26
  this.init('tooltip', element, options)
26
27
  }
27
28
 
28
- Tooltip.VERSION = '3.3.4'
29
+ Tooltip.VERSION = '3.3.5'
29
30
 
30
31
  Tooltip.TRANSITION_DURATION = 150
31
32
 
@@ -50,7 +51,8 @@
50
51
  this.type = type
51
52
  this.$element = $(element)
52
53
  this.options = this.getOptions(options)
53
- this.$viewport = this.options.viewport && $(this.options.viewport.selector || this.options.viewport)
54
+ this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))
55
+ this.inState = { click: false, hover: false, focus: false }
54
56
 
55
57
  if (this.$element[0] instanceof document.constructor && !this.options.selector) {
56
58
  throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')
@@ -109,16 +111,20 @@
109
111
  var self = obj instanceof this.constructor ?
110
112
  obj : $(obj.currentTarget).data('bs.' + this.type)
111
113
 
112
- if (self && self.$tip && self.$tip.is(':visible')) {
113
- self.hoverState = 'in'
114
- return
115
- }
116
-
117
114
  if (!self) {
118
115
  self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
119
116
  $(obj.currentTarget).data('bs.' + this.type, self)
120
117
  }
121
118
 
119
+ if (obj instanceof $.Event) {
120
+ self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true
121
+ }
122
+
123
+ if (self.tip().hasClass('in') || self.hoverState == 'in') {
124
+ self.hoverState = 'in'
125
+ return
126
+ }
127
+
122
128
  clearTimeout(self.timeout)
123
129
 
124
130
  self.hoverState = 'in'
@@ -130,6 +136,14 @@
130
136
  }, self.options.delay.show)
131
137
  }
132
138
 
139
+ Tooltip.prototype.isInStateTrue = function () {
140
+ for (var key in this.inState) {
141
+ if (this.inState[key]) return true
142
+ }
143
+
144
+ return false
145
+ }
146
+
133
147
  Tooltip.prototype.leave = function (obj) {
134
148
  var self = obj instanceof this.constructor ?
135
149
  obj : $(obj.currentTarget).data('bs.' + this.type)
@@ -139,6 +153,12 @@
139
153
  $(obj.currentTarget).data('bs.' + this.type, self)
140
154
  }
141
155
 
156
+ if (obj instanceof $.Event) {
157
+ self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false
158
+ }
159
+
160
+ if (self.isInStateTrue()) return
161
+
142
162
  clearTimeout(self.timeout)
143
163
 
144
164
  self.hoverState = 'out'
@@ -185,6 +205,7 @@
185
205
  .data('bs.' + this.type, this)
186
206
 
187
207
  this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
208
+ this.$element.trigger('inserted.bs.' + this.type)
188
209
 
189
210
  var pos = this.getPosition()
190
211
  var actualWidth = $tip[0].offsetWidth
@@ -192,13 +213,12 @@
192
213
 
193
214
  if (autoPlace) {
194
215
  var orgPlacement = placement
195
- var $container = this.options.container ? $(this.options.container) : this.$element.parent()
196
- var containerDim = this.getPosition($container)
216
+ var viewportDim = this.getPosition(this.$viewport)
197
217
 
198
- placement = placement == 'bottom' && pos.bottom + actualHeight > containerDim.bottom ? 'top' :
199
- placement == 'top' && pos.top - actualHeight < containerDim.top ? 'bottom' :
200
- placement == 'right' && pos.right + actualWidth > containerDim.width ? 'left' :
201
- placement == 'left' && pos.left - actualWidth < containerDim.left ? 'right' :
218
+ placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' :
219
+ placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' :
220
+ placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' :
221
+ placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' :
202
222
  placement
203
223
 
204
224
  $tip
@@ -239,8 +259,8 @@
239
259
  if (isNaN(marginTop)) marginTop = 0
240
260
  if (isNaN(marginLeft)) marginLeft = 0
241
261
 
242
- offset.top = offset.top + marginTop
243
- offset.left = offset.left + marginLeft
262
+ offset.top += marginTop
263
+ offset.left += marginLeft
244
264
 
245
265
  // $.fn.offset doesn't round pixel values
246
266
  // so we use setOffset directly with our own function B-0
@@ -322,7 +342,7 @@
322
342
 
323
343
  Tooltip.prototype.fixTitle = function () {
324
344
  var $e = this.$element
325
- if ($e.attr('title') || typeof ($e.attr('data-original-title')) != 'string') {
345
+ if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') {
326
346
  $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
327
347
  }
328
348
  }
@@ -377,7 +397,7 @@
377
397
  var rightEdgeOffset = pos.left + viewportPadding + actualWidth
378
398
  if (leftEdgeOffset < viewportDimensions.left) { // left overflow
379
399
  delta.left = viewportDimensions.left - leftEdgeOffset
380
- } else if (rightEdgeOffset > viewportDimensions.width) { // right overflow
400
+ } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow
381
401
  delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
382
402
  }
383
403
  }
@@ -403,7 +423,13 @@
403
423
  }
404
424
 
405
425
  Tooltip.prototype.tip = function () {
406
- return (this.$tip = this.$tip || $(this.options.template))
426
+ if (!this.$tip) {
427
+ this.$tip = $(this.options.template)
428
+ if (this.$tip.length != 1) {
429
+ throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!')
430
+ }
431
+ }
432
+ return this.$tip
407
433
  }
408
434
 
409
435
  Tooltip.prototype.arrow = function () {
@@ -432,7 +458,13 @@
432
458
  }
433
459
  }
434
460
 
435
- self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
461
+ if (e) {
462
+ self.inState.click = !self.inState.click
463
+ if (self.isInStateTrue()) self.enter(self)
464
+ else self.leave(self)
465
+ } else {
466
+ self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
467
+ }
436
468
  }
437
469
 
438
470
  Tooltip.prototype.destroy = function () {
@@ -440,6 +472,12 @@
440
472
  clearTimeout(this.timeout)
441
473
  this.hide(function () {
442
474
  that.$element.off('.' + that.type).removeData('bs.' + that.type)
475
+ if (that.$tip) {
476
+ that.$tip.detach()
477
+ }
478
+ that.$tip = null
479
+ that.$arrow = null
480
+ that.$viewport = null
443
481
  })
444
482
  }
445
483
 
@@ -1,5 +1,5 @@
1
1
  /* ========================================================================
2
- * Bootstrap: transition.js v3.3.4
2
+ * Bootstrap: transition.js v3.3.5
3
3
  * http://getbootstrap.com/javascript/#transitions
4
4
  * ========================================================================
5
5
  * Copyright 2011-2015 Twitter, Inc.
@@ -4,9 +4,9 @@
4
4
  //= require ./bootstrap/carousel
5
5
  //= require ./bootstrap/collapse
6
6
  //= require ./bootstrap/dropdown
7
- //= require ./bootstrap/modal
8
- //= require ./bootstrap/scrollspy
9
7
  //= require ./bootstrap/tab
10
8
  //= require ./bootstrap/transition
9
+ //= require ./bootstrap/scrollspy
10
+ //= require ./bootstrap/modal
11
11
  //= require ./bootstrap/tooltip
12
12
  //= require ./bootstrap/popover
@@ -1,3 +1,9 @@
1
+ /*!
2
+ * Bootstrap v3.3.5 (http://getbootstrap.com)
3
+ * Copyright 2011-2015 Twitter, Inc.
4
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
5
+ */
6
+
1
7
  // Core variables and mixins
2
8
  @import "bootstrap/variables";
3
9
  @import "bootstrap/mixins";
@@ -12,7 +12,7 @@
12
12
  font-weight: $badge-font-weight;
13
13
  color: $badge-color;
14
14
  line-height: $badge-line-height;
15
- vertical-align: baseline;
15
+ vertical-align: middle;
16
16
  white-space: nowrap;
17
17
  text-align: center;
18
18
  background-color: $badge-bg;