bootstrap 5.0.1 → 5.0.2

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 (47) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/assets/javascripts/bootstrap-sprockets.js +7 -7
  4. data/assets/javascripts/bootstrap.js +332 -311
  5. data/assets/javascripts/bootstrap.min.js +2 -2
  6. data/assets/javascripts/bootstrap/alert.js +18 -17
  7. data/assets/javascripts/bootstrap/base-component.js +34 -25
  8. data/assets/javascripts/bootstrap/button.js +18 -19
  9. data/assets/javascripts/bootstrap/carousel.js +67 -52
  10. data/assets/javascripts/bootstrap/collapse.js +15 -6
  11. data/assets/javascripts/bootstrap/dom/data.js +2 -2
  12. data/assets/javascripts/bootstrap/dom/event-handler.js +2 -2
  13. data/assets/javascripts/bootstrap/dom/manipulator.js +2 -2
  14. data/assets/javascripts/bootstrap/dom/selector-engine.js +2 -2
  15. data/assets/javascripts/bootstrap/dropdown.js +61 -44
  16. data/assets/javascripts/bootstrap/modal.js +171 -108
  17. data/assets/javascripts/bootstrap/offcanvas.js +144 -95
  18. data/assets/javascripts/bootstrap/popover.js +35 -20
  19. data/assets/javascripts/bootstrap/scrollspy.js +14 -5
  20. data/assets/javascripts/bootstrap/tab.js +18 -10
  21. data/assets/javascripts/bootstrap/toast.js +17 -15
  22. data/assets/javascripts/bootstrap/tooltip.js +20 -21
  23. data/assets/stylesheets/_bootstrap-grid.scss +1 -1
  24. data/assets/stylesheets/_bootstrap-reboot.scss +1 -1
  25. data/assets/stylesheets/_bootstrap.scss +1 -1
  26. data/assets/stylesheets/bootstrap/_card.scss +5 -5
  27. data/assets/stylesheets/bootstrap/_carousel.scss +2 -2
  28. data/assets/stylesheets/bootstrap/_dropdown.scss +4 -4
  29. data/assets/stylesheets/bootstrap/_functions.scss +61 -3
  30. data/assets/stylesheets/bootstrap/_images.scss +1 -1
  31. data/assets/stylesheets/bootstrap/_modal.scss +4 -4
  32. data/assets/stylesheets/bootstrap/_offcanvas.scss +4 -2
  33. data/assets/stylesheets/bootstrap/_popover.scss +10 -10
  34. data/assets/stylesheets/bootstrap/_tables.scss +1 -1
  35. data/assets/stylesheets/bootstrap/_toasts.scss +1 -1
  36. data/assets/stylesheets/bootstrap/_tooltip.scss +4 -4
  37. data/assets/stylesheets/bootstrap/_variables.scss +22 -18
  38. data/assets/stylesheets/bootstrap/bootstrap-utilities.scss +1 -1
  39. data/assets/stylesheets/bootstrap/forms/_floating-labels.scss +3 -1
  40. data/assets/stylesheets/bootstrap/forms/_form-check.scss +1 -1
  41. data/assets/stylesheets/bootstrap/forms/_form-range.scss +1 -1
  42. data/assets/stylesheets/bootstrap/forms/_form-select.scss +3 -0
  43. data/assets/stylesheets/bootstrap/mixins/_buttons.scss +1 -1
  44. data/assets/stylesheets/bootstrap/mixins/_grid.scss +16 -9
  45. data/assets/stylesheets/bootstrap/vendor/_rfs.scss +55 -13
  46. data/lib/bootstrap/version.rb +2 -2
  47. metadata +2 -2
@@ -1,19 +1,18 @@
1
1
  /*!
2
- * Bootstrap offcanvas.js v5.0.1 (https://getbootstrap.com/)
2
+ * Bootstrap offcanvas.js v5.0.2 (https://getbootstrap.com/)
3
3
  * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
6
6
  (function (global, factory) {
7
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/selector-engine.js'), require('./dom/manipulator.js'), require('./dom/data.js'), require('./dom/event-handler.js'), require('./base-component.js')) :
8
- typeof define === 'function' && define.amd ? define(['./dom/selector-engine', './dom/manipulator', './dom/data', './dom/event-handler', './base-component'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Offcanvas = factory(global.SelectorEngine, global.Manipulator, global.Data, global.EventHandler, global.Base));
10
- }(this, (function (SelectorEngine, Manipulator, Data, EventHandler, BaseComponent) { 'use strict';
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/selector-engine.js'), require('./dom/manipulator.js'), require('./dom/event-handler.js'), require('./base-component.js')) :
8
+ typeof define === 'function' && define.amd ? define(['./dom/selector-engine', './dom/manipulator', './dom/event-handler', './base-component'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Offcanvas = factory(global.SelectorEngine, global.Manipulator, global.EventHandler, global.Base));
10
+ }(this, (function (SelectorEngine, Manipulator, EventHandler, BaseComponent) { 'use strict';
11
11
 
12
12
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
13
 
14
14
  var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
15
15
  var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
16
- var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
17
16
  var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
18
17
  var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
19
18
 
@@ -96,22 +95,17 @@
96
95
  return typeof obj.nodeType !== 'undefined';
97
96
  };
98
97
 
99
- const emulateTransitionEnd = (element, duration) => {
100
- let called = false;
101
- const durationPadding = 5;
102
- const emulatedDuration = duration + durationPadding;
98
+ const getElement = obj => {
99
+ if (isElement(obj)) {
100
+ // it's a jQuery object or a node element
101
+ return obj.jquery ? obj[0] : obj;
102
+ }
103
103
 
104
- function listener() {
105
- called = true;
106
- element.removeEventListener(TRANSITION_END, listener);
104
+ if (typeof obj === 'string' && obj.length > 0) {
105
+ return SelectorEngine__default['default'].findOne(obj);
107
106
  }
108
107
 
109
- element.addEventListener(TRANSITION_END, listener);
110
- setTimeout(() => {
111
- if (!called) {
112
- triggerTransitionEnd(element);
113
- }
114
- }, emulatedDuration);
108
+ return null;
115
109
  };
116
110
 
117
111
  const typeCheckConfig = (componentName, config, configTypes) => {
@@ -127,17 +121,11 @@
127
121
  };
128
122
 
129
123
  const isVisible = element => {
130
- if (!element) {
124
+ if (!isElement(element) || element.getClientRects().length === 0) {
131
125
  return false;
132
126
  }
133
127
 
134
- if (element.style && element.parentNode && element.parentNode.style) {
135
- const elementStyle = getComputedStyle(element);
136
- const parentNodeStyle = getComputedStyle(element.parentNode);
137
- return elementStyle.display !== 'none' && parentNodeStyle.display !== 'none' && elementStyle.visibility !== 'hidden';
138
- }
139
-
140
- return false;
128
+ return getComputedStyle(element).getPropertyValue('visibility') === 'visible';
141
129
  };
142
130
 
143
131
  const isDisabled = element => {
@@ -170,9 +158,18 @@
170
158
  return null;
171
159
  };
172
160
 
161
+ const DOMContentLoadedCallbacks = [];
162
+
173
163
  const onDOMContentLoaded = callback => {
174
164
  if (document.readyState === 'loading') {
175
- document.addEventListener('DOMContentLoaded', callback);
165
+ // add listener on the first call when the document is in loading state
166
+ if (!DOMContentLoadedCallbacks.length) {
167
+ document.addEventListener('DOMContentLoaded', () => {
168
+ DOMContentLoadedCallbacks.forEach(callback => callback());
169
+ });
170
+ }
171
+
172
+ DOMContentLoadedCallbacks.push(callback);
176
173
  } else {
177
174
  callback();
178
175
  }
@@ -203,83 +200,143 @@
203
200
  }
204
201
  };
205
202
 
203
+ const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {
204
+ if (!waitForTransition) {
205
+ execute(callback);
206
+ return;
207
+ }
208
+
209
+ const durationPadding = 5;
210
+ const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding;
211
+ let called = false;
212
+
213
+ const handler = ({
214
+ target
215
+ }) => {
216
+ if (target !== transitionElement) {
217
+ return;
218
+ }
219
+
220
+ called = true;
221
+ transitionElement.removeEventListener(TRANSITION_END, handler);
222
+ execute(callback);
223
+ };
224
+
225
+ transitionElement.addEventListener(TRANSITION_END, handler);
226
+ setTimeout(() => {
227
+ if (!called) {
228
+ triggerTransitionEnd(transitionElement);
229
+ }
230
+ }, emulatedDuration);
231
+ };
232
+
206
233
  /**
207
234
  * --------------------------------------------------------------------------
208
- * Bootstrap (v5.0.1): util/scrollBar.js
235
+ * Bootstrap (v5.0.2): util/scrollBar.js
209
236
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
210
237
  * --------------------------------------------------------------------------
211
238
  */
212
239
  const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
213
240
  const SELECTOR_STICKY_CONTENT = '.sticky-top';
214
241
 
215
- const getWidth = () => {
216
- // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
217
- const documentWidth = document.documentElement.clientWidth;
218
- return Math.abs(window.innerWidth - documentWidth);
219
- };
242
+ class ScrollBarHelper {
243
+ constructor() {
244
+ this._element = document.body;
245
+ }
220
246
 
221
- const hide = (width = getWidth()) => {
222
- _disableOverFlow(); // give padding to element to balances the hidden scrollbar width
247
+ getWidth() {
248
+ // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
249
+ const documentWidth = document.documentElement.clientWidth;
250
+ return Math.abs(window.innerWidth - documentWidth);
251
+ }
223
252
 
253
+ hide() {
254
+ const width = this.getWidth();
224
255
 
225
- _setElementAttributes('body', 'paddingRight', calculatedValue => calculatedValue + width); // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements, to keep shown fullwidth
256
+ this._disableOverFlow(); // give padding to element to balance the hidden scrollbar width
226
257
 
227
258
 
228
- _setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width);
259
+ this._setElementAttributes(this._element, 'paddingRight', calculatedValue => calculatedValue + width); // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth
229
260
 
230
- _setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width);
231
- };
232
261
 
233
- const _disableOverFlow = () => {
234
- const actualValue = document.body.style.overflow;
262
+ this._setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width);
235
263
 
236
- if (actualValue) {
237
- Manipulator__default['default'].setDataAttribute(document.body, 'overflow', actualValue);
264
+ this._setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width);
238
265
  }
239
266
 
240
- document.body.style.overflow = 'hidden';
241
- };
267
+ _disableOverFlow() {
268
+ this._saveInitialAttribute(this._element, 'overflow');
242
269
 
243
- const _setElementAttributes = (selector, styleProp, callback) => {
244
- const scrollbarWidth = getWidth();
245
- SelectorEngine__default['default'].find(selector).forEach(element => {
246
- if (element !== document.body && window.innerWidth > element.clientWidth + scrollbarWidth) {
247
- return;
248
- }
270
+ this._element.style.overflow = 'hidden';
271
+ }
249
272
 
250
- const actualValue = element.style[styleProp];
251
- const calculatedValue = window.getComputedStyle(element)[styleProp];
252
- Manipulator__default['default'].setDataAttribute(element, styleProp, actualValue);
253
- element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`;
254
- });
255
- };
273
+ _setElementAttributes(selector, styleProp, callback) {
274
+ const scrollbarWidth = this.getWidth();
256
275
 
257
- const reset = () => {
258
- _resetElementAttributes('body', 'overflow');
276
+ const manipulationCallBack = element => {
277
+ if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {
278
+ return;
279
+ }
259
280
 
260
- _resetElementAttributes('body', 'paddingRight');
281
+ this._saveInitialAttribute(element, styleProp);
261
282
 
262
- _resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
283
+ const calculatedValue = window.getComputedStyle(element)[styleProp];
284
+ element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`;
285
+ };
263
286
 
264
- _resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
265
- };
287
+ this._applyManipulationCallback(selector, manipulationCallBack);
288
+ }
289
+
290
+ reset() {
291
+ this._resetElementAttributes(this._element, 'overflow');
292
+
293
+ this._resetElementAttributes(this._element, 'paddingRight');
294
+
295
+ this._resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
296
+
297
+ this._resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
298
+ }
299
+
300
+ _saveInitialAttribute(element, styleProp) {
301
+ const actualValue = element.style[styleProp];
302
+
303
+ if (actualValue) {
304
+ Manipulator__default['default'].setDataAttribute(element, styleProp, actualValue);
305
+ }
306
+ }
266
307
 
267
- const _resetElementAttributes = (selector, styleProp) => {
268
- SelectorEngine__default['default'].find(selector).forEach(element => {
269
- const value = Manipulator__default['default'].getDataAttribute(element, styleProp);
308
+ _resetElementAttributes(selector, styleProp) {
309
+ const manipulationCallBack = element => {
310
+ const value = Manipulator__default['default'].getDataAttribute(element, styleProp);
270
311
 
271
- if (typeof value === 'undefined') {
272
- element.style.removeProperty(styleProp);
312
+ if (typeof value === 'undefined') {
313
+ element.style.removeProperty(styleProp);
314
+ } else {
315
+ Manipulator__default['default'].removeDataAttribute(element, styleProp);
316
+ element.style[styleProp] = value;
317
+ }
318
+ };
319
+
320
+ this._applyManipulationCallback(selector, manipulationCallBack);
321
+ }
322
+
323
+ _applyManipulationCallback(selector, callBack) {
324
+ if (isElement(selector)) {
325
+ callBack(selector);
273
326
  } else {
274
- Manipulator__default['default'].removeDataAttribute(element, styleProp);
275
- element.style[styleProp] = value;
327
+ SelectorEngine__default['default'].find(selector, this._element).forEach(callBack);
276
328
  }
277
- });
278
- };
329
+ }
330
+
331
+ isOverflowing() {
332
+ return this.getWidth() > 0;
333
+ }
334
+
335
+ }
279
336
 
280
337
  /**
281
338
  * --------------------------------------------------------------------------
282
- * Bootstrap (v5.0.1): util/backdrop.js
339
+ * Bootstrap (v5.0.2): util/backdrop.js
283
340
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
284
341
  * --------------------------------------------------------------------------
285
342
  */
@@ -287,14 +344,14 @@
287
344
  isVisible: true,
288
345
  // if false, we use the backdrop helper without adding any element to the dom
289
346
  isAnimated: false,
290
- rootElement: document.body,
347
+ rootElement: 'body',
291
348
  // give the choice to place backdrop under different elements
292
349
  clickCallback: null
293
350
  };
294
351
  const DefaultType$1 = {
295
352
  isVisible: 'boolean',
296
353
  isAnimated: 'boolean',
297
- rootElement: 'element',
354
+ rootElement: '(element|string)',
298
355
  clickCallback: '(function|null)'
299
356
  };
300
357
  const NAME$1 = 'backdrop';
@@ -362,8 +419,9 @@
362
419
  _getConfig(config) {
363
420
  config = { ...Default$1,
364
421
  ...(typeof config === 'object' ? config : {})
365
- };
366
- config.rootElement = config.rootElement || document.body;
422
+ }; // use getElement() with the default "body" to get a fresh Element on each instantiation
423
+
424
+ config.rootElement = getElement(config.rootElement);
367
425
  typeCheckConfig(NAME$1, config, DefaultType$1);
368
426
  return config;
369
427
  }
@@ -388,27 +446,20 @@
388
446
 
389
447
  EventHandler__default['default'].off(this._element, EVENT_MOUSEDOWN);
390
448
 
391
- this._getElement().parentNode.removeChild(this._element);
449
+ this._element.remove();
392
450
 
393
451
  this._isAppended = false;
394
452
  }
395
453
 
396
454
  _emulateAnimation(callback) {
397
- if (!this._config.isAnimated) {
398
- execute(callback);
399
- return;
400
- }
401
-
402
- const backdropTransitionDuration = getTransitionDurationFromElement(this._getElement());
403
- EventHandler__default['default'].one(this._getElement(), 'transitionend', () => execute(callback));
404
- emulateTransitionEnd(this._getElement(), backdropTransitionDuration);
455
+ executeAfterTransition(callback, this._getElement(), this._config.isAnimated);
405
456
  }
406
457
 
407
458
  }
408
459
 
409
460
  /**
410
461
  * --------------------------------------------------------------------------
411
- * Bootstrap (v5.0.1): offcanvas.js
462
+ * Bootstrap (v5.0.2): offcanvas.js
412
463
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
413
464
  * --------------------------------------------------------------------------
414
465
  */
@@ -495,7 +546,7 @@
495
546
  this._backdrop.show();
496
547
 
497
548
  if (!this._config.scroll) {
498
- hide();
549
+ new ScrollBarHelper().hide();
499
550
 
500
551
  this._enforceFocusOnElement(this._element);
501
552
  }
@@ -548,7 +599,7 @@
548
599
  this._element.style.visibility = 'hidden';
549
600
 
550
601
  if (!this._config.scroll) {
551
- reset();
602
+ new ScrollBarHelper().reset();
552
603
  }
553
604
 
554
605
  EventHandler__default['default'].trigger(this._element, EVENT_HIDDEN);
@@ -606,7 +657,7 @@
606
657
 
607
658
  static jQueryInterface(config) {
608
659
  return this.each(function () {
609
- const data = Data__default['default'].get(this, DATA_KEY) || new Offcanvas(this, typeof config === 'object' ? config : {});
660
+ const data = Offcanvas.getOrCreateInstance(this, config);
610
661
 
611
662
  if (typeof config !== 'string') {
612
663
  return;
@@ -652,12 +703,10 @@
652
703
  Offcanvas.getInstance(allReadyOpen).hide();
653
704
  }
654
705
 
655
- const data = Data__default['default'].get(target, DATA_KEY) || new Offcanvas(target);
706
+ const data = Offcanvas.getOrCreateInstance(target);
656
707
  data.toggle(this);
657
708
  });
658
- EventHandler__default['default'].on(window, EVENT_LOAD_DATA_API, () => {
659
- SelectorEngine__default['default'].find(OPEN_SELECTOR).forEach(el => (Data__default['default'].get(el, DATA_KEY) || new Offcanvas(el)).show());
660
- });
709
+ EventHandler__default['default'].on(window, EVENT_LOAD_DATA_API, () => SelectorEngine__default['default'].find(OPEN_SELECTOR).forEach(el => Offcanvas.getOrCreateInstance(el).show()));
661
710
  /**
662
711
  * ------------------------------------------------------------------------
663
712
  * jQuery
@@ -1,18 +1,17 @@
1
1
  /*!
2
- * Bootstrap popover.js v5.0.1 (https://getbootstrap.com/)
2
+ * Bootstrap popover.js v5.0.2 (https://getbootstrap.com/)
3
3
  * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
6
6
  (function (global, factory) {
7
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/selector-engine.js'), require('./dom/data.js'), require('./tooltip.js')) :
8
- typeof define === 'function' && define.amd ? define(['./dom/selector-engine', './dom/data', './tooltip'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Popover = factory(global.SelectorEngine, global.Data, global.Tooltip));
10
- }(this, (function (SelectorEngine, Data, Tooltip) { 'use strict';
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/selector-engine.js'), require('./tooltip.js')) :
8
+ typeof define === 'function' && define.amd ? define(['./dom/selector-engine', './tooltip'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Popover = factory(global.SelectorEngine, global.Tooltip));
10
+ }(this, (function (SelectorEngine, Tooltip) { 'use strict';
11
11
 
12
12
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
13
 
14
14
  var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
15
- var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
16
15
  var Tooltip__default = /*#__PURE__*/_interopDefaultLegacy(Tooltip);
17
16
 
18
17
  const getjQuery = () => {
@@ -27,9 +26,18 @@
27
26
  return null;
28
27
  };
29
28
 
29
+ const DOMContentLoadedCallbacks = [];
30
+
30
31
  const onDOMContentLoaded = callback => {
31
32
  if (document.readyState === 'loading') {
32
- document.addEventListener('DOMContentLoaded', callback);
33
+ // add listener on the first call when the document is in loading state
34
+ if (!DOMContentLoadedCallbacks.length) {
35
+ document.addEventListener('DOMContentLoaded', () => {
36
+ DOMContentLoadedCallbacks.forEach(callback => callback());
37
+ });
38
+ }
39
+
40
+ DOMContentLoadedCallbacks.push(callback);
33
41
  } else {
34
42
  callback();
35
43
  }
@@ -56,7 +64,7 @@
56
64
 
57
65
  /**
58
66
  * --------------------------------------------------------------------------
59
- * Bootstrap (v5.0.1): popover.js
67
+ * Bootstrap (v5.0.2): popover.js
60
68
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
61
69
  * --------------------------------------------------------------------------
62
70
  */
@@ -126,6 +134,24 @@
126
134
  return this.getTitle() || this._getContent();
127
135
  }
128
136
 
137
+ getTipElement() {
138
+ if (this.tip) {
139
+ return this.tip;
140
+ }
141
+
142
+ this.tip = super.getTipElement();
143
+
144
+ if (!this.getTitle()) {
145
+ SelectorEngine__default['default'].findOne(SELECTOR_TITLE, this.tip).remove();
146
+ }
147
+
148
+ if (!this._getContent()) {
149
+ SelectorEngine__default['default'].findOne(SELECTOR_CONTENT, this.tip).remove();
150
+ }
151
+
152
+ return this.tip;
153
+ }
154
+
129
155
  setContent() {
130
156
  const tip = this.getTipElement(); // we use append for html objects to maintain js events
131
157
 
@@ -162,18 +188,7 @@
162
188
 
163
189
  static jQueryInterface(config) {
164
190
  return this.each(function () {
165
- let data = Data__default['default'].get(this, DATA_KEY);
166
-
167
- const _config = typeof config === 'object' ? config : null;
168
-
169
- if (!data && /dispose|hide/.test(config)) {
170
- return;
171
- }
172
-
173
- if (!data) {
174
- data = new Popover(this, _config);
175
- Data__default['default'].set(this, DATA_KEY, data);
176
- }
191
+ const data = Popover.getOrCreateInstance(this, config);
177
192
 
178
193
  if (typeof config === 'string') {
179
194
  if (typeof data[config] === 'undefined') {