bootstrap 4.0.0.alpha4 → 4.0.0.alpha5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bootstrap might be problematic. Click here for more details.

Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/assets/javascripts/bootstrap.js +1625 -1768
  4. data/assets/javascripts/bootstrap.min.js +3 -3
  5. data/assets/javascripts/bootstrap/alert.js +83 -96
  6. data/assets/javascripts/bootstrap/button.js +61 -68
  7. data/assets/javascripts/bootstrap/carousel.js +250 -270
  8. data/assets/javascripts/bootstrap/collapse.js +176 -190
  9. data/assets/javascripts/bootstrap/dropdown.js +143 -155
  10. data/assets/javascripts/bootstrap/modal.js +286 -310
  11. data/assets/javascripts/bootstrap/popover.js +61 -69
  12. data/assets/javascripts/bootstrap/scrollspy.js +145 -157
  13. data/assets/javascripts/bootstrap/tab.js +122 -132
  14. data/assets/javascripts/bootstrap/tooltip.js +313 -341
  15. data/assets/javascripts/bootstrap/util.js +9 -16
  16. data/assets/stylesheets/_bootstrap.scss +1 -1
  17. data/assets/stylesheets/bootstrap/_alert.scss +3 -3
  18. data/assets/stylesheets/bootstrap/_animation.scss +12 -3
  19. data/assets/stylesheets/bootstrap/_button-group.scss +1 -0
  20. data/assets/stylesheets/bootstrap/_card.scss +3 -1
  21. data/assets/stylesheets/bootstrap/_custom-forms.scss +7 -10
  22. data/assets/stylesheets/bootstrap/_dropdown.scss +1 -0
  23. data/assets/stylesheets/bootstrap/_forms.scss +16 -6
  24. data/assets/stylesheets/bootstrap/_images.scss +2 -11
  25. data/assets/stylesheets/bootstrap/_list-group.scss +2 -0
  26. data/assets/stylesheets/bootstrap/_mixins.scss +1 -1
  27. data/assets/stylesheets/bootstrap/_modal.scss +4 -2
  28. data/assets/stylesheets/bootstrap/_navbar.scss +72 -13
  29. data/assets/stylesheets/bootstrap/_normalize.scss +51 -53
  30. data/assets/stylesheets/bootstrap/_popover.scss +74 -50
  31. data/assets/stylesheets/bootstrap/_print.scss +8 -2
  32. data/assets/stylesheets/bootstrap/_reboot.scss +7 -12
  33. data/assets/stylesheets/bootstrap/_tables.scss +1 -1
  34. data/assets/stylesheets/bootstrap/_tooltip.scss +15 -12
  35. data/assets/stylesheets/bootstrap/_utilities.scss +3 -1
  36. data/assets/stylesheets/bootstrap/_variables.scss +56 -28
  37. data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +0 -1
  38. data/assets/stylesheets/bootstrap/mixins/{_pulls.scss → _float.scss} +2 -2
  39. data/assets/stylesheets/bootstrap/mixins/_forms.scss +6 -11
  40. data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +8 -9
  41. data/assets/stylesheets/bootstrap/mixins/_grid.scss +31 -8
  42. data/assets/stylesheets/bootstrap/mixins/_hover.scss +1 -1
  43. data/assets/stylesheets/bootstrap/mixins/_image.scss +6 -4
  44. data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +1 -1
  45. data/assets/stylesheets/bootstrap/utilities/_align.scss +6 -0
  46. data/assets/stylesheets/bootstrap/utilities/_borders.scss +30 -0
  47. data/assets/stylesheets/bootstrap/utilities/_float.scss +13 -0
  48. data/assets/stylesheets/bootstrap/utilities/_spacing.scss +10 -9
  49. data/assets/stylesheets/bootstrap/utilities/_text.scss +8 -0
  50. data/lib/bootstrap/version.rb +2 -2
  51. data/templates/project/_bootstrap-variables.scss +55 -27
  52. metadata +6 -4
  53. data/assets/stylesheets/bootstrap/utilities/_pulls.scss +0 -13
@@ -1,17 +1,15 @@
1
- 'use strict';
1
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
2
2
 
3
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
4
-
5
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
3
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
4
 
7
5
  /**
8
6
  * --------------------------------------------------------------------------
9
- * Bootstrap (v4.0.0-alpha.4): tab.js
7
+ * Bootstrap (v4.0.0-alpha.5): tab.js
10
8
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
11
9
  * --------------------------------------------------------------------------
12
10
  */
13
11
 
14
- var Tab = (function ($) {
12
+ var Tab = function ($) {
15
13
 
16
14
  /**
17
15
  * ------------------------------------------------------------------------
@@ -20,7 +18,7 @@ var Tab = (function ($) {
20
18
  */
21
19
 
22
20
  var NAME = 'tab';
23
- var VERSION = '4.0.0-alpha.4';
21
+ var VERSION = '4.0.0-alpha.5';
24
22
  var DATA_KEY = 'bs.tab';
25
23
  var EVENT_KEY = '.' + DATA_KEY;
26
24
  var DATA_API_KEY = '.data-api';
@@ -61,176 +59,162 @@ var Tab = (function ($) {
61
59
  * ------------------------------------------------------------------------
62
60
  */
63
61
 
64
- var Tab = (function () {
62
+ var Tab = function () {
65
63
  function Tab(element) {
66
64
  _classCallCheck(this, Tab);
67
65
 
68
66
  this._element = element;
69
67
  }
70
68
 
71
- /**
72
- * ------------------------------------------------------------------------
73
- * Data Api implementation
74
- * ------------------------------------------------------------------------
75
- */
76
-
77
69
  // getters
78
70
 
79
- _createClass(Tab, [{
80
- key: 'show',
81
-
82
- // public
71
+ // public
83
72
 
84
- value: function show() {
85
- var _this = this;
73
+ Tab.prototype.show = function show() {
74
+ var _this = this;
86
75
 
87
- if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName.ACTIVE)) {
88
- return;
89
- }
76
+ if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName.ACTIVE)) {
77
+ return;
78
+ }
90
79
 
91
- var target = undefined;
92
- var previous = undefined;
93
- var ulElement = $(this._element).closest(Selector.UL)[0];
94
- var selector = Util.getSelectorFromElement(this._element);
80
+ var target = void 0;
81
+ var previous = void 0;
82
+ var ulElement = $(this._element).closest(Selector.UL)[0];
83
+ var selector = Util.getSelectorFromElement(this._element);
95
84
 
96
- if (ulElement) {
97
- previous = $.makeArray($(ulElement).find(Selector.ACTIVE));
98
- previous = previous[previous.length - 1];
99
- }
85
+ if (ulElement) {
86
+ previous = $.makeArray($(ulElement).find(Selector.ACTIVE));
87
+ previous = previous[previous.length - 1];
88
+ }
100
89
 
101
- var hideEvent = $.Event(Event.HIDE, {
102
- relatedTarget: this._element
103
- });
90
+ var hideEvent = $.Event(Event.HIDE, {
91
+ relatedTarget: this._element
92
+ });
104
93
 
105
- var showEvent = $.Event(Event.SHOW, {
106
- relatedTarget: previous
107
- });
94
+ var showEvent = $.Event(Event.SHOW, {
95
+ relatedTarget: previous
96
+ });
108
97
 
109
- if (previous) {
110
- $(previous).trigger(hideEvent);
111
- }
98
+ if (previous) {
99
+ $(previous).trigger(hideEvent);
100
+ }
112
101
 
113
- $(this._element).trigger(showEvent);
102
+ $(this._element).trigger(showEvent);
114
103
 
115
- if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
116
- return;
117
- }
104
+ if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
105
+ return;
106
+ }
118
107
 
119
- if (selector) {
120
- target = $(selector)[0];
121
- }
108
+ if (selector) {
109
+ target = $(selector)[0];
110
+ }
122
111
 
123
- this._activate(this._element, ulElement);
112
+ this._activate(this._element, ulElement);
124
113
 
125
- var complete = function complete() {
126
- var hiddenEvent = $.Event(Event.HIDDEN, {
127
- relatedTarget: _this._element
128
- });
114
+ var complete = function complete() {
115
+ var hiddenEvent = $.Event(Event.HIDDEN, {
116
+ relatedTarget: _this._element
117
+ });
129
118
 
130
- var shownEvent = $.Event(Event.SHOWN, {
131
- relatedTarget: previous
132
- });
119
+ var shownEvent = $.Event(Event.SHOWN, {
120
+ relatedTarget: previous
121
+ });
133
122
 
134
- $(previous).trigger(hiddenEvent);
135
- $(_this._element).trigger(shownEvent);
136
- };
123
+ $(previous).trigger(hiddenEvent);
124
+ $(_this._element).trigger(shownEvent);
125
+ };
137
126
 
138
- if (target) {
139
- this._activate(target, target.parentNode, complete);
140
- } else {
141
- complete();
142
- }
143
- }
144
- }, {
145
- key: 'dispose',
146
- value: function dispose() {
147
- $.removeClass(this._element, DATA_KEY);
148
- this._element = null;
127
+ if (target) {
128
+ this._activate(target, target.parentNode, complete);
129
+ } else {
130
+ complete();
149
131
  }
132
+ };
150
133
 
151
- // private
134
+ Tab.prototype.dispose = function dispose() {
135
+ $.removeClass(this._element, DATA_KEY);
136
+ this._element = null;
137
+ };
152
138
 
153
- }, {
154
- key: '_activate',
155
- value: function _activate(element, container, callback) {
156
- var active = $(container).find(Selector.ACTIVE_CHILD)[0];
157
- var isTransitioning = callback && Util.supportsTransitionEnd() && (active && $(active).hasClass(ClassName.FADE) || Boolean($(container).find(Selector.FADE_CHILD)[0]));
139
+ // private
158
140
 
159
- var complete = $.proxy(this._transitionComplete, this, element, active, isTransitioning, callback);
141
+ Tab.prototype._activate = function _activate(element, container, callback) {
142
+ var active = $(container).find(Selector.ACTIVE_CHILD)[0];
143
+ var isTransitioning = callback && Util.supportsTransitionEnd() && (active && $(active).hasClass(ClassName.FADE) || Boolean($(container).find(Selector.FADE_CHILD)[0]));
160
144
 
161
- if (active && isTransitioning) {
162
- $(active).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
163
- } else {
164
- complete();
165
- }
145
+ var complete = $.proxy(this._transitionComplete, this, element, active, isTransitioning, callback);
166
146
 
167
- if (active) {
168
- $(active).removeClass(ClassName.IN);
169
- }
147
+ if (active && isTransitioning) {
148
+ $(active).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
149
+ } else {
150
+ complete();
170
151
  }
171
- }, {
172
- key: '_transitionComplete',
173
- value: function _transitionComplete(element, active, isTransitioning, callback) {
174
- if (active) {
175
- $(active).removeClass(ClassName.ACTIVE);
176
152
 
177
- var dropdownChild = $(active).find(Selector.DROPDOWN_ACTIVE_CHILD)[0];
153
+ if (active) {
154
+ $(active).removeClass(ClassName.IN);
155
+ }
156
+ };
178
157
 
179
- if (dropdownChild) {
180
- $(dropdownChild).removeClass(ClassName.ACTIVE);
181
- }
158
+ Tab.prototype._transitionComplete = function _transitionComplete(element, active, isTransitioning, callback) {
159
+ if (active) {
160
+ $(active).removeClass(ClassName.ACTIVE);
161
+
162
+ var dropdownChild = $(active).find(Selector.DROPDOWN_ACTIVE_CHILD)[0];
182
163
 
183
- active.setAttribute('aria-expanded', false);
164
+ if (dropdownChild) {
165
+ $(dropdownChild).removeClass(ClassName.ACTIVE);
184
166
  }
185
167
 
186
- $(element).addClass(ClassName.ACTIVE);
187
- element.setAttribute('aria-expanded', true);
168
+ active.setAttribute('aria-expanded', false);
169
+ }
188
170
 
189
- if (isTransitioning) {
190
- Util.reflow(element);
191
- $(element).addClass(ClassName.IN);
192
- } else {
193
- $(element).removeClass(ClassName.FADE);
194
- }
171
+ $(element).addClass(ClassName.ACTIVE);
172
+ element.setAttribute('aria-expanded', true);
195
173
 
196
- if (element.parentNode && $(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) {
174
+ if (isTransitioning) {
175
+ Util.reflow(element);
176
+ $(element).addClass(ClassName.IN);
177
+ } else {
178
+ $(element).removeClass(ClassName.FADE);
179
+ }
197
180
 
198
- var dropdownElement = $(element).closest(Selector.DROPDOWN)[0];
199
- if (dropdownElement) {
200
- $(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
201
- }
181
+ if (element.parentNode && $(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) {
202
182
 
203
- element.setAttribute('aria-expanded', true);
183
+ var dropdownElement = $(element).closest(Selector.DROPDOWN)[0];
184
+ if (dropdownElement) {
185
+ $(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE);
204
186
  }
205
187
 
206
- if (callback) {
207
- callback();
208
- }
188
+ element.setAttribute('aria-expanded', true);
209
189
  }
210
190
 
211
- // static
191
+ if (callback) {
192
+ callback();
193
+ }
194
+ };
212
195
 
213
- }], [{
214
- key: '_jQueryInterface',
215
- value: function _jQueryInterface(config) {
216
- return this.each(function () {
217
- var $this = $(this);
218
- var data = $this.data(DATA_KEY);
196
+ // static
219
197
 
220
- if (!data) {
221
- data = data = new Tab(this);
222
- $this.data(DATA_KEY, data);
223
- }
198
+ Tab._jQueryInterface = function _jQueryInterface(config) {
199
+ return this.each(function () {
200
+ var $this = $(this);
201
+ var data = $this.data(DATA_KEY);
224
202
 
225
- if (typeof config === 'string') {
226
- if (data[config] === undefined) {
227
- throw new Error('No method named "' + config + '"');
228
- }
229
- data[config]();
203
+ if (!data) {
204
+ data = data = new Tab(this);
205
+ $this.data(DATA_KEY, data);
206
+ }
207
+
208
+ if (typeof config === 'string') {
209
+ if (data[config] === undefined) {
210
+ throw new Error('No method named "' + config + '"');
230
211
  }
231
- });
232
- }
233
- }, {
212
+ data[config]();
213
+ }
214
+ });
215
+ };
216
+
217
+ _createClass(Tab, null, [{
234
218
  key: 'VERSION',
235
219
  get: function get() {
236
220
  return VERSION;
@@ -238,7 +222,13 @@ var Tab = (function ($) {
238
222
  }]);
239
223
 
240
224
  return Tab;
241
- })();
225
+ }();
226
+
227
+ /**
228
+ * ------------------------------------------------------------------------
229
+ * Data Api implementation
230
+ * ------------------------------------------------------------------------
231
+ */
242
232
 
243
233
  $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
244
234
  event.preventDefault();
@@ -259,4 +249,4 @@ var Tab = (function ($) {
259
249
  };
260
250
 
261
251
  return Tab;
262
- })(jQuery);
252
+ }(jQuery);
@@ -1,26 +1,24 @@
1
- /* global Tether */
1
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
2
2
 
3
- 'use strict';
3
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
4
4
 
5
- var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
6
-
7
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
5
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
6
 
9
7
  /**
10
8
  * --------------------------------------------------------------------------
11
- * Bootstrap (v4.0.0-alpha.4): tooltip.js
9
+ * Bootstrap (v4.0.0-alpha.5): tooltip.js
12
10
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
13
11
  * --------------------------------------------------------------------------
14
12
  */
15
13
 
16
- var Tooltip = (function ($) {
14
+ var Tooltip = function ($) {
17
15
 
18
16
  /**
19
17
  * Check for Tether dependency
20
- * Tether - http://github.hubspot.com/tether/
18
+ * Tether - http://tether.io/
21
19
  */
22
20
  if (window.Tether === undefined) {
23
- throw new Error('Bootstrap tooltips require Tether (http://github.hubspot.com/tether/)');
21
+ throw new Error('Bootstrap tooltips require Tether (http://tether.io/)');
24
22
  }
25
23
 
26
24
  /**
@@ -30,7 +28,7 @@ var Tooltip = (function ($) {
30
28
  */
31
29
 
32
30
  var NAME = 'tooltip';
33
- var VERSION = '4.0.0-alpha.4';
31
+ var VERSION = '4.0.0-alpha.5';
34
32
  var DATA_KEY = 'bs.tooltip';
35
33
  var EVENT_KEY = '.' + DATA_KEY;
36
34
  var JQUERY_NO_CONFLICT = $.fn[NAME];
@@ -39,7 +37,7 @@ var Tooltip = (function ($) {
39
37
 
40
38
  var Default = {
41
39
  animation: true,
42
- template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div></div>',
40
+ template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-inner"></div></div>',
43
41
  trigger: 'hover focus',
44
42
  title: '',
45
43
  delay: 0,
@@ -116,7 +114,7 @@ var Tooltip = (function ($) {
116
114
  * ------------------------------------------------------------------------
117
115
  */
118
116
 
119
- var Tooltip = (function () {
117
+ var Tooltip = function () {
120
118
  function Tooltip(element, config) {
121
119
  _classCallCheck(this, Tooltip);
122
120
 
@@ -135,439 +133,407 @@ var Tooltip = (function ($) {
135
133
  this._setListeners();
136
134
  }
137
135
 
138
- /**
139
- * ------------------------------------------------------------------------
140
- * jQuery
141
- * ------------------------------------------------------------------------
142
- */
143
-
144
136
  // getters
145
137
 
146
- _createClass(Tooltip, [{
147
- key: 'enable',
148
-
149
- // public
138
+ // public
150
139
 
151
- value: function enable() {
152
- this._isEnabled = true;
153
- }
154
- }, {
155
- key: 'disable',
156
- value: function disable() {
157
- this._isEnabled = false;
158
- }
159
- }, {
160
- key: 'toggleEnabled',
161
- value: function toggleEnabled() {
162
- this._isEnabled = !this._isEnabled;
163
- }
164
- }, {
165
- key: 'toggle',
166
- value: function toggle(event) {
167
- if (event) {
168
- var dataKey = this.constructor.DATA_KEY;
169
- var context = $(event.currentTarget).data(dataKey);
170
-
171
- if (!context) {
172
- context = new this.constructor(event.currentTarget, this._getDelegateConfig());
173
- $(event.currentTarget).data(dataKey, context);
174
- }
140
+ Tooltip.prototype.enable = function enable() {
141
+ this._isEnabled = true;
142
+ };
175
143
 
176
- context._activeTrigger.click = !context._activeTrigger.click;
144
+ Tooltip.prototype.disable = function disable() {
145
+ this._isEnabled = false;
146
+ };
177
147
 
178
- if (context._isWithActiveTrigger()) {
179
- context._enter(null, context);
180
- } else {
181
- context._leave(null, context);
182
- }
183
- } else {
148
+ Tooltip.prototype.toggleEnabled = function toggleEnabled() {
149
+ this._isEnabled = !this._isEnabled;
150
+ };
184
151
 
185
- if ($(this.getTipElement()).hasClass(ClassName.IN)) {
186
- this._leave(null, this);
187
- return;
188
- }
152
+ Tooltip.prototype.toggle = function toggle(event) {
153
+ if (event) {
154
+ var dataKey = this.constructor.DATA_KEY;
155
+ var context = $(event.currentTarget).data(dataKey);
189
156
 
190
- this._enter(null, this);
157
+ if (!context) {
158
+ context = new this.constructor(event.currentTarget, this._getDelegateConfig());
159
+ $(event.currentTarget).data(dataKey, context);
191
160
  }
192
- }
193
- }, {
194
- key: 'dispose',
195
- value: function dispose() {
196
- clearTimeout(this._timeout);
197
161
 
198
- this.cleanupTether();
162
+ context._activeTrigger.click = !context._activeTrigger.click;
199
163
 
200
- $.removeData(this.element, this.constructor.DATA_KEY);
201
-
202
- $(this.element).off(this.constructor.EVENT_KEY);
203
-
204
- if (this.tip) {
205
- $(this.tip).remove();
164
+ if (context._isWithActiveTrigger()) {
165
+ context._enter(null, context);
166
+ } else {
167
+ context._leave(null, context);
206
168
  }
169
+ } else {
207
170
 
208
- this._isEnabled = null;
209
- this._timeout = null;
210
- this._hoverState = null;
211
- this._activeTrigger = null;
212
- this._tether = null;
171
+ if ($(this.getTipElement()).hasClass(ClassName.IN)) {
172
+ this._leave(null, this);
173
+ return;
174
+ }
213
175
 
214
- this.element = null;
215
- this.config = null;
216
- this.tip = null;
176
+ this._enter(null, this);
217
177
  }
218
- }, {
219
- key: 'show',
220
- value: function show() {
221
- var _this = this;
178
+ };
222
179
 
223
- var showEvent = $.Event(this.constructor.Event.SHOW);
180
+ Tooltip.prototype.dispose = function dispose() {
181
+ clearTimeout(this._timeout);
224
182
 
225
- if (this.isWithContent() && this._isEnabled) {
226
- $(this.element).trigger(showEvent);
183
+ this.cleanupTether();
227
184
 
228
- var isInTheDom = $.contains(this.element.ownerDocument.documentElement, this.element);
185
+ $.removeData(this.element, this.constructor.DATA_KEY);
229
186
 
230
- if (showEvent.isDefaultPrevented() || !isInTheDom) {
231
- return;
232
- }
187
+ $(this.element).off(this.constructor.EVENT_KEY);
233
188
 
234
- var tip = this.getTipElement();
235
- var tipId = Util.getUID(this.constructor.NAME);
189
+ if (this.tip) {
190
+ $(this.tip).remove();
191
+ }
236
192
 
237
- tip.setAttribute('id', tipId);
238
- this.element.setAttribute('aria-describedby', tipId);
193
+ this._isEnabled = null;
194
+ this._timeout = null;
195
+ this._hoverState = null;
196
+ this._activeTrigger = null;
197
+ this._tether = null;
239
198
 
240
- this.setContent();
199
+ this.element = null;
200
+ this.config = null;
201
+ this.tip = null;
202
+ };
241
203
 
242
- if (this.config.animation) {
243
- $(tip).addClass(ClassName.FADE);
244
- }
204
+ Tooltip.prototype.show = function show() {
205
+ var _this = this;
245
206
 
246
- var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
207
+ var showEvent = $.Event(this.constructor.Event.SHOW);
247
208
 
248
- var attachment = this._getAttachment(placement);
209
+ if (this.isWithContent() && this._isEnabled) {
210
+ $(this.element).trigger(showEvent);
249
211
 
250
- $(tip).data(this.constructor.DATA_KEY, this).appendTo(document.body);
212
+ var isInTheDom = $.contains(this.element.ownerDocument.documentElement, this.element);
251
213
 
252
- $(this.element).trigger(this.constructor.Event.INSERTED);
214
+ if (showEvent.isDefaultPrevented() || !isInTheDom) {
215
+ return;
216
+ }
253
217
 
254
- this._tether = new Tether({
255
- attachment: attachment,
256
- element: tip,
257
- target: this.element,
258
- classes: TetherClass,
259
- classPrefix: CLASS_PREFIX,
260
- offset: this.config.offset,
261
- constraints: this.config.constraints,
262
- addTargetClasses: false
263
- });
218
+ var tip = this.getTipElement();
219
+ var tipId = Util.getUID(this.constructor.NAME);
264
220
 
265
- Util.reflow(tip);
266
- this._tether.position();
221
+ tip.setAttribute('id', tipId);
222
+ this.element.setAttribute('aria-describedby', tipId);
267
223
 
268
- $(tip).addClass(ClassName.IN);
224
+ this.setContent();
269
225
 
270
- var complete = function complete() {
271
- var prevHoverState = _this._hoverState;
272
- _this._hoverState = null;
226
+ if (this.config.animation) {
227
+ $(tip).addClass(ClassName.FADE);
228
+ }
273
229
 
274
- $(_this.element).trigger(_this.constructor.Event.SHOWN);
230
+ var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
275
231
 
276
- if (prevHoverState === HoverState.OUT) {
277
- _this._leave(null, _this);
278
- }
279
- };
232
+ var attachment = this._getAttachment(placement);
280
233
 
281
- if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
282
- $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(Tooltip._TRANSITION_DURATION);
283
- return;
284
- }
234
+ $(tip).data(this.constructor.DATA_KEY, this).appendTo(document.body);
285
235
 
286
- complete();
287
- }
288
- }
289
- }, {
290
- key: 'hide',
291
- value: function hide(callback) {
292
- var _this2 = this;
236
+ $(this.element).trigger(this.constructor.Event.INSERTED);
237
+
238
+ this._tether = new Tether({
239
+ attachment: attachment,
240
+ element: tip,
241
+ target: this.element,
242
+ classes: TetherClass,
243
+ classPrefix: CLASS_PREFIX,
244
+ offset: this.config.offset,
245
+ constraints: this.config.constraints,
246
+ addTargetClasses: false
247
+ });
248
+
249
+ Util.reflow(tip);
250
+ this._tether.position();
251
+
252
+ $(tip).addClass(ClassName.IN);
293
253
 
294
- var tip = this.getTipElement();
295
- var hideEvent = $.Event(this.constructor.Event.HIDE);
296
254
  var complete = function complete() {
297
- if (_this2._hoverState !== HoverState.IN && tip.parentNode) {
298
- tip.parentNode.removeChild(tip);
299
- }
255
+ var prevHoverState = _this._hoverState;
256
+ _this._hoverState = null;
300
257
 
301
- _this2.element.removeAttribute('aria-describedby');
302
- $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
303
- _this2.cleanupTether();
258
+ $(_this.element).trigger(_this.constructor.Event.SHOWN);
304
259
 
305
- if (callback) {
306
- callback();
260
+ if (prevHoverState === HoverState.OUT) {
261
+ _this._leave(null, _this);
307
262
  }
308
263
  };
309
264
 
310
- $(this.element).trigger(hideEvent);
311
-
312
- if (hideEvent.isDefaultPrevented()) {
265
+ if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
266
+ $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(Tooltip._TRANSITION_DURATION);
313
267
  return;
314
268
  }
315
269
 
316
- $(tip).removeClass(ClassName.IN);
270
+ complete();
271
+ }
272
+ };
317
273
 
318
- if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
274
+ Tooltip.prototype.hide = function hide(callback) {
275
+ var _this2 = this;
319
276
 
320
- $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
321
- } else {
322
- complete();
277
+ var tip = this.getTipElement();
278
+ var hideEvent = $.Event(this.constructor.Event.HIDE);
279
+ var complete = function complete() {
280
+ if (_this2._hoverState !== HoverState.IN && tip.parentNode) {
281
+ tip.parentNode.removeChild(tip);
323
282
  }
324
283
 
325
- this._hoverState = '';
326
- }
284
+ _this2.element.removeAttribute('aria-describedby');
285
+ $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
286
+ _this2.cleanupTether();
327
287
 
328
- // protected
288
+ if (callback) {
289
+ callback();
290
+ }
291
+ };
329
292
 
330
- }, {
331
- key: 'isWithContent',
332
- value: function isWithContent() {
333
- return Boolean(this.getTitle());
334
- }
335
- }, {
336
- key: 'getTipElement',
337
- value: function getTipElement() {
338
- return this.tip = this.tip || $(this.config.template)[0];
293
+ $(this.element).trigger(hideEvent);
294
+
295
+ if (hideEvent.isDefaultPrevented()) {
296
+ return;
339
297
  }
340
- }, {
341
- key: 'setContent',
342
- value: function setContent() {
343
- var $tip = $(this.getTipElement());
344
298
 
345
- this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle());
299
+ $(tip).removeClass(ClassName.IN);
346
300
 
347
- $tip.removeClass(ClassName.FADE).removeClass(ClassName.IN);
301
+ if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) {
348
302
 
349
- this.cleanupTether();
303
+ $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION);
304
+ } else {
305
+ complete();
350
306
  }
351
- }, {
352
- key: 'setElementContent',
353
- value: function setElementContent($element, content) {
354
- var html = this.config.html;
355
- if (typeof content === 'object' && (content.nodeType || content.jquery)) {
356
- // content is a DOM node or a jQuery
357
- if (html) {
358
- if (!$(content).parent().is($element)) {
359
- $element.empty().append(content);
360
- }
361
- } else {
362
- $element.text($(content).text());
307
+
308
+ this._hoverState = '';
309
+ };
310
+
311
+ // protected
312
+
313
+ Tooltip.prototype.isWithContent = function isWithContent() {
314
+ return Boolean(this.getTitle());
315
+ };
316
+
317
+ Tooltip.prototype.getTipElement = function getTipElement() {
318
+ return this.tip = this.tip || $(this.config.template)[0];
319
+ };
320
+
321
+ Tooltip.prototype.setContent = function setContent() {
322
+ var $tip = $(this.getTipElement());
323
+
324
+ this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle());
325
+
326
+ $tip.removeClass(ClassName.FADE).removeClass(ClassName.IN);
327
+
328
+ this.cleanupTether();
329
+ };
330
+
331
+ Tooltip.prototype.setElementContent = function setElementContent($element, content) {
332
+ var html = this.config.html;
333
+ if ((typeof content === 'undefined' ? 'undefined' : _typeof(content)) === 'object' && (content.nodeType || content.jquery)) {
334
+ // content is a DOM node or a jQuery
335
+ if (html) {
336
+ if (!$(content).parent().is($element)) {
337
+ $element.empty().append(content);
363
338
  }
364
339
  } else {
365
- $element[html ? 'html' : 'text'](content);
340
+ $element.text($(content).text());
366
341
  }
342
+ } else {
343
+ $element[html ? 'html' : 'text'](content);
367
344
  }
368
- }, {
369
- key: 'getTitle',
370
- value: function getTitle() {
371
- var title = this.element.getAttribute('data-original-title');
345
+ };
372
346
 
373
- if (!title) {
374
- title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
375
- }
347
+ Tooltip.prototype.getTitle = function getTitle() {
348
+ var title = this.element.getAttribute('data-original-title');
376
349
 
377
- return title;
378
- }
379
- }, {
380
- key: 'cleanupTether',
381
- value: function cleanupTether() {
382
- if (this._tether) {
383
- this._tether.destroy();
384
- }
350
+ if (!title) {
351
+ title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
385
352
  }
386
353
 
387
- // private
354
+ return title;
355
+ };
388
356
 
389
- }, {
390
- key: '_getAttachment',
391
- value: function _getAttachment(placement) {
392
- return AttachmentMap[placement.toUpperCase()];
357
+ Tooltip.prototype.cleanupTether = function cleanupTether() {
358
+ if (this._tether) {
359
+ this._tether.destroy();
393
360
  }
394
- }, {
395
- key: '_setListeners',
396
- value: function _setListeners() {
397
- var _this3 = this;
361
+ };
398
362
 
399
- var triggers = this.config.trigger.split(' ');
363
+ // private
400
364
 
401
- triggers.forEach(function (trigger) {
402
- if (trigger === 'click') {
403
- $(_this3.element).on(_this3.constructor.Event.CLICK, _this3.config.selector, $.proxy(_this3.toggle, _this3));
404
- } else if (trigger !== Trigger.MANUAL) {
405
- var eventIn = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSEENTER : _this3.constructor.Event.FOCUSIN;
406
- var eventOut = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSELEAVE : _this3.constructor.Event.FOCUSOUT;
365
+ Tooltip.prototype._getAttachment = function _getAttachment(placement) {
366
+ return AttachmentMap[placement.toUpperCase()];
367
+ };
407
368
 
408
- $(_this3.element).on(eventIn, _this3.config.selector, $.proxy(_this3._enter, _this3)).on(eventOut, _this3.config.selector, $.proxy(_this3._leave, _this3));
409
- }
410
- });
369
+ Tooltip.prototype._setListeners = function _setListeners() {
370
+ var _this3 = this;
411
371
 
412
- if (this.config.selector) {
413
- this.config = $.extend({}, this.config, {
414
- trigger: 'manual',
415
- selector: ''
416
- });
417
- } else {
418
- this._fixTitle();
419
- }
420
- }
421
- }, {
422
- key: '_fixTitle',
423
- value: function _fixTitle() {
424
- var titleType = typeof this.element.getAttribute('data-original-title');
425
- if (this.element.getAttribute('title') || titleType !== 'string') {
426
- this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
427
- this.element.setAttribute('title', '');
372
+ var triggers = this.config.trigger.split(' ');
373
+
374
+ triggers.forEach(function (trigger) {
375
+ if (trigger === 'click') {
376
+ $(_this3.element).on(_this3.constructor.Event.CLICK, _this3.config.selector, $.proxy(_this3.toggle, _this3));
377
+ } else if (trigger !== Trigger.MANUAL) {
378
+ var eventIn = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSEENTER : _this3.constructor.Event.FOCUSIN;
379
+ var eventOut = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSELEAVE : _this3.constructor.Event.FOCUSOUT;
380
+
381
+ $(_this3.element).on(eventIn, _this3.config.selector, $.proxy(_this3._enter, _this3)).on(eventOut, _this3.config.selector, $.proxy(_this3._leave, _this3));
428
382
  }
383
+ });
384
+
385
+ if (this.config.selector) {
386
+ this.config = $.extend({}, this.config, {
387
+ trigger: 'manual',
388
+ selector: ''
389
+ });
390
+ } else {
391
+ this._fixTitle();
429
392
  }
430
- }, {
431
- key: '_enter',
432
- value: function _enter(event, context) {
433
- var dataKey = this.constructor.DATA_KEY;
393
+ };
434
394
 
435
- context = context || $(event.currentTarget).data(dataKey);
395
+ Tooltip.prototype._fixTitle = function _fixTitle() {
396
+ var titleType = _typeof(this.element.getAttribute('data-original-title'));
397
+ if (this.element.getAttribute('title') || titleType !== 'string') {
398
+ this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
399
+ this.element.setAttribute('title', '');
400
+ }
401
+ };
436
402
 
437
- if (!context) {
438
- context = new this.constructor(event.currentTarget, this._getDelegateConfig());
439
- $(event.currentTarget).data(dataKey, context);
440
- }
403
+ Tooltip.prototype._enter = function _enter(event, context) {
404
+ var dataKey = this.constructor.DATA_KEY;
441
405
 
442
- if (event) {
443
- context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
444
- }
406
+ context = context || $(event.currentTarget).data(dataKey);
445
407
 
446
- if ($(context.getTipElement()).hasClass(ClassName.IN) || context._hoverState === HoverState.IN) {
447
- context._hoverState = HoverState.IN;
448
- return;
449
- }
408
+ if (!context) {
409
+ context = new this.constructor(event.currentTarget, this._getDelegateConfig());
410
+ $(event.currentTarget).data(dataKey, context);
411
+ }
450
412
 
451
- clearTimeout(context._timeout);
413
+ if (event) {
414
+ context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
415
+ }
452
416
 
417
+ if ($(context.getTipElement()).hasClass(ClassName.IN) || context._hoverState === HoverState.IN) {
453
418
  context._hoverState = HoverState.IN;
419
+ return;
420
+ }
421
+
422
+ clearTimeout(context._timeout);
423
+
424
+ context._hoverState = HoverState.IN;
454
425
 
455
- if (!context.config.delay || !context.config.delay.show) {
426
+ if (!context.config.delay || !context.config.delay.show) {
427
+ context.show();
428
+ return;
429
+ }
430
+
431
+ context._timeout = setTimeout(function () {
432
+ if (context._hoverState === HoverState.IN) {
456
433
  context.show();
457
- return;
458
434
  }
435
+ }, context.config.delay.show);
436
+ };
459
437
 
460
- context._timeout = setTimeout(function () {
461
- if (context._hoverState === HoverState.IN) {
462
- context.show();
463
- }
464
- }, context.config.delay.show);
465
- }
466
- }, {
467
- key: '_leave',
468
- value: function _leave(event, context) {
469
- var dataKey = this.constructor.DATA_KEY;
438
+ Tooltip.prototype._leave = function _leave(event, context) {
439
+ var dataKey = this.constructor.DATA_KEY;
470
440
 
471
- context = context || $(event.currentTarget).data(dataKey);
441
+ context = context || $(event.currentTarget).data(dataKey);
472
442
 
473
- if (!context) {
474
- context = new this.constructor(event.currentTarget, this._getDelegateConfig());
475
- $(event.currentTarget).data(dataKey, context);
476
- }
443
+ if (!context) {
444
+ context = new this.constructor(event.currentTarget, this._getDelegateConfig());
445
+ $(event.currentTarget).data(dataKey, context);
446
+ }
477
447
 
478
- if (event) {
479
- context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
480
- }
448
+ if (event) {
449
+ context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
450
+ }
481
451
 
482
- if (context._isWithActiveTrigger()) {
483
- return;
484
- }
452
+ if (context._isWithActiveTrigger()) {
453
+ return;
454
+ }
455
+
456
+ clearTimeout(context._timeout);
485
457
 
486
- clearTimeout(context._timeout);
458
+ context._hoverState = HoverState.OUT;
487
459
 
488
- context._hoverState = HoverState.OUT;
460
+ if (!context.config.delay || !context.config.delay.hide) {
461
+ context.hide();
462
+ return;
463
+ }
489
464
 
490
- if (!context.config.delay || !context.config.delay.hide) {
465
+ context._timeout = setTimeout(function () {
466
+ if (context._hoverState === HoverState.OUT) {
491
467
  context.hide();
492
- return;
493
468
  }
469
+ }, context.config.delay.hide);
470
+ };
494
471
 
495
- context._timeout = setTimeout(function () {
496
- if (context._hoverState === HoverState.OUT) {
497
- context.hide();
498
- }
499
- }, context.config.delay.hide);
500
- }
501
- }, {
502
- key: '_isWithActiveTrigger',
503
- value: function _isWithActiveTrigger() {
504
- for (var trigger in this._activeTrigger) {
505
- if (this._activeTrigger[trigger]) {
506
- return true;
507
- }
472
+ Tooltip.prototype._isWithActiveTrigger = function _isWithActiveTrigger() {
473
+ for (var trigger in this._activeTrigger) {
474
+ if (this._activeTrigger[trigger]) {
475
+ return true;
508
476
  }
509
-
510
- return false;
511
477
  }
512
- }, {
513
- key: '_getConfig',
514
- value: function _getConfig(config) {
515
- config = $.extend({}, this.constructor.Default, $(this.element).data(), config);
516
-
517
- if (config.delay && typeof config.delay === 'number') {
518
- config.delay = {
519
- show: config.delay,
520
- hide: config.delay
521
- };
522
- }
523
478
 
524
- Util.typeCheckConfig(NAME, config, this.constructor.DefaultType);
479
+ return false;
480
+ };
481
+
482
+ Tooltip.prototype._getConfig = function _getConfig(config) {
483
+ config = $.extend({}, this.constructor.Default, $(this.element).data(), config);
525
484
 
526
- return config;
485
+ if (config.delay && typeof config.delay === 'number') {
486
+ config.delay = {
487
+ show: config.delay,
488
+ hide: config.delay
489
+ };
527
490
  }
528
- }, {
529
- key: '_getDelegateConfig',
530
- value: function _getDelegateConfig() {
531
- var config = {};
532
-
533
- if (this.config) {
534
- for (var key in this.config) {
535
- if (this.constructor.Default[key] !== this.config[key]) {
536
- config[key] = this.config[key];
537
- }
491
+
492
+ Util.typeCheckConfig(NAME, config, this.constructor.DefaultType);
493
+
494
+ return config;
495
+ };
496
+
497
+ Tooltip.prototype._getDelegateConfig = function _getDelegateConfig() {
498
+ var config = {};
499
+
500
+ if (this.config) {
501
+ for (var key in this.config) {
502
+ if (this.constructor.Default[key] !== this.config[key]) {
503
+ config[key] = this.config[key];
538
504
  }
539
505
  }
540
-
541
- return config;
542
506
  }
543
507
 
544
- // static
508
+ return config;
509
+ };
545
510
 
546
- }], [{
547
- key: '_jQueryInterface',
548
- value: function _jQueryInterface(config) {
549
- return this.each(function () {
550
- var data = $(this).data(DATA_KEY);
551
- var _config = typeof config === 'object' ? config : null;
511
+ // static
552
512
 
553
- if (!data && /destroy|hide/.test(config)) {
554
- return;
555
- }
513
+ Tooltip._jQueryInterface = function _jQueryInterface(config) {
514
+ return this.each(function () {
515
+ var data = $(this).data(DATA_KEY);
516
+ var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' ? config : null;
556
517
 
557
- if (!data) {
558
- data = new Tooltip(this, _config);
559
- $(this).data(DATA_KEY, data);
560
- }
518
+ if (!data && /dispose|hide/.test(config)) {
519
+ return;
520
+ }
561
521
 
562
- if (typeof config === 'string') {
563
- if (data[config] === undefined) {
564
- throw new Error('No method named "' + config + '"');
565
- }
566
- data[config]();
522
+ if (!data) {
523
+ data = new Tooltip(this, _config);
524
+ $(this).data(DATA_KEY, data);
525
+ }
526
+
527
+ if (typeof config === 'string') {
528
+ if (data[config] === undefined) {
529
+ throw new Error('No method named "' + config + '"');
567
530
  }
568
- });
569
- }
570
- }, {
531
+ data[config]();
532
+ }
533
+ });
534
+ };
535
+
536
+ _createClass(Tooltip, null, [{
571
537
  key: 'VERSION',
572
538
  get: function get() {
573
539
  return VERSION;
@@ -605,7 +571,13 @@ var Tooltip = (function ($) {
605
571
  }]);
606
572
 
607
573
  return Tooltip;
608
- })();
574
+ }();
575
+
576
+ /**
577
+ * ------------------------------------------------------------------------
578
+ * jQuery
579
+ * ------------------------------------------------------------------------
580
+ */
609
581
 
610
582
  $.fn[NAME] = Tooltip._jQueryInterface;
611
583
  $.fn[NAME].Constructor = Tooltip;
@@ -615,4 +587,4 @@ var Tooltip = (function ($) {
615
587
  };
616
588
 
617
589
  return Tooltip;
618
- })(jQuery);
590
+ }(jQuery); /* global Tether */