less-rails-bootstrap 3.3.4.0 → 3.3.5.0

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 (48) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/twitter/bootstrap/affix.js +3 -3
  3. data/app/assets/javascripts/twitter/bootstrap/alert.js +2 -2
  4. data/app/assets/javascripts/twitter/bootstrap/button.js +13 -9
  5. data/app/assets/javascripts/twitter/bootstrap/carousel.js +2 -2
  6. data/app/assets/javascripts/twitter/bootstrap/collapse.js +2 -2
  7. data/app/assets/javascripts/twitter/bootstrap/dropdown.js +46 -42
  8. data/app/assets/javascripts/twitter/bootstrap/modal.js +5 -7
  9. data/app/assets/javascripts/twitter/bootstrap/popover.js +2 -2
  10. data/app/assets/javascripts/twitter/bootstrap/scrollspy.js +2 -2
  11. data/app/assets/javascripts/twitter/bootstrap/tab.js +5 -3
  12. data/app/assets/javascripts/twitter/bootstrap/tooltip.js +58 -20
  13. data/app/assets/javascripts/twitter/bootstrap/transition.js +1 -1
  14. data/app/frameworks/twitter/bootstrap/badges.less +1 -1
  15. data/app/frameworks/twitter/bootstrap/bootstrap.less +6 -0
  16. data/app/frameworks/twitter/bootstrap/button-groups.less +3 -2
  17. data/app/frameworks/twitter/bootstrap/buttons.less +11 -5
  18. data/app/frameworks/twitter/bootstrap/carousel.less +2 -2
  19. data/app/frameworks/twitter/bootstrap/dropdowns.less +3 -1
  20. data/app/frameworks/twitter/bootstrap/forms.less +44 -11
  21. data/app/frameworks/twitter/bootstrap/input-groups.less +1 -0
  22. data/app/frameworks/twitter/bootstrap/jumbotron.less +5 -3
  23. data/app/frameworks/twitter/bootstrap/list-group.less +9 -3
  24. data/app/frameworks/twitter/bootstrap/media.less +5 -0
  25. data/app/frameworks/twitter/bootstrap/mixins.less +1 -0
  26. data/app/frameworks/twitter/bootstrap/mixins/background-variant.less +2 -1
  27. data/app/frameworks/twitter/bootstrap/mixins/buttons.less +18 -2
  28. data/app/frameworks/twitter/bootstrap/mixins/grid-framework.less +2 -2
  29. data/app/frameworks/twitter/bootstrap/mixins/grid.less +2 -2
  30. data/app/frameworks/twitter/bootstrap/mixins/hide-text.less +1 -1
  31. data/app/frameworks/twitter/bootstrap/mixins/list-group.less +2 -1
  32. data/app/frameworks/twitter/bootstrap/mixins/pagination.less +2 -1
  33. data/app/frameworks/twitter/bootstrap/mixins/reset-text.less +18 -0
  34. data/app/frameworks/twitter/bootstrap/mixins/responsive-visibility.less +1 -1
  35. data/app/frameworks/twitter/bootstrap/mixins/text-emphasis.less +2 -1
  36. data/app/frameworks/twitter/bootstrap/normalize.less +8 -11
  37. data/app/frameworks/twitter/bootstrap/pagination.less +3 -2
  38. data/app/frameworks/twitter/bootstrap/panels.less +6 -0
  39. data/app/frameworks/twitter/bootstrap/popovers.less +4 -8
  40. data/app/frameworks/twitter/bootstrap/print.less +0 -6
  41. data/app/frameworks/twitter/bootstrap/scaffolding.less +0 -1
  42. data/app/frameworks/twitter/bootstrap/theme.less +23 -5
  43. data/app/frameworks/twitter/bootstrap/tooltip.less +4 -5
  44. data/app/frameworks/twitter/bootstrap/variables.less +7 -1
  45. data/less-rails-bootstrap.gemspec +2 -2
  46. data/lib/less/rails/bootstrap/version.rb +1 -1
  47. data/test/cases/generators/custom_bootstrap_generator_test.rb +1 -1
  48. metadata +5 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c95b47ea03102ea4ffcc8121c56f4789cf0bb195
4
- data.tar.gz: 08fe0dc6fe4aa8e2572a9674f99693972720cdba
3
+ metadata.gz: cf4531ee8fe096b3a8e241f3e4012937e78450dc
4
+ data.tar.gz: 8a411c257d2f2c657ed1d03a9af985ce2fa2ab53
5
5
  SHA512:
6
- metadata.gz: c6778120333cf8f37ce9d149650b7e9604967e2a17ca16644abb2024bb5609d84d2c6fcfef626011d9b71f81b900356fa0ccd74a11eb17fd82a0bb0ea3bcd8e6
7
- data.tar.gz: ba870d26b82ed50ae2262052a8d23a85c9d008b5b660f8f267f804a794d7cee1bfb1f7f4e26b321f1c1589f07d692d3c741f6a5982ad39703023778b1e2814a9
6
+ metadata.gz: 414dec54b2a4e55b5efca9c28de38196391d0aebd5b62050452c5354d526164defada4dd0580c5edf120edfc7897492585e27f347068f6f6ff552e446add5f89
7
+ data.tar.gz: 04a398cf3f38e191bba8a088833547a656bd9749014359d5fefe34e413c90e3802129bf741139fe3b3b6ab55c24effa84321114e2ec3f040fa9ea8b54e5f8168
@@ -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